Make the ExperimentalProtocol option obsolete.
[tinc] / .ci / sanitizers / run.sh
1 #!/bin/bash
2
3 set -euo pipefail
4
5 dir=$(realpath "$(dirname "$0")")
6
7 logs="$GITHUB_WORKSPACE/sanitizer"
8
9 case "$SANITIZER" in
10 undefined)
11   flags='-fsanitize=integer -fsanitize=nullability -fno-sanitize=unsigned-integer-overflow'
12   export UBSAN_OPTIONS="log_path=$logs/ubsan:print_stacktrace=1"
13   ;;
14
15 address)
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"
18   export LSAN_OPTIONS="suppressions=$dir/suppress.txt:print_suppressions=0"
19   ;;
20
21 thread)
22   flags=''
23   export TSAN_OPTIONS="log_path=$logs/tsan"
24   ;;
25
26 *)
27   echo >&2 "unknown sanitizer $SANITIZER"
28   exit 1
29   ;;
30 esac
31
32 export CC='clang-12'
33 export CPPFLAGS='-DDEBUG'
34 export CFLAGS="-O0 -g -fsanitize=$SANITIZER -fno-omit-frame-pointer -fno-common -fsanitize-blacklist=$dir/ignore.txt $flags"
35
36 bash .ci/test/run.sh "$@"
37
38 # Check that the sanitizer has not created any log files.
39 # If it has, fail the job to notify the developer.
40 log_count=$(find "$logs" -type f -printf . | wc -c)
41
42 if [ "$log_count" != 0 ]; then
43   echo "expected zero sanitizer logs, found $log_count"
44   exit 1
45 fi