From fcfcb97e74b55a107290d44c81c049d6168e954f Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Mon, 17 May 2021 17:19:01 +0200 Subject: [PATCH] ci: Simplify to use generic wrapper for QEMU, Valgrind, etc --- .cirrus.yml | 16 ++++++---------- ci/cirrus.sh | 37 +++++-------------------------------- 2 files changed, 11 insertions(+), 42 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 6a3b4b2..25579d9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,6 @@ env: ASM: no BUILD: check WITH_VALGRIND: yes - RUN_VALGRIND: no EXTRAFLAGS: HOST: ECDH: no @@ -162,9 +161,8 @@ task: cpu: 1 memory: 1G env: - QEMU_CMD: qemu-s390x + WRAPPER_CMD: qemu-s390x HOST: s390x-linux-gnu - BUILD: WITH_VALGRIND: no ECDH: yes RECOVERY: yes @@ -185,9 +183,8 @@ task: cpu: 1 memory: 1G env: - QEMU_CMD: qemu-arm + WRAPPER_CMD: qemu-arm HOST: arm-linux-gnueabihf - BUILD: WITH_VALGRIND: no ECDH: yes RECOVERY: yes @@ -209,9 +206,8 @@ task: cpu: 1 memory: 1G env: - QEMU_CMD: qemu-aarch64 + WRAPPER_CMD: qemu-aarch64 HOST: aarch64-linux-gnu - BUILD: WITH_VALGRIND: no ECDH: yes RECOVERY: yes @@ -230,9 +226,8 @@ task: cpu: 1 memory: 1G env: - WINE_CMD: wine64-stable + WRAPPER_CMD: wine64-stable HOST: x86_64-w64-mingw32 - BUILD: WITH_VALGRIND: no ECDH: yes RECOVERY: yes @@ -260,7 +255,8 @@ task: matrix: - name: "Valgrind (memcheck)" env: - RUN_VALGRIND: yes + # 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) + WRAPPER_CMD: "valgrind --error-exitcode=42" - name: "UBSan, ASan, LSan" env: CFLAGS: "-fsanitize=undefined,address" diff --git a/ci/cirrus.sh b/ci/cirrus.sh index dafab8a..060335e 100755 --- a/ci/cirrus.sh +++ b/ci/cirrus.sh @@ -29,45 +29,18 @@ file *tests* || true file bench_* || true file .libs/* || true -if [ -n "$BUILD" ] -then - make "$BUILD" -fi +# This tells `make check` to wrap test invocations. +export LOG_COMPILER="$WRAPPER_CMD" -if [ "$RUN_VALGRIND" = "yes" ] -then - # 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) - valgrind --error-exitcode=42 ./tests 16 - valgrind --error-exitcode=42 ./exhaustive_tests -fi - -if [ -n "$QEMU_CMD" ] -then - $QEMU_CMD ./tests 16 - $QEMU_CMD ./exhaustive_tests -fi - -if [ -n "$WINE_CMD" ] -then - $WINE_CMD ./tests 16 - $WINE_CMD ./exhaustive_tests -fi +make "$BUILD" if [ "$BENCH" = "yes" ] then # 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" ] + if [ -n "$WRAPPER_CMD" ] then - EXEC="$EXEC $QEMU_CMD" - fi - if [ "$RUN_VALGRIND" = "yes" ] - then - EXEC="$EXEC valgrind --error-exitcode=42" - fi - if [ -n "$WINE_CMD" ] - then - EXEC="$WINE_CMD" + EXEC="$EXEC $WRAPPER_CMD" fi # This limits the iterations in the benchmarks below to ITER iterations. export SECP256K1_BENCH_ITERS="$ITERS"