2020-05-02 18:58:42 +00:00
#!/bin/sh
set -e
set -x
2020-12-22 15:42:08 +00:00
export LC_ALL = C
env >> test_env.log
$CC -v || true
valgrind --version || true
./autogen.sh
2020-05-02 18:58:42 +00:00
./configure \
2020-09-26 03:06:36 +00:00
--enable-experimental= " $EXPERIMENTAL " \
2020-08-09 17:58:40 +00:00
--with-test-override-wide-multiply= " $WIDEMUL " --with-bignum= " $BIGNUM " --with-asm= " $ASM " \
2020-05-02 18:58:42 +00:00
--enable-ecmult-static-precomputation= " $STATICPRECOMPUTATION " --with-ecmult-gen-precision= " $ECMULTGENPRECISION " \
2020-07-29 06:50:42 +00:00
--enable-module-ecdh= " $ECDH " --enable-module-recovery= " $RECOVERY " \
2020-05-12 16:17:59 +00:00
--enable-module-schnorrsig= " $SCHNORRSIG " \
2020-09-21 07:47:40 +00:00
--with-valgrind= " $WITH_VALGRIND " \
2020-07-29 06:50:42 +00:00
--host= " $HOST " $EXTRAFLAGS
2020-05-02 18:58:42 +00:00
2021-02-26 16:36:34 +00:00
make -j2
# Print information about binaries so that we can see that the architecture is correct
file *tests || true
file bench_* || true
file .libs/* || true
2020-05-02 18:58:42 +00:00
if [ -n " $BUILD " ]
then
make -j2 " $BUILD "
fi
2020-12-22 15:42:08 +00:00
2020-09-21 07:52:11 +00:00
if [ " $RUN_VALGRIND " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-12-17 06:33:49 +00:00
# the `--error-exitcode` is required to make the test fail if valgrind found errors, otherwise it'll return 0 (https://www.valgrind.org/docs/manual/manual-core.html)
2020-05-02 18:58:42 +00:00
valgrind --error-exitcode= 42 ./tests 16
valgrind --error-exitcode= 42 ./exhaustive_tests
fi
2020-12-22 15:42:08 +00:00
if [ -n " $QEMU_CMD " ]
then
$QEMU_CMD ./tests 16
$QEMU_CMD ./exhaustive_tests
fi
2020-07-30 08:18:07 +00:00
if [ " $BENCH " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-12-22 15:42:08 +00:00
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
EXEC = './libtool --mode=execute'
if [ -n " $QEMU_CMD " ]
then
EXEC = " $EXEC $QEMU_CMD "
fi
2020-09-21 07:52:11 +00:00
if [ " $RUN_VALGRIND " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-12-22 15:42:08 +00:00
EXEC = " $EXEC valgrind --error-exitcode=42 "
2020-05-02 18:58:42 +00:00
fi
2020-12-22 15:42:08 +00:00
# This limits the iterations in the benchmarks below to ITER iterations.
2020-05-07 13:07:37 +00:00
export SECP256K1_BENCH_ITERS = " $ITERS "
2020-05-02 18:58:42 +00:00
{
$EXEC ./bench_ecmult
$EXEC ./bench_internal
$EXEC ./bench_sign
$EXEC ./bench_verify
} >> bench.log 2>& 1
if [ " $RECOVERY " = "yes" ]
then
$EXEC ./bench_recover >> bench.log 2>& 1
fi
if [ " $ECDH " = "yes" ]
then
$EXEC ./bench_ecdh >> bench.log 2>& 1
fi
2020-09-11 22:04:04 +00:00
if [ " $SCHNORRSIG " = "yes" ]
then
$EXEC ./bench_schnorrsig >> bench.log 2>& 1
fi
2020-05-02 18:58:42 +00:00
fi
2020-07-30 08:18:07 +00:00
if [ " $CTIMETEST " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-05-02 19:06:04 +00:00
./libtool --mode= execute valgrind --error-exitcode= 42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>& 1
2020-05-02 18:58:42 +00:00
fi