rten
rten copied to clipboard
Run tests under AddressSanitizer (and possibly other sanitizers)
Some packages (eg. rten-tensor) can be run under Miri to check for bugs. There are tests in the main rten crate which run much too slowly under Miri however. Instead these tests can be run under ASAN or other sanitizers. Aside from ASAN, the other sanitizers that would be most useful are MemorySanitizer and ThreadSanitizer to check for uninitialized reads and data races respectively.
Locally I was able to run the library tests under ASAN with:
RUSTFLAGS=-Zsanitizer=address cargo +nightly test -Zbuild-std --target x86_64-apple-darwin --lib
--target needs to be adjusted as appropriate.
Some notes:
- In my testing, using
-Zbuild-stdwas necessary to catch a dummy bug that I inserted (an out-of-bounds read) - The
--libflag is needed to skip doctests, as these failed to compile under ASAN