RIOT
RIOT copied to clipboard
tests: Use ASAN for all (native) tests
Contribution description
So far, ASAN has only been used in unit tests for native, but not in general tests.
ASAN would have spotted issues like https://github.com/RIOT-OS/RIOT/pull/20549, and may spot security issues as well -- but only wen turned on.
There is a trade-off: Enabling ASAN pulls in the NATIVE_MEMORY define that disables TLSF. I think it's worth it: It's more likely we make bugs anywhere in the tested code base that are spotted this way than to overlook TLSF bugs that only occur on native (because it's still tested on other boards), and memory properties are different on native already anyway.
(FWIW I'd advocate enabling ASAN for developers all the time, but let's take it one step at a time.)
Testing procedure
- Look at what CI does.
Murdock results
:x: FAILED
474681127fc732595c3f671924ac1f770024c1d9 fixup!
Success | Failures | Total | Runtime |
---|---|---|---|
76 | 0 | 9072 | 01m:11s |
Artifacts
This fails before the Do-Not-Merge should-really-fail commit on top, first time in tests_rtc, but I don't know enough about native's signal handling to make anything of it -- @fjmolinas, @OlegHahm, any ideas?
copy of the linked test failure
make: Entering directory '/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/tests/periph/rtc'
r
/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/build/tests_rtc.elf tap0
RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.
Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: buildtest)
RIOT RTC low-level driver test
This test will display 'Alarm!' every 2 seconds for 4 times
Native RTC initialized.
Clock value is now 2024-04-06 10:12:19.871
Setting clock to 2020-02-28 23:59:57
Clock value is now 2020-02-28 23:59:57.872
Setting alarm to 2020-02-28 23:59:59
Alarm is set to 2020-02-28 23:59:59
Alarm cleared at 2020-02-28 23:59:57.872
==3281131==WARNING: ASan doesn't fully support makecontext/swapcontext functions and may produce false positives in some cases!
No alarm at 2020-02-28 23:59:59.873
Setting alarm to 2020-02-28 23:59:61
==3281131==WARNING: ASan is ignoring requested __asan_handle_no_return: stack type: default top: 0xffed7000; bottom 0x0806c000; size: 0xf7e6b000 (-135876608)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/build/tests_rtc.elf: _native_popsig: real_read: Bad file descriptor
make[1]: *** [/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/Makefile.include:880: cleanterm] Error 1
Unexpected end of file in expect script at "child.expect_exact('Alarm!')" (tests/periph/rtc/tests/01-run.py:44)
make: Leaving directory '/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/tests/periph/rtc'
make: *** [/tmp/dwq.0.23625481922180303/3ceeccac73369c4555874a7f14ea1734/makefiles/tests/tests.inc.mk:26: test] Error 1
Hm, at least test_rtc is not failing on the mentioned commit on my machine (clang version 17.0.6). How can I trigger all tests at once?
(FWIW I'd advocate enabling ASAN for developers all the time, but let's take it one step at a time.)
Yes please!
Hm, at least test_rtc is not failing on the mentioned commit on my machine [..]
Not reproducible for me either.