5 dir=$(realpath "$(dirname "$0")")
7 logs="$GITHUB_WORKSPACE/sanitizer"
11 flags='-fsanitize=integer -fsanitize=nullability'
12 export UBSAN_OPTIONS="log_path=$logs/ubsan:print_stacktrace=1"
16 flags='-fsanitize-address-use-after-scope -fsanitize=pointer-compare -fsanitize=pointer-subtract'
17 export ASAN_OPTIONS="log_path=$logs/asan:detect_invalid_pointer_pairs=2:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"
22 export TSAN_OPTIONS="log_path=$logs/tsan"
26 echo >&2 "unknown sanitizer $SANITIZER"
32 export CPPFLAGS='-DDEBUG'
33 export CFLAGS="-O0 -g -fsanitize=$SANITIZER -fno-omit-frame-pointer -fno-common -fsanitize-blacklist=$dir/ignore.txt $flags"
35 bash .ci/test/run.sh "$@"
37 # Check that the sanitizer has not created any log files.
38 # If it has, fail the job to notify the developer.
39 log_count=$(find "$logs" -type f -printf . | wc -c)
41 if [ "$log_count" != 0 ]; then
42 echo "expected zero sanitizer logs, found $log_count"