Mercurial > dropbear
comparison 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 |
comparison
equal
deleted
inserted
replaced
1654:cc0fc5131c5c | 1655:f52919ffd3b1 |
---|---|
25 echo "that has automatically been determined for the architecture you're running." | 25 echo "that has automatically been determined for the architecture you're running." |
26 echo | 26 echo |
27 echo " --with-cc=* The compiler(s) to use for the tests" | 27 echo " --with-cc=* The compiler(s) to use for the tests" |
28 echo " This is an option that will be iterated." | 28 echo " This is an option that will be iterated." |
29 echo | 29 echo |
30 echo " --test-vs-mtest=* Run test vs. mtest for '*' operations." | |
31 echo " Only the first of each options will be taken into account." | |
32 echo | |
30 echo "To be able to specify options a compiler has to be given." | 33 echo "To be able to specify options a compiler has to be given." |
31 echo "All options will be tested with all MP_xBIT configurations." | 34 echo "All options will be tested with all MP_xBIT configurations." |
32 echo | 35 echo |
33 echo " --with-{m64,m32,mx32} The architecture(s) to build and test for," | 36 echo " --with-{m64,m32,mx32} The architecture(s) to build and test for," |
34 echo " e.g. --with-mx32." | 37 echo " e.g. --with-mx32." |
43 echo " e.g. --make-option=\"-f makefile.shared\"" | 46 echo " e.g. --make-option=\"-f makefile.shared\"" |
44 echo " This is an option that will always be passed as parameter to make." | 47 echo " This is an option that will always be passed as parameter to make." |
45 echo | 48 echo |
46 echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT." | 49 echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT." |
47 echo | 50 echo |
51 echo " --mtest-real-rand Use real random data when running mtest." | |
52 echo | |
48 echo "Godmode:" | 53 echo "Godmode:" |
49 echo | 54 echo |
50 echo " --all Choose all architectures and gcc and clang as compilers" | 55 echo " --all Choose all architectures and gcc and clang as compilers" |
51 echo | 56 echo |
52 echo " --help This message" | 57 echo " --help This message" |
59 if [ "$2" != "124" ] | 64 if [ "$2" != "124" ] |
60 then | 65 then |
61 exit 128 | 66 exit 128 |
62 else | 67 else |
63 echo "assuming timeout while running test - continue" | 68 echo "assuming timeout while running test - continue" |
69 local _tail="" | |
70 which tail >/dev/null && _tail="tail -n 1 test_${suffix}.log" && \ | |
71 echo "last line of test_"${suffix}".log was:" && $_tail && echo "" | |
64 ret=$(( $ret + 1 )) | 72 ret=$(( $ret + 1 )) |
65 fi | 73 fi |
66 } | 74 } |
67 | 75 |
68 _runtest() | 76 _make() |
69 { | 77 { |
70 echo -ne " Compile $1 $2" | 78 echo -ne " Compile $1 $2" |
71 make clean > /dev/null | |
72 suffix=$(echo ${1}${2} | tr ' ' '_') | 79 suffix=$(echo ${1}${2} | tr ' ' '_') |
73 CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.txt | 80 CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log |
74 errcnt=$(wc -l < gcc_errors_${suffix}.txt) | 81 errcnt=$(wc -l < gcc_errors_${suffix}.log) |
75 if [[ ${errcnt} -gt 1 ]]; then | 82 if [[ ${errcnt} -gt 1 ]]; then |
76 echo " failed" | 83 echo " failed" |
77 cat gcc_errors_${suffix}.txt | 84 cat gcc_errors_${suffix}.log |
78 exit 128 | 85 exit 128 |
79 fi | 86 fi |
80 echo -e "\rRun test $1 $2" | 87 } |
88 | |
89 | |
90 _runtest() | |
91 { | |
92 make clean > /dev/null | |
93 _make "$1" "$2" "test_standalone" | |
81 local _timeout="" | 94 local _timeout="" |
82 which timeout >/dev/null && _timeout="timeout --foreground 90" | 95 which timeout >/dev/null && _timeout="timeout --foreground 90" |
83 $_timeout ./test > test_${suffix}.txt || _die "running tests" $? | 96 echo -e "\rRun test $1 $2" |
97 $_timeout ./test > test_${suffix}.log || _die "running tests" $? | |
84 } | 98 } |
85 | 99 |
86 _banner() | 100 _banner() |
87 { | 101 { |
88 echo "uname="$(uname -a) | 102 echo "uname="$(uname -a) |
103 | 117 |
104 ARCHFLAGS="" | 118 ARCHFLAGS="" |
105 COMPILERS="" | 119 COMPILERS="" |
106 CFLAGS="" | 120 CFLAGS="" |
107 WITH_LOW_MP="" | 121 WITH_LOW_MP="" |
122 TEST_VS_MTEST="" | |
123 MTEST_RAND="" | |
108 | 124 |
109 while [ $# -gt 0 ]; | 125 while [ $# -gt 0 ]; |
110 do | 126 do |
111 case $1 in | 127 case $1 in |
112 "--with-m64" | "--with-m32" | "--with-mx32") | 128 "--with-m64" | "--with-m32" | "--with-mx32") |
122 MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}" | 138 MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}" |
123 ;; | 139 ;; |
124 --with-low-mp) | 140 --with-low-mp) |
125 WITH_LOW_MP="1" | 141 WITH_LOW_MP="1" |
126 ;; | 142 ;; |
143 --test-vs-mtest=*) | |
144 TEST_VS_MTEST="${1#*=}" | |
145 if ! [ "$TEST_VS_MTEST" -eq "$TEST_VS_MTEST" ] 2> /dev/null | |
146 then | |
147 echo "--test-vs-mtest Parameter has to be int" | |
148 exit -1 | |
149 fi | |
150 ;; | |
151 --mtest-real-rand) | |
152 MTEST_RAND="-DLTM_MTEST_REAL_RAND" | |
153 ;; | |
127 --all) | 154 --all) |
128 COMPILERS="gcc clang" | 155 COMPILERS="gcc clang" |
129 ARCHFLAGS="-m64 -m32 -mx32" | 156 ARCHFLAGS="-m64 -m32 -mx32" |
130 ;; | 157 ;; |
131 --help | -h) | 158 --help | -h) |
158 then | 185 then |
159 archflags[0]=" " | 186 archflags[0]=" " |
160 fi | 187 fi |
161 | 188 |
162 _banner | 189 _banner |
190 | |
191 if [[ "$TEST_VS_MTEST" != "" ]] | |
192 then | |
193 make clean > /dev/null | |
194 _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test" | |
195 echo | |
196 _make "gcc" "$MTEST_RAND" "mtest" | |
197 echo | |
198 echo "Run test vs. mtest for $TEST_VS_MTEST iterations" | |
199 for i in `seq 1 10` ; do sleep 500 && echo alive; done & | |
200 alive_pid=$! | |
201 _timeout="" | |
202 which timeout >/dev/null && _timeout="timeout --foreground 900" | |
203 $_TIMEOUT ./mtest/mtest $TEST_VS_MTEST | ./test > test.log | |
204 disown $alive_pid | |
205 kill $alive_pid 2>/dev/null | |
206 head -n 5 test.log | |
207 tail -n 2 test.log | |
208 exit 0 | |
209 fi | |
163 | 210 |
164 for i in "${compilers[@]}" | 211 for i in "${compilers[@]}" |
165 do | 212 do |
166 if [ -z "$(which $i)" ] | 213 if [ -z "$(which $i)" ] |
167 then | 214 then |