From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Tue, 26 Nov 2024 02:08:07 +0000 (+0100) Subject: CI: add address sanitizer to Debian runtime tests X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=af3054394eecb223e8fa9a031dd69072fecab63c;p=proto%2Flabwc.git CI: add address sanitizer to Debian runtime tests --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f773524..2cc66e3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,9 +186,9 @@ jobs: echo ' cd "$GITHUB_WORKSPACE" export CC=gcc - meson setup build-gcc-ci -Dxwayland=enabled -Db_sanitize=undefined --werror - meson compile -C build-gcc-ci - scripts/ci/smoke-test.sh build-gcc-ci + meson setup build-gcc-gdb -Dxwayland=enabled -Db_sanitize=undefined --werror + meson compile -C build-gcc-gdb + scripts/ci/smoke-test.sh build-gcc-gdb ' | $TARGET - name: Build with clang - runtime test @@ -197,9 +197,31 @@ jobs: echo ' cd "$GITHUB_WORKSPACE" export CC=clang - meson setup build-clang-ci -Dxwayland=enabled -Db_sanitize=undefined --werror - meson compile -C build-clang-ci - scripts/ci/smoke-test.sh build-clang-ci + meson setup build-clang-gdb -Dxwayland=enabled -Db_sanitize=undefined --werror + meson compile -C build-clang-gdb + scripts/ci/smoke-test.sh build-clang-gdb + ' | $TARGET + + - name: Build with gcc - runtime leak test + if: matrix.name == 'Debian' + run: | + echo ' + cd "$GITHUB_WORKSPACE" + export CC=gcc + meson setup build-gcc-leak -Dxwayland=enabled -Db_sanitize=address,undefined --werror + meson compile -C build-gcc-leak + LABWC_LEAK_TEST=1 scripts/ci/smoke-test.sh build-gcc-leak + ' | $TARGET + + - name: Build with clang - runtime leak test + if: matrix.name == 'Debian' + run: | + echo ' + cd "$GITHUB_WORKSPACE" + export CC=clang + meson setup build-clang-leak -Dxwayland=enabled -Db_sanitize=address,undefined --werror + meson compile -C build-clang-leak + LABWC_LEAK_TEST=1 scripts/ci/smoke-test.sh build-clang-leak ' | $TARGET # Void-musl doesn't support sanitizer diff --git a/scripts/asan_leak_suppressions b/scripts/asan_leak_suppressions new file mode 100644 index 00000000..6ac2d14a --- /dev/null +++ b/scripts/asan_leak_suppressions @@ -0,0 +1 @@ +leak:libfontconfig.so diff --git a/scripts/ci/smoke-test.sh b/scripts/ci/smoke-test.sh index e366ceaf..d32ad484 100755 --- a/scripts/ci/smoke-test.sh +++ b/scripts/ci/smoke-test.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash : ${LABWC_RUNS:=1} +: ${LABWC_LEAK_TEST:=0} if ! test -x "$1/labwc"; then echo "$1/labwc not found" @@ -44,6 +45,11 @@ gdb_run() { echo "Running with LABWC_RUNS=$LABWC_RUNS" +if test "$LABWC_LEAK_TEST" != "0"; then + LSAN_OPTIONS=suppressions=scripts/asan_leak_suppressions "${args[@]}" + exit $? +fi + ret=0 for((i=1; i<=LABWC_RUNS; i++)); do printf "Starting run %2s\n" $i