]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Move sanitizer details into a test wrapper
authorEmil Velikov <emil.l.velikov@gmail.com>
Wed, 9 Oct 2024 15:26:25 +0000 (16:26 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 17 Oct 2024 13:35:10 +0000 (08:35 -0500)
We want the meson test target to be self contained and having an
essential variables defined in the GitHub CI is heading the opposite
direction.

Create a wrapper that does this for us.

v2:
 - add the script to the autotools tarball/EXTRA_DIST

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/179
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
.github/workflows/main.yml
Makefile.am
meson.build
scripts/test-wrapper.sh [new file with mode: 0755]
testsuite/meson.build

index 5e3804aa8727934f5ef9dd5fe05f2de9d842e244..7f1b8be6b3a849ca37f8e0cac4fc20ff76916f6f 100644 (file)
@@ -70,7 +70,6 @@ jobs:
           git config --global --add safe.directory '*'
 
           .github/print-kdir.sh >> "$GITHUB_ENV"
-          echo "ASAN_OPTIONS=verify_asan_link_order=0:halt_on_error=1:abort_on_error=1:print_summary=1" >> "$GITHUB_ENV"
 
       - name: configure (meson)
         if: ${{ matrix.build == 'meson' }}
index 213a1fe6220ab0dddf18dc4c4834b8bfb57137fd..c3b17497a38eca7ca26b2da015504c09125da05a 100644 (file)
@@ -24,6 +24,7 @@ EXTRA_DIST += \
        testsuite/meson.build \
        scripts/build-scdoc.sh \
        scripts/test-gtkdoc.sh \
+       scripts/test-wrapper.sh \
        scripts/kmod-symlink.sh
 
 AM_CPPFLAGS = \
index 9b7b71fc14ba0a25f52b67ca8d64c77cbc10bfd0..251023a66fb962bf570ee4e36b2ddc65a9d6ef75 100644 (file)
@@ -459,6 +459,7 @@ if get_option('build-tests')
   setup_modules = find_program('scripts/setup-modules.sh')
   setup_rootfs = find_program('scripts/setup-rootfs.sh')
   top_include = include_directories('.')
+  test_wrapper = find_program('scripts/test-wrapper.sh')
   subdir('testsuite')
 endif
 
diff --git a/scripts/test-wrapper.sh b/scripts/test-wrapper.sh
new file mode 100755 (executable)
index 0000000..78b4832
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+set -euo pipefail
+
+if [[ ${ASAN_OPTIONS-} || ${UBSAN_OPTIONS-} || ${MSAN_OPTIONS-} ]]; then
+    ASAN_OPTIONS=verify_asan_link_order=0:halt_on_error=1:abort_on_error=1:print_summary=1
+    export ASAN_OPTIONS
+fi
+
+exec "$@"
index 643c259bf1a5226251799dbefc16e5f35df522c5..394e4f36f77c37a019d6618e8e36e755d7d9d6af 100644 (file)
@@ -97,7 +97,8 @@ _testsuite = [
 foreach input : _testsuite
   test(
     input,
-    executable(
+    test_wrapper,
+    args : executable(
       input,
       files('@0@.c'.format(input)),
       include_directories : top_include,