From db5cb6515ab5ad13c9fad3bd974fda1394895280 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 9 May 2026 14:05:58 +0300 Subject: [PATCH] ci: use ASan/UBsan in bluetooth tests Compile with sanitizers for the bluetooth tests, for better backtraces on failures. Also produce backtraces via gdb. --- .gitlab-ci.yml | 12 ++++++++++-- .gitlab/ci/core-backtrace.sh | 22 ++++++++++++++++++++++ .gitlab/ci/setup-fedora-container.sh | 4 ++-- 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100755 .gitlab/ci/core-backtrace.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7f9320ae..6b35b4b25 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ stages: variables: FDO_UPSTREAM_REPO: 'pipewire/pipewire' BLUEZ_COMMIT: '7cd27f4f66aa88194fbc1565bc13f24405acacd8' - PYTEST_BLUEZENV_VERSION: '0.1.2' + PYTEST_BLUEZENV_VERSION: 'pytest-bluezenv==0.1.4' BLUEZENV_BZIMAGE: 'https://github.com/pv/bluez-test-functional-kernel/releases/download/2026-05-08.1/bzImage-v7.0-cfg3ed20edd' # ci-templates as of Mar 25th 2024 @@ -41,7 +41,7 @@ include: .fedora: variables: # Update this tag when you want to trigger a rebuild - FDO_DISTRIBUTION_TAG: '2026-05-09.0' + FDO_DISTRIBUTION_TAG: '2026-05-09.8' FDO_DISTRIBUTION_VERSION: '44' FDO_DISTRIBUTION_PACKAGES: >- alsa-lib-devel @@ -60,6 +60,7 @@ include: findutils gcc gcc-c++ + gdb git glib-devel graphviz @@ -490,13 +491,20 @@ bluez_tests: -Dsnap=disabled -Droc=disabled -Dlibcamera=disabled + -Db_sanitize=address,undefined + -Ddebug=true + -Doptimization=g before_script: - !reference [.build_on_fedora, before_script] - python3 -m pip install /bluez/pytest_bluezenv-*.whl script: - meson setup "$BUILD_DIR" --prefix="$PREFIX" $MESON_OPTIONS - meson compile -C "$BUILD_DIR" $COMPILE_ARGS + - export UBSAN_OPTIONS=abort_on_error=1:print_summary=1:print_stacktrace=1 + - export ASAN_OPTIONS=abort_on_error=1:print_summary=1:detect_leaks=1:leak_check_at_exit=0 - meson devenv -C "$BUILD_DIR" -w . python3 -m pytest test --kernel /bluez/bzImage* --bluez-src-dir /bluez -ra -vvv --reruns 1 --vm-timeout 30 + after_script: + - ./.gitlab/ci/core-backtrace.sh *core build_on_alpine: extends: diff --git a/.gitlab/ci/core-backtrace.sh b/.gitlab/ci/core-backtrace.sh new file mode 100755 index 000000000..85883844c --- /dev/null +++ b/.gitlab/ci/core-backtrace.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# core-backtrace.sh COREFILE... +# +# Print backtraces from core dump files +# +set -e + +for f in "$@"; do + if [ ! -e "$f" ]; then + continue + fi + echo "#" + echo "# --- $f ---" + echo "#" + exe=$(gdb -q -c "$f" -ex 'info auxv' -ex quit | sed -n -e '/AT_EXECFN/ { s/^[^"]*"//; s/"$//; p; }') + if [ -f "$exe" ]; then + gdb -q "$exe" "$f" -ex 'thr a a bt full' -ex quit + else + gdb -q -c "$f" -ex 'thr a a bt full' -ex quit + fi +done diff --git a/.gitlab/ci/setup-fedora-container.sh b/.gitlab/ci/setup-fedora-container.sh index ee35e0416..e2bf16913 100755 --- a/.gitlab/ci/setup-fedora-container.sh +++ b/.gitlab/ci/setup-fedora-container.sh @@ -14,7 +14,7 @@ fi git clone --depth 1 --revision "$BLUEZ_COMMIT" https://github.com/bluez/bluez.git /bluez-build cd /bluez-build ./bootstrap -./configure --enable-tools --disable-obex +./configure --enable-tools --disable-obex --enable-asan --enable-ubsan --enable-debug # shellcheck disable=SC2086 make $COMPILE_ARGS cd / @@ -26,7 +26,7 @@ cp /bluez-build/tools/btmgmt /bluez/tools/ cp /bluez-build/src/bluetoothd /bluez/src/ cd /bluez -python3 -m pip wheel --no-deps "pytest-bluezenv==$PYTEST_BLUEZENV_VERSION" +python3 -m pip wheel --no-deps "$PYTEST_BLUEZENV_VERSION" curl -L "$BZIMAGE_URL" -o bzImage cd /