Bluetooth: tests: use a single definition of the fff global

Linking fails on ubuntu 22.04 because of multiple definitions of the `fff`
global, which is defined by `DEFINE_FFF_GLOBALS`.

Only define it in the tests' `main.c` instead of the mocks.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
This commit is contained in:
Jonathan Rico 2022-10-26 10:47:12 +02:00 committed by Carles Cufí
commit d870df0054
13 changed files with 22 additions and 12 deletions

View file

@ -8,10 +8,13 @@
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/buf.h>
#include <host/hci_core.h>
#include <zephyr/fff.h>
#include "mocks/net_buf.h"
#include "mocks/net_buf_expects.h"
#include "mocks/buf_help_utils.h"
DEFINE_FFF_GLOBALS;
static void tc_setup(void *f)
{
/* Register resets */

View file

@ -6,10 +6,13 @@
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/fff.h>
#include "mocks/net_buf.h"
#include "mocks/net_buf_expects.h"
#include "mocks/buf_help_utils.h"
DEFINE_FFF_GLOBALS;
/* Rows count equals number of events x 2 */
#define TEST_PARAMETERS_LUT_ROWS_COUNT 60

View file

@ -6,10 +6,13 @@
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/fff.h>
#include "mocks/net_buf.h"
#include "mocks/net_buf_expects.h"
#include "mocks/buf_help_utils.h"
DEFINE_FFF_GLOBALS;
static void tc_setup(void *f)
{
/* Register resets */

View file

@ -7,6 +7,9 @@
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/buf.h>
#include <zephyr/fff.h>
DEFINE_FFF_GLOBALS;
/* Rows count equals number of types */
#define TEST_PARAMETERS_LUT_ROWS_COUNT 7

View file

@ -9,8 +9,6 @@
#include <zephyr/bluetooth/buf.h>
#include <mocks/net_buf.h>
DEFINE_FFF_GLOBALS;
static uint8_t *fixed_data_alloc(struct net_buf *buf, size_t *size,
k_timeout_t timeout)
{

View file

@ -7,8 +7,6 @@
#include <zephyr/kernel.h>
#include "host_mocks/assert.h"
DEFINE_FFF_GLOBALS;
DEFINE_FAKE_VALUE_FUNC(bool, mock_check_if_assert_expected);
void assert_print(const char *fmt, ...)

View file

@ -8,9 +8,12 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/addr.h>
#include <host/keys.h>
#include <zephyr/fff.h>
#include "mocks/keys_help_utils.h"
#include "testing_common_defs.h"
DEFINE_FFF_GLOBALS;
/* This LUT contains different combinations of ID and Address pairs */
const struct id_addr_pair testing_id_addr_pair_lut[] = {
{ BT_ADDR_ID_1, BT_ADDR_LE_1 },

View file

@ -4,12 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <host/keys.h>
#include <zephyr/fff.h>
#include "mocks/keys_help_utils.h"
#include "testing_common_defs.h"
DEFINE_FFF_GLOBALS;
/* This LUT contains different combinations of ID, Address with no key type */
static const struct id_addr_type testing_id_addr_type_no_type_lut[] = {
{ BT_ADDR_ID_1, BT_ADDR_LE_1, 0x00 },

View file

@ -7,12 +7,15 @@
#include <zephyr/kernel.h>
#include <zephyr/bluetooth/addr.h>
#include <host/keys.h>
#include <zephyr/fff.h>
#include "mocks/conn.h"
#include "mocks/hci_core.h"
#include "mocks/keys_help_utils.h"
#include "host_mocks/print_utils.h"
#include "testing_common_defs.h"
DEFINE_FFF_GLOBALS;
/* This LUT contains different combinations of ID and Address pairs */
const struct id_addr_pair testing_id_addr_pair_lut[] = {
{ BT_ADDR_ID_1, BT_ADDR_LE_1 },

View file

@ -7,7 +7,5 @@
#include <zephyr/kernel.h>
#include "mocks/conn.h"
DEFINE_FFF_GLOBALS;
DEFINE_FAKE_VOID_FUNC(bt_conn_foreach, int, bt_conn_foreach_cb, void *);
DEFINE_FAKE_VALUE_FUNC(const bt_addr_le_t *, bt_conn_get_dst, const struct bt_conn *);

View file

@ -7,6 +7,4 @@
#include <zephyr/kernel.h>
#include "mocks/hci_core.h"
DEFINE_FFF_GLOBALS;
DEFINE_FAKE_VALUE_FUNC(int, bt_unpair, uint8_t, const bt_addr_le_t *);

View file

@ -7,6 +7,4 @@
#include <zephyr/kernel.h>
#include "mocks/id.h"
DEFINE_FFF_GLOBALS;
DEFINE_FAKE_VOID_FUNC(bt_id_del, struct bt_keys *);

View file

@ -7,6 +7,4 @@
#include <zephyr/kernel.h>
#include "mocks/rpa.h"
DEFINE_FFF_GLOBALS;
DEFINE_FAKE_VALUE_FUNC(bool, bt_rpa_irk_matches, const uint8_t *, const bt_addr_t *);