fix(build): enable sanitizer configuration
Description
Introduce sanitizer support. Using the CMake option SIGHT_SANITIZE="sanitizer(s)"
like in:
cmake .... -DSIGHT_SANITIZE="thread" ....
The string is passed to the compiler with the option -fsanitize=xxx
. Launching the result binaries will execute instrumented code that will check things like concurrent access, memory leak, address uses, etc. One an error is found, the code is stopped with an exception and a meaningful message is printed on the console.
To demonstrate, some fixes on coreTest
are included in the branch, just skip the last commit, and normally -DSIGHT_SANITIZE="thread"
should report some errors (in Job tests).
This MR contains fixes for coreTest
, mostly for Jobs and for encrypted log. Almost all reported problems were in the testing code, but some were real bugs, so I included the fix.
Closes #1129 (closed)
How to test it?
- Go a commit back (before the various fixes), and rebuild every thing with
cmake .... -DSIGHT_SANITIZE="thread"
orcmake .... -DSIGHT_SANITIZE="address"
- Launch
coreTest
-> some errors should be reported - Go to the last commit -> build (still with SIGHT_SANITIZE) -> no errors
Data
take a look at https://learn.microsoft.com/fr-fr/cpp/build/reference/fsanitize?view=msvc-170 or https://clang.llvm.org/docs/AddressSanitizer.html or https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html).