19402: sys/net/gnrc/netif: fixing no global address wait r=benpicco a=jan-mo
### Contribution description
The function `gnrc_netif_ipv6_wait_global_address()` will always return true, even if no global address is attached to the interface.
Currently the function only waits for any message and does not check if it was from the bus or not. So in `msg.content.ptr` is no valid address and therefore it returns true.
I added just the check, if the message is from the bus of any interface and then checking the address. We could also first check if the address in `msg.content.ptr` is valid, but this will just hide the bug. Also the timeout was never checked. It was just assuming that no other message will be received during the wait.
### Testing procedure
Use two devices, one works as a border router and supports the global address, the other will wait for the global address. You can call the function `gnrc_netif_ipv6_wait_global_address()` on the waiting node and see whether it returns true and finds the global address in the given time-range.
19404: sys/trickle: cleanup deps r=benpicco a=MrKevinWeiss
### Contribution description
Cleans the dependencies of the `trickle` module. This removes the deprecated xtimer and models kconfig.
### Testing procedure
Green murdock
### Issues/PRs references
19405: cpu/efm32: pwm_init errors are zeros r=benpicco a=chrysn
### Contribution description
pwm_init is documented to return 0 on errors, and has an unsigned return value.
EFM32's initialization function returned negative values, which through implicit casting become 0xffffffff or 0xfffffffe, which are successful by the documentation.
This makes all the EFM32 error paths return 0 as they should.
Also, it fixes a variable name and the corresponding error message that used to talk of "initiation" (which would be the start of a process) rather than "initialization" (which is a process that is completed before something else can happen).
### Testing procedure
* on stk3700, tests/periph_pwm, run `init 0 0 10 1000` / `set 0 0 500`
* The init used to respond with "The pwm frequency is set to 4294967294", and the set does nothing.
* The init now responds with "Error: device is not <del>initiated</del><ins>initialized</ins>". The set still does nothing, but then one doesn't expect it to any more.
(But really, looking at the patch and the docs should suffice).
### Issues/PRs references
By-catch from testing the Rust wrappers provided by `@remmirad` at https://github.com/RIOT-OS/rust-riot-wrappers/pull/38
Co-authored-by: Jan Mohr <jan.mohr@ml-pa.com>
Co-authored-by: MrKevinWeiss <weiss.kevin604@gmail.com>
Co-authored-by: chrysn <chrysn@fsfe.org>
There are a number of tests included in RIOT. They are located in the
tests folder. These tests
allow basic functionality to be verified as well as provide an example of
usage.
Running automated tests
Some tests can be performed automatically. The test automation scripts are
defined in the <test_application>/tests/ folder. They are written in python
and interact through the serial (typically UART) with the test application code running on a
board to do the validation. It is recommended to flash the board with the
test just before running it because some platforms cannot be reset while
testing.
Running single test
From the test application directory run:
BOARD=<board_of_your_choice> make flash test
An automated way of knowing if a test is available is to execute the
'test/available' target from the test application directory.
It executes without error if tests run by 'make test' are present.
make test/available
Running all test for particular board
If you would like execute all tests for given board, you could use dedicated
script compile_and_test_for_board.py
Running tests that require a preliminary manual configuration
Some tests need active monitoring or manual setup steps but still have some
automated scripts. The test automation scripts are defined in the
<test_application>/tests-with-config/ folder.
For running them, follow the setup or analysis documentation and use the
test-with-config target.
Running tests that require root privileges
Some tests require root privileges to launch their automated script. In this
case, the test automation scripts are defined in the
<test_application>/tests-as-root/ folder.
For running them, follow the setup or analysis documentation and use the
test-as-root target.
Cleaning intermediate files
After test execution intermediate files are not automatically deleted.
Execution of multiple tests, especially all for particular board could generate
many files. For example, after execution of all test for stm32f469i-disco board
(more than 230 tests) around 7.5 GB of intermediate files are created.
There are few methods for cleaning intermediate files.
If you would like to clean intermediate file only for particular board you should
go to main RIOT directory and execute one from these commands:
If you would like to clean intermediate files for all boards go to main RIOT
directory and use this command.
@warning This command cleans all local files, for example, pkg downloads and
locally generared docs.
make distclean
Implementing automated tests
The goal is to be able to run all tests in a sequential way for as many targets
as possible.
As some board can't be reset without a manual trigger tests should be implemented
with some kind of synchronization. This can be done in two ways:
use test_utils_interactive_sync when uart input/output does not need to be
disabled for the test. This is enabled by default.
set up the test in a loop so the test script will be able so sync with some kind
of start condition in the test.
The module for the first option is test_utils_interactive_sync and is set as a
default module in Makefile.tests_common. It can be disabled by setting in the
application makefile DISABLE_MODULE += test_utils_interactive_sync. The python
test script will adapt to it automatically.
When using the shell module, test_utils_interactive_sync will use the shell
itself to synchronize, and will not use test_utils_interactive_sync(); function
to synchronize. Some times you will want to synchronize before the start of the
script and use test_utils_interactive_sync(); function (e.g.:
tests/ps_schedstatistics). For these cases
you can disable test_utils_interactive_sync_shell module in the application
Makefile: DISABLE_MODULE += test_utils_interactive_sync_shell.
Automated Tests Guidelines
When using pexpect$ is useless for matching the end of a line, instead use
\r\n(pexpect end-of-line).
Beware of + and * at the end of patterns. These patterns will always get
a minimal match (non-greedy).(pexpect end-of-patterns)
This can be an issue when matching groups and using the matched groups to verify
some kind of behavior since * could return an empty match and + only a subset.
This is especially prevalent since printf() is buffered so the output might not
arrive in a single read to pexpect.
To avoid this make sure to match a non-ambiguous character at the end of the
pattern like \r\n, \s, \), etc..
don't:
child.expect(r'some string: (\d+)')
do:
child.expect(r'some string: (\d+)\r\n')
child.expect(r'some string: (\d+)\s')
child.expect(r'some string: (\d+) ,')
Use expect() instead of assert()
In order to make a test application functional in all cases, use expect()
instead of assert(). The former works like the latter, but will still be
compiled in if NDEBUG is defined. This is useful to keep a test application
working even when compiling with -DNDEBUG, allowing for the code-under-test to
be compiled with that flag. Otherwise, the application would force compiling
all tested code with assertions enabled.
expect() is defined in the header test_utils/expect.h.
Interaction through the uart
Tests implemented with testrunner use the cleanterm target that
provides an interaction without adding extra text output or input handling.
It can currently be expected to have unmodified line based interaction with the
board.
The expected behavior is verified with the test in tests/test_tools.
Tests cannot rely on having on all boards and terminal programs:
unbuffered input
allowing sending special characters like ctrl+c/ctrl+d