annotate libtommath/testme.sh @ 1880:4c1560627693

add pubkey_info field to authstate structure
author HansH111 <hans@atbas.org>
date Sun, 13 Mar 2022 17:37:44 +0000
parents 1051e4eea25a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #!/bin/bash
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 #
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 # return values of this script are:
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4 # 0 success
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 # 128 a test failed
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 # >0 the number of timed-out tests
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
7 # 255 parsing of parameters failed
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9 set -e
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11 if [ -f /proc/cpuinfo ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 ))
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14 else
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 MAKE_JOBS=8
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 ret=0
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19 TEST_CFLAGS=""
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 _help()
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 {
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 echo "Usage options for $(basename $0) [--with-cc=arg [other options]]"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
25 echo "Executing this script without any parameter will only run the default"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
26 echo "configuration that has automatically been determined for the"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
27 echo "architecture you're running."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 echo
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 echo " --with-cc=* The compiler(s) to use for the tests"
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
30 echo " This is an option that will be iterated."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 echo
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
32 echo " --test-vs-mtest=* Run test vs. mtest for '*' operations."
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
33 echo " Only the first of each options will be"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
34 echo " taken into account."
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
35 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
36 echo "To be able to specify options a compiler has to be given with"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
37 echo "the option --with-cc=compilername"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
38 echo "All other options will be tested with all MP_xBIT configurations."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
40 echo " --with-{m64,m32,mx32} The architecture(s) to build and test"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
41 echo " for, e.g. --with-mx32."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
42 echo " This is an option that will be iterated,"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
43 echo " multiple selections are possible."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
44 echo " The mx32 architecture is not supported"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
45 echo " by clang and will not be executed."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 echo
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 echo " --cflags=* Give an option to the compiler,"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 echo " e.g. --cflags=-g"
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
49 echo " This is an option that will always be"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
50 echo " passed as parameter to CC."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 echo
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 echo " --make-option=* Give an option to make,"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 echo " e.g. --make-option=\"-f makefile.shared\""
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
54 echo " This is an option that will always be"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
55 echo " passed as parameter to make."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 echo
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
57 echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT."
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
58 echo
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
59 echo " --mtest-real-rand Use real random data when running mtest."
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
60 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
61 echo " --with-valgrind"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
62 echo " --with-valgrind=* Run in valgrind (slow!)."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
63 echo
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
64 echo " --with-travis-valgrind Run with valgrind on Travis on specific branches."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
65 echo
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
66 echo " --valgrind-options Additional Valgrind options"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
67 echo " Some of the options like e.g.:"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
68 echo " --track-origins=yes add a lot of extra"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
69 echo " runtime and may trigger the 30 minutes"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
70 echo " timeout."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
71 echo
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 echo "Godmode:"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
74 echo " --all Choose all architectures and gcc and clang"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
75 echo " as compilers but does not run valgrind."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
76 echo
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
77 echo " --format Runs the various source-code formatters"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
78 echo " and generators and checks if the sources"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
79 echo " are clean."
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 echo
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
81 echo " -h"
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
82 echo " --help This message"
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
83 echo
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
84 echo " -v"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
85 echo " --version Prints the version. It is just the number"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
86 echo " of git commits to this file, no deeper"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
87 echo " meaning attached"
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88 exit 0
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89 }
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 _die()
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92 {
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 echo "error $2 while $1"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94 if [ "$2" != "124" ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96 exit 128
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 else
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 echo "assuming timeout while running test - continue"
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
99 local _tail=""
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
100 which tail >/dev/null && _tail="tail -n 1 test_${suffix}.log" && \
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
101 echo "last line of test_"${suffix}".log was:" && $_tail && echo ""
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 ret=$(( $ret + 1 ))
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104 }
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
106 _make()
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 {
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108 echo -ne " Compile $1 $2"
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
109 suffix=$(echo ${1}${2} | tr ' ' '_')
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
110 CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
111 errcnt=$(wc -l < gcc_errors_${suffix}.log)
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
112 if [[ ${errcnt} -gt 1 ]]; then
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
113 echo " failed"
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
114 cat gcc_errors_${suffix}.log
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
115 exit 128
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
116 fi
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
117 }
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
118
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
119
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
120 _runtest()
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
121 {
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
122 make clean > /dev/null
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
123 local _timeout=""
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
124 which timeout >/dev/null && _timeout="timeout --foreground 90"
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
125 if [[ "$MAKE_OPTIONS" =~ "tune" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
126 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
127 # "make tune" will run "tune_it.sh" automatically, hence "autotune", but it cannot
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
128 # get switched off without some effort, so we just let it run twice for testing purposes
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
129 echo -e "\rRun autotune $1 $2"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
130 _make "$1" "$2" ""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
131 $_timeout $TUNE_CMD > test_${suffix}.log || _die "running autotune" $?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
132 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
133 _make "$1" "$2" "test"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
134 echo -e "\rRun test $1 $2"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
135 $_timeout ./test > test_${suffix}.log || _die "running tests" $?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
136 fi
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
137 }
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
138
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
139 # This is not much more of a C&P of _runtest with a different timeout
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
140 # and the additional valgrind call.
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
141 # TODO: merge
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
142 _runvalgrind()
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
143 {
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
144 make clean > /dev/null
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
145 local _timeout=""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
146 # 30 minutes? Yes. Had it at 20 minutes and the Valgrind run needed over 25 minutes.
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
147 # A bit too close for comfort.
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
148 which timeout >/dev/null && _timeout="timeout --foreground 1800"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
149 echo "MAKE_OPTIONS = \"$MAKE_OPTIONS\""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
150 if [[ "$MAKE_OPTIONS" =~ "tune" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
151 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
152 echo "autotune branch"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
153 _make "$1" "$2" ""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
154 # The shell used for /bin/sh is DASH 0.5.7-4ubuntu1 on the author's machine which fails valgrind, so
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
155 # we just run on instance of etc/tune with the same options as in etc/tune_it.sh
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
156 echo -e "\rRun etc/tune $1 $2 once inside valgrind"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
157 $_timeout $VALGRIND_BIN $VALGRIND_OPTS $TUNE_CMD > test_${suffix}.log || _die "running etc/tune" $?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
158 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
159 _make "$1" "$2" "test"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
160 echo -e "\rRun test $1 $2 inside valgrind"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
161 $_timeout $VALGRIND_BIN $VALGRIND_OPTS ./test > test_${suffix}.log || _die "running tests" $?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
162 fi
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
163 }
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
164
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
165
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
166 _banner()
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
167 {
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
168 echo "uname="$(uname -a)
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
169 [[ "$#" != "0" ]] && (echo $1=$($1 -dumpversion)) || true
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
170 }
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
171
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
172 _exit()
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
173 {
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
174 if [ "$ret" == "0" ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
175 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
176 echo "Tests successful"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
177 else
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
178 echo "$ret tests timed out"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
179 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
180
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
181 exit $ret
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
182 }
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
183
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
184 ARCHFLAGS=""
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
185 COMPILERS=""
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
186 CFLAGS=""
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
187 WITH_LOW_MP=""
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
188 TEST_VS_MTEST=""
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
189 MTEST_RAND=""
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
190 # timed with an AMD A8-6600K
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
191 # 25 minutes
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
192 #VALGRIND_OPTS=" --track-origins=yes --leak-check=full --show-leak-kinds=all --error-exitcode=1 "
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
193 # 9 minutes (14 minutes with --test-vs-mtest=333333 --mtest-real-rand)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
194 VALGRIND_OPTS=" --leak-check=full --show-leak-kinds=all --error-exitcode=1 "
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
195 #VALGRIND_OPTS=""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
196 VALGRIND_BIN=""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
197 CHECK_FORMAT=""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
198 TUNE_CMD="./etc/tune -t -r 10 -L 3"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
199
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
200 alive_pid=0
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
201
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
202 function kill_alive() {
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
203 disown $alive_pid || true
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
204 kill $alive_pid 2>/dev/null
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
205 }
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
206
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
207 function start_alive_printing() {
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
208 [ "$alive_pid" == "0" ] || return 0;
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
209 for i in `seq 1 10` ; do sleep 300 && echo "Tests still in Progress..."; done &
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
210 alive_pid=$!
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
211 trap kill_alive EXIT
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
212 }
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
213
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
214 while [ $# -gt 0 ];
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
215 do
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
216 case $1 in
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
217 "--with-m64" | "--with-m32" | "--with-mx32")
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
218 ARCHFLAGS="$ARCHFLAGS ${1:6}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
219 ;;
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
220 --with-cc=*)
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
221 COMPILERS="$COMPILERS ${1#*=}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
222 ;;
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
223 --cflags=*)
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
224 CFLAGS="$CFLAGS ${1#*=}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
225 ;;
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
226 --valgrind-options=*)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
227 VALGRIND_OPTS="$VALGRIND_OPTS ${1#*=}"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
228 ;;
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
229 --with-valgrind*)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
230 if [[ ${1#*d} != "" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
231 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
232 VALGRIND_BIN="${1#*=}"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
233 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
234 VALGRIND_BIN="valgrind"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
235 fi
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
236 start_alive_printing
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
237 ;;
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
238 --with-travis-valgrind*)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
239 if [[ ("$TRAVIS_BRANCH" == "develop" && "$TRAVIS_PULL_REQUEST" == "false") || "$TRAVIS_BRANCH" == *"valgrind"* || "$TRAVIS_COMMIT_MESSAGE" == *"valgrind"* ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
240 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
241 if [[ ${1#*d} != "" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
242 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
243 VALGRIND_BIN="${1#*=}"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
244 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
245 VALGRIND_BIN="valgrind"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
246 fi
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
247 start_alive_printing
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
248 fi
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
249 ;;
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
250 --make-option=*)
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
251 MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
252 ;;
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
253 --with-low-mp)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
254 WITH_LOW_MP="1"
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
255 ;;
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
256 --test-vs-mtest=*)
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
257 TEST_VS_MTEST="${1#*=}"
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
258 if ! [ "$TEST_VS_MTEST" -eq "$TEST_VS_MTEST" ] 2> /dev/null
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
259 then
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
260 echo "--test-vs-mtest Parameter has to be int"
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
261 exit 255
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
262 fi
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
263 start_alive_printing
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
264 ;;
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
265 --mtest-real-rand)
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
266 MTEST_RAND="-DLTM_MTEST_REAL_RAND"
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
267 ;;
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
268 --format)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
269 CHECK_FORMAT="1"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
270 ;;
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
271 --all)
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
272 COMPILERS="gcc clang"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
273 ARCHFLAGS="-m64 -m32 -mx32"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
274 ;;
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
275 --help | -h)
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
276 _help
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
277 ;;
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
278 --version | -v)
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
279 echo $(git rev-list HEAD --count -- testme.sh) || echo "Unknown. Please run in original libtommath git repository."
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
280 exit 0
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
281 ;;
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
282 *)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
283 echo "Ignoring option ${1}"
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
284 ;;
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
285 esac
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
286 shift
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
287 done
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
288
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
289 function _check_git() {
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
290 git update-index --refresh >/dev/null || true
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
291 git diff-index --quiet HEAD -- . || ( echo "FAILURE: $*" && exit 1 )
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
292 }
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
293
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
294 if [[ "$CHECK_FORMAT" == "1" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
295 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
296 make astyle
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
297 _check_git "make astyle"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
298 perl helper.pl --update-files
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
299 _check_git "helper.pl --update-files"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
300 perl helper.pl --check-all
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
301 _check_git "helper.pl --check-all"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
302 exit $?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
303 fi
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
304
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
305 [[ "$VALGRIND_BIN" == "" ]] && VALGRIND_OPTS=""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
306
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
307 # default to CC environment variable if no compiler is defined but some other options
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
308 if [[ "$COMPILERS" == "" ]] && [[ "$ARCHFLAGS$MAKE_OPTIONS$CFLAGS" != "" ]]
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
309 then
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
310 COMPILERS="$CC"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
311 # default to CC environment variable and run only default config if no option is given
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
312 elif [[ "$COMPILERS" == "" ]]
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
313 then
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
314 _banner "$CC"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
315 if [[ "$VALGRIND_BIN" != "" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
316 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
317 _runvalgrind "$CC" ""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
318 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
319 _runtest "$CC" ""
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
320 fi
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
321 _exit
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
322 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
323
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
324
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
325 archflags=( $ARCHFLAGS )
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
326 compilers=( $COMPILERS )
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
327
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
328 # choosing a compiler without specifying an architecture will use the default architecture
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
329 if [ "${#archflags[@]}" == "0" ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
330 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
331 archflags[0]=" "
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
332 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
333
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
334 _banner
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
335
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
336 if [[ "$TEST_VS_MTEST" != "" ]]
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
337 then
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
338 make clean > /dev/null
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
339 _make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "mtest_opponent"
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
340 echo
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
341 _make "gcc" "$MTEST_RAND" "mtest"
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
342 echo
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
343 echo "Run test vs. mtest for $TEST_VS_MTEST iterations"
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
344 _timeout=""
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
345 which timeout >/dev/null && _timeout="timeout --foreground 1800"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
346 $_timeout ./mtest/mtest $TEST_VS_MTEST | $VALGRIND_BIN $VALGRIND_OPTS ./mtest_opponent > valgrind_test.log 2> test_vs_mtest_err.log
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
347 retval=$?
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
348 head -n 5 valgrind_test.log
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
349 tail -n 2 valgrind_test.log
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
350 exit $retval
1655
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
351 fi
f52919ffd3b1 update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents: 1470
diff changeset
352
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
353 for i in "${compilers[@]}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
354 do
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
355 if [ -z "$(which $i)" ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
356 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
357 echo "Skipped compiler $i, file not found"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
358 continue
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
359 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
360 compiler_version=$(echo "$i="$($i -dumpversion))
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
361 if [ "$compiler_version" == "clang=4.2.1" ]
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
362 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
363 # one of my versions of clang complains about some stuff in stdio.h and stdarg.h ...
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
364 TEST_CFLAGS="-Wno-typedef-redefinition"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
365 else
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
366 TEST_CFLAGS=""
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
367 fi
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
368 echo $compiler_version
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
369
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
370 for a in "${archflags[@]}"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
371 do
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents: 1436
diff changeset
372 if [[ $(expr "$i" : "clang") -ne 0 && "$a" == "-mx32" ]]
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
373 then
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
374 echo "clang -mx32 tests skipped"
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
375 continue
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
376 fi
1692
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
377 if [[ "$VALGRIND_BIN" != "" ]]
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
378 then
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
379 _runvalgrind "$i $a" "$CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
380 [ "$WITH_LOW_MP" != "1" ] && continue
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
381 _runvalgrind "$i $a" "-DMP_8BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
382 _runvalgrind "$i $a" "-DMP_16BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
383 _runvalgrind "$i $a" "-DMP_32BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
384 else
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
385 _runtest "$i $a" "$CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
386 [ "$WITH_LOW_MP" != "1" ] && continue
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
387 _runtest "$i $a" "-DMP_8BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
388 _runtest "$i $a" "-DMP_16BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
389 _runtest "$i $a" "-DMP_32BIT $CFLAGS"
1051e4eea25a Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents: 1655
diff changeset
390 fi
1436
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
391 done
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
392 done
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
393
60fc6476e044 Update to libtommath v1.0
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
394 _exit