Mercurial > dropbear
diff libtommath/testme.sh @ 1655:f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
* make key-generation compliant to FIPS 186.4
* fix includes in tommath_class.h
* update fuzzcorpus instead of error-out
* fixup fuzzing make-targets
* update Makefile.in
* apply necessary patches to ltm sources
* clean-up not required ltm files
* update to vanilla ltm 1.1.0
this already only contains the required files
* remove set/get double
author | Steffen Jaeckel <s_jaeckel@gmx.de> |
---|---|
date | Mon, 16 Sep 2019 15:50:38 +0200 |
parents | 8bba51a55704 |
children | 1051e4eea25a |
line wrap: on
line diff
--- a/libtommath/testme.sh Wed May 15 21:59:45 2019 +0800 +++ b/libtommath/testme.sh Mon Sep 16 15:50:38 2019 +0200 @@ -27,6 +27,9 @@ 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 @@ -45,6 +48,8 @@ echo echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT." echo + echo " --mtest-real-rand Use real random data when running mtest." + echo echo "Godmode:" echo echo " --all Choose all architectures and gcc and clang as compilers" @@ -61,26 +66,35 @@ exit 128 else echo "assuming timeout while running test - continue" + local _tail="" + which tail >/dev/null && _tail="tail -n 1 test_${suffix}.log" && \ + echo "last line of test_"${suffix}".log was:" && $_tail && echo "" ret=$(( $ret + 1 )) 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 +119,8 @@ COMPILERS="" CFLAGS="" WITH_LOW_MP="" +TEST_VS_MTEST="" +MTEST_RAND="" while [ $# -gt 0 ]; do @@ -124,6 +140,17 @@ --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 + ;; + --mtest-real-rand) + MTEST_RAND="-DLTM_MTEST_REAL_RAND" + ;; --all) COMPILERS="gcc clang" ARCHFLAGS="-m64 -m32 -mx32" @@ -161,6 +188,26 @@ _banner +if [[ "$TEST_VS_MTEST" != "" ]] +then + make clean > /dev/null + _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test" + echo + _make "gcc" "$MTEST_RAND" "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)" ]