testme.sh: improve a bit
- add parameter when calling that will be forwarded to make (e.g. to give the correct -j# option for your CPU) - timeout after running the tests for 2 minutes, assuming something went wrong, but don't cancel the rest of the tests - add compilation with clang (if available on the system)
This commit is contained in:
parent
5eb6ebbb23
commit
ac4550ccbd
94
testme.sh
94
testme.sh
@ -1,24 +1,82 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# return values of this script are:
|
||||||
|
# 0 success
|
||||||
|
# 128 a test failed
|
||||||
|
# >0 the number of timed-out tests
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
ret=0
|
||||||
|
TEST_CFLAGS=""
|
||||||
|
|
||||||
|
if [ "$#" == "1" ]
|
||||||
|
then
|
||||||
|
MAKE_OPTIONS=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_die()
|
||||||
|
{
|
||||||
|
echo "error $2 while $1"
|
||||||
|
if [ "$2" != "124" ]
|
||||||
|
then
|
||||||
|
exit 128
|
||||||
|
else
|
||||||
|
echo "assuming timeout while running test - continue"
|
||||||
|
ret=$(( $ret + 1 ))
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_runtest()
|
_runtest()
|
||||||
{
|
{
|
||||||
echo "Run test $1 $2"
|
echo -ne " Compile $1 $2"
|
||||||
make clean > /dev/null
|
make clean > /dev/null
|
||||||
CC="$1" CFLAGS="$2" make test_standalone -j9 > /dev/null 2>test_gcc_errors.txt
|
CC="$1" CFLAGS="$2 $TEST_CFLAGS" make test_standalone $MAKE_OPTIONS > /dev/null 2>test_errors.txt
|
||||||
./test > test_$(echo ${1}${2} | tr ' ' '_').txt
|
echo -e "\rRun test $1 $2"
|
||||||
|
timeout --foreground 120 ./test > test_$(echo ${1}${2} | tr ' ' '_').txt || _die "running tests" $?
|
||||||
}
|
}
|
||||||
|
|
||||||
_runtest "gcc" ""
|
compilers=( clang gcc )
|
||||||
_runtest "gcc" "-DMP_8BIT"
|
|
||||||
_runtest "gcc" "-DMP_16BIT"
|
echo "uname="$(uname -a)
|
||||||
_runtest "gcc" "-DMP_32BIT"
|
|
||||||
_runtest "gcc -m32" ""
|
for i in "${compilers[@]}"
|
||||||
_runtest "gcc -m32" "-DMP_8BIT"
|
do
|
||||||
# mh, this configuration does not work! it gets stuck at
|
if [ -z "$(which $i)" ]
|
||||||
# Testing (not safe-prime): 46 bits
|
then
|
||||||
#_runtest "gcc -m32" "-DMP_16BIT"
|
continue
|
||||||
_runtest "gcc -m32" "-DMP_32BIT"
|
fi
|
||||||
_runtest "gcc -mx32" ""
|
compiler_version=$(echo "$i="$($i -dumpversion))
|
||||||
_runtest "gcc -mx32" "-DMP_8BIT"
|
if [ "$compiler_version" == "clang=4.2.1" ]
|
||||||
_runtest "gcc -mx32" "-DMP_16BIT"
|
then
|
||||||
_runtest "gcc -mx32" "-DMP_32BIT"
|
# one of my versions of clang complains about some stuff in stdio.h and stdarg.h ...
|
||||||
|
TEST_CFLAGS="-Wno-typedef-redefinition"
|
||||||
|
else
|
||||||
|
TEST_CFLAGS=""
|
||||||
|
fi
|
||||||
|
echo $compiler_version
|
||||||
|
_runtest "$i" ""
|
||||||
|
_runtest "$i" "-DMP_8BIT"
|
||||||
|
_runtest "$i" "-DMP_16BIT"
|
||||||
|
_runtest "$i" "-DMP_32BIT"
|
||||||
|
_runtest "$i -m32" ""
|
||||||
|
_runtest "$i -m32" "-DMP_8BIT"
|
||||||
|
_runtest "$i -m32" "-DMP_16BIT"
|
||||||
|
_runtest "$i -m32" "-DMP_32BIT"
|
||||||
|
if [ "$i" != "clang" ]
|
||||||
|
then
|
||||||
|
_runtest "$i -mx32" ""
|
||||||
|
_runtest "$i -mx32" "-DMP_8BIT"
|
||||||
|
_runtest "$i -mx32" "-DMP_16BIT"
|
||||||
|
_runtest "$i -mx32" "-DMP_32BIT"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$ret" == "0" ]
|
||||||
|
then
|
||||||
|
echo "Tests successful"
|
||||||
|
else
|
||||||
|
echo "$ret tests timed out"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user