tests-zt: This test stalls compiled with tests-pkg and tests-nanocoap_cache
@miri64 found an issue with unittest and ztimer_sleep in
https://github.com/RIOT-OS/RIOT/pull/17680#issuecomment-1184312760
Contribution description
this PR has a test to reproduce this issue
Testing procedure
make tests-zt tests-nanocoap_cache tests-pkt
make term
or
USEMODULE="ztimer_sec" make tests-zt tests-pkt
will show the issue
make tests-zt
make term
will not
Issues/PRs references
https://github.com/RIOT-OS/RIOT/pull/17680#issuecomment-1184312760
i ran module info
make tests-zt tests-pkt info-modules > m3
m3.txt working
USEMODULE="ztimer_sec" make tests-zt tests-pkt info-modules > m4
m4.txt failing
USEMODULE="ztimer_sec" make tests-zt tests-pkt
also has the issue
USEMODULE="ztimer_sec evtimer" make tests-zt term make the issue appear
USEMODULE="ztimer_sec evtimer" make tests-zt termmake the issue appear
So maybe just removing the gnrc_ipv6 dependency from tests-pkt might be enough? Looking at the tests, this should really be gnrc_nettype_ipv6 (which was introduced later than the test was deployed).
I think this is caused by unittests/main.c calling xtimer_init(), which in the (default) ztimer_xtimer_compat case leads to ztimer_init() being called twice. That`s not supposed to happen.
I think this is caused by
unittests/main.ccallingxtimer_init(), which in the (default) ztimer_xtimer_compat case leads toztimer_init()being called twice. That`s not supposed to happen.
Mh... xtimer_init() used to be idempotent :-/ Could this be assured (or at least a full state reset) for ztimer_init as well?
not calling xtimer_init when when using compat mode seems to solve
https://github.com/RIOT-OS/RIOT/blob/897abd09f2539f4e36e34e78402d7dcfad09e5b6/sys/include/ztimer/xtimer_compat.h#L70-L73
Should we remove L72? (sys/auto_init has the same do not call xtimer_init if compat mode)