Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2022-04-01 05:13:52 +0300
committerJean-Marc Valin <jmvalin@jmvalin.ca>2022-04-01 06:40:20 +0300
commitf3377959820511fa012edc57a697b9dca427ef87 (patch)
tree0eb29bf0306ae456dfcaf25a69036934b4500b7e
parentc6f98577716d39907264d5388b74b5be5dea3d6c (diff)
build test scripts
-rwxr-xr-xtests/opus_build_test.sh30
-rwxr-xr-xtests/random_config.sh117
2 files changed, 147 insertions, 0 deletions
diff --git a/tests/opus_build_test.sh b/tests/opus_build_test.sh
new file mode 100755
index 00000000..6de50481
--- /dev/null
+++ b/tests/opus_build_test.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+tarball=`realpath $1`
+nb_tests=$2
+oldvectors=`realpath $3`
+newvectors=`realpath $4`
+base=`basename $tarball .tar.gz`
+
+tar xvf $tarball > /dev/null 2>&1
+cd $base
+
+if [ $? -ne 0 ]
+then
+ echo cannot go to $base
+ exit 1
+fi
+
+mkdir build_tests
+
+configure_dir=`pwd`
+seq -w $nb_tests | parallel -j +2 "../random_config.sh build_tests/run_{} $configure_dir $oldvectors $newvectors"
+
+if [ $? -ne 0 ]
+then
+ echo Check found errors
+ exit 1
+else
+ echo No error found
+fi
+
diff --git a/tests/random_config.sh b/tests/random_config.sh
new file mode 100755
index 00000000..41a2f276
--- /dev/null
+++ b/tests/random_config.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+dir=$1
+mkdir $dir
+if [ $? -ne 0 ]
+then
+ exit 1
+fi
+
+cd $dir
+if [ $? -ne 0 ]
+then
+ exit 1
+fi
+
+
+configure_path=$2
+config="random_config.txt"
+
+case `seq 3 | shuf -n1` in
+1)
+approx=--enable-float-approx
+math=-ffast-math
+;;
+2)
+approx=--enable-float-approx
+;;
+*)
+approx=
+math=
+;;
+esac
+
+CFLAGS='-g'
+
+opt=`echo -e "-O1\n-O2\n-O3" | shuf -n1`
+
+#arch=-march=`echo -e "core2\nsandybridge\nbroadwell\nskylake" | shuf -n1`
+arch=`echo -e "\n-march=core2\n-march=sandybridge\n-march=broadwell\n-march=skylake\n-march=native" | shuf -n1`
+
+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`
+
+CFLAGS="$CFLAGS $std $opt $arch $footprint $math"
+
+echo CFLAGS=$CFLAGS > $config
+
+lib=`echo -e "\n--disable-static\n--disable-shared" | shuf -n1`
+
+arithmetic=`echo -e "\n--enable-fixed-point\n--enable-fixed-point --enable-fixed-point-debug\n--enable-fixed-point --disable-float-api\n--enable-fixed-point --enable-fixed-point-debug --disable-float-api" | shuf -n1`
+
+custom=`echo -e "\n--enable-custom-modes" | shuf -n1`
+
+#asm=`echo -e "\n--disable-asm\n--disable-rtcd\n--disable-intrinsics" | shuf -n1`
+asm=`echo -e "\n--disable-asm\n--disable-intrinsics" | shuf -n1`
+
+assert=`echo -e "\n--enable-assertions" | shuf -n1`
+harden=`echo -e "\n--enable-hardening" | shuf -n1`
+fuzz=`echo -e "\n--enable-fuzzing" | shuf -n1`
+checkasm=`echo -e "\n--enable-check-asm" | shuf -n1`
+rfc8251=`echo -e "\n--disable-rfc8251" | shuf -n1`
+
+if [ "$rfc8251" = --disable-rfc8251 ]
+then
+ vectors=$3
+else
+ vectors=$4
+fi
+echo using testvectors at $vectors >> $config
+
+
+config_opt="$lib $arithmetic $custom $asm $assert $harden $fuzz $checkasm $rfc8251 $approx"
+
+echo configure $config_opt >> $config
+
+export CFLAGS
+$configure_path/configure $config_opt > configure_output.txt 2>&1
+
+if [ $? -ne 0 ]
+then
+ echo configure error >> $config
+ exit 1
+fi
+
+make > make_output.txt 2>&1
+
+if [ $? -ne 0 ]
+then
+ echo make error >> $config
+ exit 1
+fi
+
+#Run valgrind 10% of the time
+if [ `seq 30 | shuf -n1` -ne 1 ]
+then
+ make check > makecheck_output.txt 2>&1
+else
+ valgrind --trace-children=yes --error-exitcode=128 make check > makecheck_output.txt 2>&1
+fi
+
+if [ $? -ne 0 ]
+then
+ echo check error >> $config
+ exit 1
+fi
+
+
+rate=`echo -e "8000\n12000\n16000\n24000\n48000" | shuf -n1`
+../../../run_vectors.sh . $vectors $rate > testvectors_output.txt 2>&1
+
+if [ $? -ne 0 ]
+then
+ echo testvectors error >> $config
+ exit 1
+fi
+
+echo all pass >> $config