From c5ed892b1b524b85a741a52a4afc99190c9f0c49 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Sat, 25 Jun 2022 19:53:41 +0100 Subject: [PATCH] CI: Disable ASan fast unwinding for suppressions Unfortunately just adding suppressions isn't enough; the build of Expat we have in our CI system does not have frame pointers, so ASan's fast unwinder can't see through it. This means that the suppressions we've added won't be taken into account. For now, disable the fast unwinder for the Xwayland test only. Disabling it globally is not practical as it massively increases the per-test runtime, so here (to avoid polluting the build system), we use a per-test wrapper to selectively choose the unwinder. Signed-off-by: Daniel Stone --- .gitlab-ci.yml | 2 +- .gitlab-ci/virtme-scripts/per-test-asan.sh | 20 +++++++++++++++++++ .gitlab-ci/virtme-scripts/run-weston-tests.sh | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 .gitlab-ci/virtme-scripts/per-test-asan.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bed0cbbf..98261d86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -202,7 +202,7 @@ aarch64-debian-container_prep: - $BUILDDIR/weston-virtme - $PREFIX reports: - junit: $BUILDDIR/meson-logs/testlog.junit.xml + junit: $BUILDDIR/meson-logs/testlog-per-test-asan.sh.junit.xml # Same as above, but without running any tests. .build-no-test: diff --git a/.gitlab-ci/virtme-scripts/per-test-asan.sh b/.gitlab-ci/virtme-scripts/per-test-asan.sh new file mode 100755 index 00000000..044ac6d2 --- /dev/null +++ b/.gitlab-ci/virtme-scripts/per-test-asan.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# When running Debian's Xwayland and fontconfig, we hit memory leaks which +# aren't visible on other setups. We do have suppressions for these tests, but +# regrettably ASan can't see through omitted frame pointers in Expat, so for +# Xwayland specifically, we disable fast-unwind. +# +# Doing it globally makes the other tests far, far, too slow to run. +case "$1" in + *xwayland*) + export ASAN_OPTIONS="detect_leaks=0,fast_unwind_on_malloc=0" + ;; + *) + export ASAN_OPTIONS="detect_leaks=0" + ;; +esac + +export ASAN_OPTIONS + +exec "$@" diff --git a/.gitlab-ci/virtme-scripts/run-weston-tests.sh b/.gitlab-ci/virtme-scripts/run-weston-tests.sh index a45f9668..2b156333 100755 --- a/.gitlab-ci/virtme-scripts/run-weston-tests.sh +++ b/.gitlab-ci/virtme-scripts/run-weston-tests.sh @@ -26,13 +26,13 @@ export HOME=/root export PATH=$HOME/.local/bin:$PATH export PATH=/usr/local/bin:$PATH -export ASAN_OPTIONS=detect_leaks=0,atexit=1 export SEATD_LOGLEVEL=debug # run the tests and save the exit status # we give ourselves a very generous timeout multiplier due to ASan overhead echo 0x1f > /sys/module/drm/parameters/debug -seatd-launch -- meson test --no-rebuild --timeout-multiplier 4 +seatd-launch -- meson test --no-rebuild --timeout-multiplier 4 \ + --wrapper $(pwd)/../.gitlab-ci/virtme-scripts/per-test-asan.sh # note that we need to store the return value from the tests in order to # determine if the test suite ran successfully or not. TEST_RES=$?