improve testme.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/.gitignore b/.gitignore
index 65f78cd..4fa170a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,6 +47,7 @@ mtest.exe
tommath.tex
# ignore files generated by testme.sh
+gcc_errors_*.txt
test_*.txt
*.bak
diff --git a/testme.sh b/testme.sh
index 67d55d0..ff54078 100755
--- a/testme.sh
+++ b/testme.sh
@@ -67,9 +67,16 @@ _runtest()
{
echo -ne " Compile $1 $2"
make clean > /dev/null
- CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>test_errors.txt
+ suffix=$(echo ${1}${2} | tr ' ' '_')
+ CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.txt
+ errcnt=$(wc -l < gcc_errors_${suffix}.txt)
+ if [[ ${errcnt} -gt 1 ]]; then
+ echo " failed"
+ cat gcc_errors_${suffix}.txt
+ exit 128
+ fi
echo -e "\rRun test $1 $2"
- timeout --foreground 90 ./test > test_$(echo ${1}${2} | tr ' ' '_').txt || _die "running tests" $?
+ timeout --foreground 90 ./test > test_${suffix}.txt || _die "running tests" $?
}
_banner()
@@ -120,8 +127,12 @@ do
shift
done
-# default to gcc if nothing is given
-if [[ "$COMPILERS" == "" ]]
+# default to gcc if no compiler is defined but some other options
+if [[ "$COMPILERS" == "" ]] && [[ "$ARCHFLAGS$MAKE_OPTIONS$CFLAGS" != "" ]]
+then
+ COMPILERS="gcc"
+# default to gcc and run only default config if no option is given
+elif [[ "$COMPILERS" == "" ]]
then
_banner gcc
_runtest "gcc" ""
@@ -164,10 +175,10 @@ do
continue
fi
- _runtest "$i $a" ""
- _runtest "$i $a" "-DMP_8BIT"
- _runtest "$i $a" "-DMP_16BIT"
- _runtest "$i $a" "-DMP_32BIT"
+ _runtest "$i $a" "$CFLAGS"
+ _runtest "$i $a" "-DMP_8BIT $CFLAGS"
+ _runtest "$i $a" "-DMP_16BIT $CFLAGS"
+ _runtest "$i $a" "-DMP_32BIT $CFLAGS"
done
done