shithub: opus

Download patch

ref: 7b6cede819a673cc21e896283668b2d3ddd9e623
parent: 3acaa70965c5570ef1711fee9b3a15eac3e74ffe
author: Jean-Marc Valin <[email protected]>
date: Sat Jul 2 18:41:15 EDT 2022

Add asan/ubsan support in random tests

--- a/tests/random_config.sh
+++ b/tests/random_config.sh
@@ -40,9 +40,11 @@
 
 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
 
 lib=`echo -e "\n--disable-static\n--disable-shared" | shuf -n1`
@@ -90,11 +92,12 @@
 	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