2020-05-02 21:58:42 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-11-08 09:47:31 +00:00
|
|
|
set -eux
|
2020-05-02 21:58:42 +03:00
|
|
|
|
2020-12-22 16:42:08 +01:00
|
|
|
export LC_ALL=C
|
|
|
|
|
2022-11-02 14:45:13 +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.
|
2022-11-08 09:47:31 +00:00
|
|
|
for var in WERROR_CFLAGS MAKEFLAGS BUILD \
|
2022-11-02 14:45:13 +00:00
|
|
|
ECMULTWINDOW ECMULTGENPRECISION ASM WIDEMUL WITH_VALGRIND EXTRAFLAGS \
|
|
|
|
EXPERIMENTAL ECDH RECOVERY SCHNORRSIG \
|
2022-12-20 12:28:48 -05:00
|
|
|
SECP256K1_TEST_ITERS BENCH SECP256K1_BENCH_ITERS CTIMETESTS\
|
2022-11-02 14:45:13 +00:00
|
|
|
EXAMPLES \
|
2022-11-08 09:47:31 +00:00
|
|
|
HOST WRAPPER_CMD \
|
2022-11-17 16:36:14 +00:00
|
|
|
CC CFLAGS CPPFLAGS AR NM
|
2022-11-02 14:45:13 +00:00
|
|
|
do
|
2022-11-08 09:47:31 +00:00
|
|
|
eval "isset=\${$var+x}"
|
|
|
|
if [ -n "$isset" ]; then
|
|
|
|
eval "val=\${$var}"
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
printf '%s="%s" ' "$var" "$val"
|
|
|
|
fi
|
2022-11-02 14:45:13 +00:00
|
|
|
done
|
|
|
|
echo "$0"
|
|
|
|
set -x
|
|
|
|
}
|
|
|
|
print_environment
|
|
|
|
|
2022-03-16 14:33:37 +01:00
|
|
|
# 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
|
|
|
|
|
2020-12-22 16:42:08 +01:00
|
|
|
env >> test_env.log
|
|
|
|
|
2022-11-08 09:47:31 +00:00
|
|
|
if [ -n "${CC+x}" ]; then
|
2022-11-02 14:21:04 +00:00
|
|
|
# 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
|
2020-12-22 16:42:08 +01:00
|
|
|
|
|
|
|
./autogen.sh
|
|
|
|
|
2020-05-02 21:58:42 +03:00
|
|
|
./configure \
|
2020-09-25 20:06:36 -07:00
|
|
|
--enable-experimental="$EXPERIMENTAL" \
|
2020-10-11 16:04:58 -07:00
|
|
|
--with-test-override-wide-multiply="$WIDEMUL" --with-asm="$ASM" \
|
2021-12-15 14:10:46 +01:00
|
|
|
--with-ecmult-window="$ECMULTWINDOW" \
|
2021-12-15 14:03:11 +01:00
|
|
|
--with-ecmult-gen-precision="$ECMULTGENPRECISION" \
|
2020-07-29 08:50:42 +02:00
|
|
|
--enable-module-ecdh="$ECDH" --enable-module-recovery="$RECOVERY" \
|
2020-05-12 16:17:59 +00:00
|
|
|
--enable-module-schnorrsig="$SCHNORRSIG" \
|
2020-04-30 14:34:24 +03:00
|
|
|
--enable-examples="$EXAMPLES" \
|
2022-12-20 12:28:48 -05:00
|
|
|
--enable-ctime-tests="$CTIMETESTS" \
|
2020-09-21 07:47:40 +00:00
|
|
|
--with-valgrind="$WITH_VALGRIND" \
|
2020-07-29 08:50:42 +02:00
|
|
|
--host="$HOST" $EXTRAFLAGS
|
2020-05-02 21:58:42 +03:00
|
|
|
|
2021-03-03 01:21:18 +01:00
|
|
|
# We have set "-j<n>" in MAKEFLAGS.
|
|
|
|
make
|
2021-02-26 17:36:34 +01:00
|
|
|
|
|
|
|
# Print information about binaries so that we can see that the architecture is correct
|
2021-04-17 10:57:16 -07:00
|
|
|
file *tests* || true
|
2021-10-17 12:08:06 -04:00
|
|
|
file bench* || true
|
2021-02-26 17:36:34 +01:00
|
|
|
file .libs/* || true
|
|
|
|
|
2021-05-17 17:19:01 +02:00
|
|
|
# This tells `make check` to wrap test invocations.
|
|
|
|
export LOG_COMPILER="$WRAPPER_CMD"
|
2020-12-22 16:42:08 +01:00
|
|
|
|
2021-05-17 17:19:01 +02:00
|
|
|
make "$BUILD"
|
2021-04-17 10:57:16 -07:00
|
|
|
|
2022-12-06 18:53:51 -05: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" ]
|
|
|
|
then
|
|
|
|
EXEC="$EXEC $WRAPPER_CMD"
|
|
|
|
fi
|
|
|
|
|
2020-07-30 11:18:07 +03:00
|
|
|
if [ "$BENCH" = "yes" ]
|
2020-05-02 21:58:42 +03:00
|
|
|
then
|
|
|
|
{
|
|
|
|
$EXEC ./bench_ecmult
|
|
|
|
$EXEC ./bench_internal
|
2021-10-17 12:08:06 -04:00
|
|
|
$EXEC ./bench
|
2020-05-02 21:58:42 +03:00
|
|
|
} >> bench.log 2>&1
|
|
|
|
fi
|
2021-11-13 15:52:44 +01:00
|
|
|
|
2022-12-20 12:28:48 -05:00
|
|
|
if [ "$CTIMETESTS" = "yes" ]
|
2020-05-02 21:58:42 +03:00
|
|
|
then
|
2022-12-06 18:53:51 -05:00
|
|
|
if [ "$WITH_VALGRIND" = "yes" ]; then
|
|
|
|
./libtool --mode=execute valgrind --error-exitcode=42 ./ctime_tests > ctime_tests.log 2>&1
|
|
|
|
else
|
|
|
|
$EXEC ./ctime_tests > ctime_tests.log 2>&1
|
|
|
|
fi
|
2020-05-02 21:58:42 +03:00
|
|
|
fi
|
2021-11-13 15:52:44 +01:00
|
|
|
|
|
|
|
# Rebuild precomputed files (if not cross-compiling).
|
|
|
|
if [ -z "$HOST" ]
|
|
|
|
then
|
|
|
|
make clean-precomp
|
|
|
|
make precomp
|
|
|
|
fi
|
|
|
|
|
2022-03-16 14:33:37 +01:00
|
|
|
# Shutdown wineserver again
|
|
|
|
wineserver -k || true
|
|
|
|
|
2021-11-13 15:52:44 +01: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
|