Skip to content

Commit

Permalink
ci: Simplify to use generic wrapper for QEMU, Valgrind, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random committed May 17, 2021
1 parent 073b7c5 commit 4087f78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
15 changes: 9 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ env:
ASM: no
BUILD: check
WITH_VALGRIND: yes
RUN_VALGRIND: no
EXTRAFLAGS:
HOST:
ECDH: no
Expand Down Expand Up @@ -162,7 +161,7 @@ task:
cpu: 1
memory: 1G
env:
QEMU_CMD: qemu-s390x
WRAPPER_CMD: qemu-s390x
HOST: s390x-linux-gnu
BUILD:
WITH_VALGRIND: no
Expand All @@ -185,7 +184,7 @@ task:
cpu: 1
memory: 1G
env:
QEMU_CMD: qemu-arm
WRAPPER_CMD: qemu-arm
HOST: arm-linux-gnueabihf
BUILD:
WITH_VALGRIND: no
Expand All @@ -209,7 +208,7 @@ task:
cpu: 1
memory: 1G
env:
QEMU_CMD: qemu-aarch64
WRAPPER_CMD: qemu-aarch64
HOST: aarch64-linux-gnu
BUILD:
WITH_VALGRIND: no
Expand All @@ -230,7 +229,7 @@ task:
cpu: 1
memory: 1G
env:
WINE_CMD: wine64-stable
WRAPPER_CMD: wine64-stable
HOST: x86_64-w64-mingw32
BUILD:
WITH_VALGRIND: no
Expand All @@ -251,6 +250,7 @@ task:
cpu: 1
memory: 1G
env:
BUILD:
ECDH: yes
RECOVERY: yes
EXPERIMENTAL: yes
Expand All @@ -260,9 +260,12 @@ 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:
# Use dummy wrapper command to run the tests outside of make check
WRAPPER_CMD: env
CFLAGS: "-fsanitize=undefined,address"
CFLAGS_FOR_BUILD: "-fsanitize=undefined,address"
UBSAN_OPTIONS: "print_stacktrace=1:halt_on_error=1"
Expand Down
31 changes: 5 additions & 26 deletions ci/cirrus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,19 @@ then
make "$BUILD"
fi

if [ "$RUN_VALGRIND" = "yes" ]
if [ -n "$WRAPPER_CMD" ]
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
$WRAPPER_CMD ./tests 16
$WRAPPER_CMD ./exhaustive_tests
fi

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" ]
then
EXEC="$EXEC $QEMU_CMD"
fi
if [ "$RUN_VALGRIND" = "yes" ]
then
EXEC="$EXEC valgrind --error-exitcode=42"
fi
if [ -n "$WINE_CMD" ]
if [ -n "$WRAPPER_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"
Expand Down

0 comments on commit 4087f78

Please sign in to comment.