summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@amazon.com>2022-07-02 22:41:15 -0400
committerJean-Marc Valin <jmvalin@amazon.com>2022-07-05 17:25:17 -0400
commit7b6cede819a673cc21e896283668b2d3ddd9e623 (patch)
tree4142d8acda2b7e1da0cc2ed026450c7dab788300
parent3acaa70965c5570ef1711fee9b3a15eac3e74ffe (diff)
downloadopus-7b6cede819a673cc21e896283668b2d3ddd9e623.tar.gz
Add asan/ubsan support in random tests
-rwxr-xr-xtests/random_config.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/random_config.sh b/tests/random_config.sh
index e5d72833..aea0c389 100755
--- a/tests/random_config.sh
+++ b/tests/random_config.sh
@@ -40,8 +40,10 @@ arch=`echo -e "\n-march=core2\n-march=sandybridge\n-march=broadwell\n-march=skyl
footprint=`echo -e "\n-DSMALL_FOOTPRINT" | shuf -n1`
std=`echo -e "\n-std=c90\n-std=c99\n-std=c11\n-std=c17" | shuf -n1`
+sanitize=`echo -e "\n-fsanitize=address -fno-sanitize-recover=all\n-fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow" | shuf -n1`
-CFLAGS="$CFLAGS $std $opt $arch $footprint $math"
+
+CFLAGS="$CFLAGS $std $opt $arch $footprint $math $sanitize"
echo CFLAGS=$CFLAGS > $config
@@ -90,11 +92,12 @@ then
exit 1
fi
-#Run valgrind 10% of the time
-if [ `seq 30 | shuf -n1` -ne 1 ]
+#Run valgrind 5% of the time (minus the asan cases)
+if [ `seq 20 | shuf -n1` -ne 1 -o "$sanitize" = "-fsanitize=address -fno-sanitize-recover=all" ]
then
make check > makecheck_output.txt 2>&1
else
+ echo valgrind enabled >> $config
valgrind --trace-children=yes --error-exitcode=128 make check > makecheck_output.txt 2>&1
fi