2020-08-26 17:35:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2021-06-14 14:55:38 +00:00
|
|
|
export LC_ALL=C
|
|
|
|
|
2022-12-20 21:11:14 +00:00
|
|
|
# Print relevant CI environment to allow reproducing the job outside of CI.
|
|
|
|
print_environment() {
|
|
|
|
# Turn off -x because it messes up the output
|
|
|
|
set +x
|
|
|
|
# There are many ways to print variable names and their content. This one
|
|
|
|
# does not rely on bash.
|
|
|
|
for i in WERROR_CFLAGS MAKEFLAGS BUILD \
|
|
|
|
ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
|
|
|
|
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \
|
|
|
|
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETEST\
|
|
|
|
EXAMPLES \
|
|
|
|
WRAPPER_CMD CC AR NM HOST
|
|
|
|
do
|
|
|
|
eval 'printf "%s %s " "$i=\"${'"$i"'}\""'
|
|
|
|
done
|
|
|
|
echo "$0"
|
|
|
|
set -x
|
|
|
|
}
|
|
|
|
print_environment
|
|
|
|
|
|
|
|
# Start persistent wineserver if necessary.
|
|
|
|
# This speeds up jobs with many invocations of wine (e.g., ./configure with MSVC) tremendously.
|
|
|
|
case "$WRAPPER_CMD" in
|
|
|
|
*wine*)
|
|
|
|
# This is apparently only reliable when we run a dummy command such as "hh.exe" afterwards.
|
|
|
|
wineserver -p && wine hh.exe
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2021-06-14 14:55:38 +00:00
|
|
|
env >> test_env.log
|
|
|
|
|
2022-12-20 21:11:14 +00:00
|
|
|
if [ -n "$CC" ]; then
|
|
|
|
# The MSVC compiler "cl" doesn't understand "-v"
|
|
|
|
$CC -v || true
|
|
|
|
fi
|
|
|
|
if [ "$WITH_VALGRIND" = "yes" ]; then
|
|
|
|
valgrind --version
|
|
|
|
fi
|
|
|
|
if [ -n "$WRAPPER_CMD" ]; then
|
|
|
|
$WRAPPER_CMD --version
|
|
|
|
fi
|
2021-06-14 14:55:38 +00:00
|
|
|
|
|
|
|
./autogen.sh
|
2020-08-26 17:35:27 +00:00
|
|
|
|
|
|
|
./configure \
|
2020-12-29 17:15:51 +00:00
|
|
|
--enable-experimental="$EXPERIMENTAL" \
|
2021-06-14 14:55:38 +00:00
|
|
|
--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \
|
2022-03-08 19:45:41 +00:00
|
|
|
--with-ecmult-window="$ECMULTWINDOW" \
|
|
|
|
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
|
2020-08-26 17:35:27 +00:00
|
|
|
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
|
2020-09-15 01:39:26 +00:00
|
|
|
--enable-module-schnorrsig="$SCHNORRSIG" \
|
2022-12-20 21:11:14 +00:00
|
|
|
--enable-examples="$EXAMPLES" \
|
2020-09-15 01:39:26 +00:00
|
|
|
--with-valgrind="$WITH_VALGRIND" \
|
2020-08-26 17:35:27 +00:00
|
|
|
--host="$HOST" $EXTRAFLAGS
|
|
|
|
|
2021-06-14 14:55:38 +00:00
|
|
|
# We have set "-j<n>" in MAKEFLAGS.
|
|
|
|
make
|
|
|
|
|
|
|
|
# Print information about binaries so that we can see that the architecture is correct
|
|
|
|
file *tests* || true
|
2022-03-08 19:45:41 +00:00
|
|
|
file bench* || true
|
2021-06-14 14:55:38 +00:00
|
|
|
file .libs/* || true
|
|
|
|
|
|
|
|
# This tells `make check` to wrap test invocations.
|
|
|
|
export LOG_COMPILER="$WRAPPER_CMD"
|
|
|
|
|
|
|
|
make "$BUILD"
|
|
|
|
|
2020-09-15 01:39:26 +00:00
|
|
|
if [ "$BENCH" = "yes" ]
|
2020-08-26 17:35:27 +00:00
|
|
|
then
|
2021-06-14 14:55:38 +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 "$WRAPPER_CMD" ]
|
2020-08-26 17:35:27 +00:00
|
|
|
then
|
2021-06-14 14:55:38 +00:00
|
|
|
EXEC="$EXEC $WRAPPER_CMD"
|
2020-08-26 17:35:27 +00:00
|
|
|
fi
|
|
|
|
{
|
|
|
|
$EXEC ./bench_ecmult
|
|
|
|
$EXEC ./bench_internal
|
2022-03-08 19:45:41 +00:00
|
|
|
$EXEC ./bench
|
2020-08-26 17:35:27 +00:00
|
|
|
} >> bench.log 2>&1
|
|
|
|
fi
|
2022-03-08 19:45:41 +00:00
|
|
|
|
2020-09-15 01:39:26 +00:00
|
|
|
if [ "$CTIMETEST" = "yes" ]
|
2020-08-26 17:35:27 +00:00
|
|
|
then
|
|
|
|
./libtool --mode=execute valgrind --error-exitcode=42 ./valgrind_ctime_test > valgrind_ctime_test.log 2>&1
|
|
|
|
fi
|
2022-03-08 19:45:41 +00:00
|
|
|
|
|
|
|
# Rebuild precomputed files (if not cross-compiling).
|
|
|
|
if [ -z "$HOST" ]
|
|
|
|
then
|
|
|
|
make clean-precomp
|
|
|
|
make precomp
|
|
|
|
fi
|
|
|
|
|
2022-12-20 21:11:14 +00:00
|
|
|
# Shutdown wineserver again
|
|
|
|
wineserver -k || true
|
|
|
|
|
2022-03-08 19:45:41 +00:00
|
|
|
# Check that no repo files have been modified by the build.
|
|
|
|
# (This fails for example if the precomp files need to be updated in the repo.)
|
|
|
|
git diff --exit-code
|