zephyr/tests/bluetooth/host/keys/mocks
Théo Battrel a57dbb15db Bluetooth: Consolidate duplicated code
The file `tests/bluetooth/host/keys/bt_keys_get_addr/src/main.c` was using
functions from `tests/bluetooth/host/host_mocks/print_utils.c` which were
exactly the same as the one in `common/log.h`.

The code was duplicated because the test author wanted to include
`common/log.h` to get the stringifying functions, but could not due to
unwanted side-effects.

See the comment from the unit test author here:
https://github.com/zephyrproject-rtos/zephyr/pull/48676#discussion_r973672151

The new `common/bt_str.h` does not have side-effects, so it is
suitable for unit tests.

The `snprintk` function has been redefined inside the `main.c` to use the
libc because of the kernel being not compiled entirely.

Also, the `CONFIG_LOG`, `CONFIG_BT_DEBUG_LOG` and
`CONFIG_TEST_LOGGING_DEFAULTS` have been disabled in the Kconfig files
of each `keys` tests. That so logs are not compiled and so, there is
no need to link the `printk` functions that are used by the logs.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-11-02 13:28:57 +01:00
..
CMakeLists.txt Bluetooth: Consolidate duplicated code 2022-11-02 13:28:57 +01:00
conn.c Bluetooth: tests: use a single definition of the fff global 2022-10-26 13:29:19 +02:00
conn.h include: add missing zephyr/ prefix 2022-10-06 10:41:02 +02:00
hci_core.c Bluetooth: tests: use a single definition of the fff global 2022-10-26 13:29:19 +02:00
hci_core.h include: add missing zephyr/ prefix 2022-10-06 10:41:02 +02:00
hci_core_expects.c include: add missing zephyr/ prefix 2022-10-06 10:41:02 +02:00
hci_core_expects.h
id.c Bluetooth: tests: use a single definition of the fff global 2022-10-26 13:29:19 +02:00
id.h include: add missing zephyr/ prefix 2022-10-06 10:41:02 +02:00
keys_help_utils.c tests: bluetooth: host: Add UT for bt_keys_foreach_type() 2022-10-11 11:14:10 +02:00
keys_help_utils.h tests: bluetooth: host: Add UT for bt_keys_foreach_type() 2022-10-11 11:14:10 +02:00
rpa.c Bluetooth: tests: use a single definition of the fff global 2022-10-26 13:29:19 +02:00
rpa.h include: add missing zephyr/ prefix 2022-10-06 10:41:02 +02:00