2020-05-02 18:58:42 +00:00
#!/bin/sh
set -e
set -x
if [ " $HOST " = "i686-linux-gnu" ]
then
export CC = " $CC -m32 "
fi
2020-05-02 19:06:04 +00:00
if [ " $TRAVIS_OS_NAME " = "osx" ] && [ " $TRAVIS_COMPILER " = "gcc" ]
then
export CC = "gcc-9"
fi
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
if [ -n " $BUILD " ]
then
make -j2 " $BUILD "
fi
2020-09-21 07:52:11 +00:00
if [ " $RUN_VALGRIND " = "yes" ]
2020-05-02 18:58:42 +00:00
then
make -j2
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-07-30 08:18:07 +00:00
if [ " $BENCH " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-09-21 07:52:11 +00:00
if [ " $RUN_VALGRIND " = "yes" ]
2020-05-02 18:58:42 +00:00
then
2020-05-02 19:06:04 +00:00
# Using the local `libtool` because on macOS the system's libtool has nothing to do with GNU libtool
EXEC = './libtool --mode=execute valgrind --error-exitcode=42'
2020-05-02 18:58:42 +00:00
else
EXEC =
fi
2020-05-07 13:07:37 +00:00
# This limits the iterations in the benchmarks below to ITER(set in .travis.yml) iterations.
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