diff --git a/.travis.yml b/.travis.yml index c760245..fcc6dc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,33 @@ language: c -compiler: - - gcc -script: - - make travis_mtest - - head -n 5 test.log - - tail -n 2 test.log - - ./testme.sh --with-cc=gcc --with-low-mp +install: + - sudo apt-get update -qq + - sudo apt-get install gcc-multilib +matrix: + fast_finish: true branches: only: - master - develop - /^release\/.*$/ +compiler: + - gcc + - clang +script: + - ./testme.sh --with-cc=$CC ${BUILDOPTIONS} +env: + - | + BUILDOPTIONS="--test-vs-mtest=666666" + - | + BUILDOPTIONS="--with-low-mp" + - | + BUILDOPTIONS="--with-m64 --with-m32 --with-mx32" + +after_failure: + - cat test_*.log + - cat gcc_errors_*.log + notifications: irc: "chat.freenode.net#libtom-notifications" diff --git a/makefile b/makefile index 64d8fcd..6642994 100644 --- a/makefile +++ b/makefile @@ -102,10 +102,6 @@ test_standalone: $(LIBNAME) demo/demo.o mtest: cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest -travis_mtest: test mtest - @ for i in `seq 1 10` ; do sleep 500 && echo alive; done & - ./mtest/mtest 666666 | ./test > test.log - timing: $(LIBNAME) $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest diff --git a/testme.sh b/testme.sh index ee2e87c..acb8891 100755 --- a/testme.sh +++ b/testme.sh @@ -27,6 +27,9 @@ _help() echo " --with-cc=* The compiler(s) to use for the tests" echo " This is an option that will be iterated." echo + echo " --test-vs-mtest=* Run test vs. mtest for '*' operations." + echo " Only the first of each options will be taken into account." + echo echo "To be able to specify options a compiler has to be given." echo "All options will be tested with all MP_xBIT configurations." echo @@ -65,22 +68,28 @@ _die() fi } -_runtest() +_make() { echo -ne " Compile $1 $2" - make clean > /dev/null 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) + CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log + errcnt=$(wc -l < gcc_errors_${suffix}.log) if [[ ${errcnt} -gt 1 ]]; then echo " failed" - cat gcc_errors_${suffix}.txt + cat gcc_errors_${suffix}.log exit 128 fi - echo -e "\rRun test $1 $2" +} + + +_runtest() +{ + make clean > /dev/null + _make "$1" "$2" "test_standalone" local _timeout="" which timeout >/dev/null && _timeout="timeout --foreground 90" - $_timeout ./test > test_${suffix}.txt || _die "running tests" $? + echo -e "\rRun test $1 $2" + $_timeout ./test > test_${suffix}.log || _die "running tests" $? } _banner() @@ -105,6 +114,7 @@ ARCHFLAGS="" COMPILERS="" CFLAGS="" WITH_LOW_MP="" +TEST_VS_MTEST="" while [ $# -gt 0 ]; do @@ -124,6 +134,14 @@ do --with-low-mp) WITH_LOW_MP="1" ;; + --test-vs-mtest=*) + TEST_VS_MTEST="${1#*=}" + if ! [ "$TEST_VS_MTEST" -eq "$TEST_VS_MTEST" ] 2> /dev/null + then + echo "--test-vs-mtest Parameter has to be int" + exit -1 + fi + ;; --all) COMPILERS="gcc clang" ARCHFLAGS="-m64 -m32 -mx32" @@ -161,6 +179,26 @@ fi _banner +if [[ "$TEST_VS_MTEST" != "" ]] +then + make clean > /dev/null + _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test" + echo + _make "gcc" "" "mtest" + echo + echo "Run test vs. mtest for $TEST_VS_MTEST iterations" + for i in `seq 1 10` ; do sleep 500 && echo alive; done & + alive_pid=$! + _timeout="" + which timeout >/dev/null && _timeout="timeout --foreground 900" + $_TIMEOUT ./mtest/mtest $TEST_VS_MTEST | ./test > test.log + disown $alive_pid + kill $alive_pid 2>/dev/null + head -n 5 test.log + tail -n 2 test.log + exit 0 +fi + for i in "${compilers[@]}" do if [ -z "$(which $i)" ]