- Support for listing both testcases and testsuites
- Support for running single suites or single test cases
- Support shuffling tests and repeating execution based on command line
arguments.
For example, build with
west build -p -b qemu_cortex_m3 tests/kernel/sleep -t run -- \
-DCONFIG_ZTEST_SHUFFLE=y -DCONFIG_ZTEST_SHELL=y
Following commands are available:
uart:~$ ztest
ztest - Ztest commands
Subcommands:
run-all :Run all tests
shuffle :Shuffle tests
list-testsuites :List all test suites
list-testcases :List all test cases
run-testsuite :Run test suite
run-testcase :Run testcase
shuffle accepts two arguments --suite_iter and --case_iter which allows
repeated exercution of testcases or suites.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The enum used for connection types gets named bt_conn_type to guard
against accidental usage of generic integers with relation to it.
The added default case in several switch statements avoids warnings
against unhandled enum values.
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
Following the previous commit that introduce the settings API for the
Bluetooth subsystem, some unit tests needed to be updated to use it.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from tests. It has
been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183
The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This drops using the environmental part when referencing ZEPHYR_BASE
as the environment value does not have to be set and, in most cases,
is no longer set at all.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Unit test project for bt_keys_update_usage().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Unit test project for bt_keys_find_addr().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
A PR got in after some changes were done to the BT logging system. This
nulls the error by not including the logging framework in this unit test.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Unit test project for bt_keys_find_irk().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Unit test project for bt_keys_get_type().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Move the function in the `subsys/testsuite/ztest/src/ztest_mock.c` files.
This is motivated by the fact that there is others re-implementation of
`*printk` functions using libc counterparts in the `ztest_mock.c` file.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
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>
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>
Add missed 'zephyr' prefix to files paths while including.
Also, remove that paths from libraries include paths to generate
compilation error if shortened path is used.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
CI tests were failing due to a recent change to zassume_true()
implementation.
While the test case is still skipped when assumption fails, but it is
now causing the final execution result to fail.
zassume_true() was replaced by ztest_test_skip() combined with
a conditional 'if' statement to get the required effect.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Unit test project for bt_foreach_bond().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Unit test project for bt_keys_foreach_type().
This part of subsys/bluetooth/host/keys.c unit testing.
Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
Some files still manage to get into the tree without the zephyr/ include
prefix (likely because they lack CI coverage).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>