From f9eebda93ce811bbce7ef9942db2e80aceb89c09 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Wed, 21 Jan 2026 17:31:24 +0000 Subject: [PATCH] tests: avoid false failure with sanitizer builds * init.cfg (sanitizer_build_): Add a helper to detect if a program is built against a sanitizer. * tests/df/no-mtab-status-masked-proc.sh: Skip if a sanitizer build. --- init.cfg | 7 +++++++ tests/df/no-mtab-status-masked-proc.sh | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/init.cfg b/init.cfg index f453279bfa..9224c5df0f 100644 --- a/init.cfg +++ b/init.cfg @@ -850,4 +850,11 @@ uses_strace_ () fi } +# Return true if passed program is built with ASAN, or UBSAN etc. +sanitizer_build_() +{ + env $(printf '%sSAN_OPTIONS=help=1 ' A UB L M T) "$1" --version 2>&1 | + grep '[Ss]anitizer' >/dev/null +} + sanitize_path_ diff --git a/tests/df/no-mtab-status-masked-proc.sh b/tests/df/no-mtab-status-masked-proc.sh index 11975ea204..fccf7cd788 100755 --- a/tests/df/no-mtab-status-masked-proc.sh +++ b/tests/df/no-mtab-status-masked-proc.sh @@ -22,6 +22,9 @@ print_ver_ df skip_if_root_ +# Sanitizers need to read from /proc +sanitizer_build_ df && skip_ 'Sanitizer not supported' + # Protect against inaccessible remote mounts etc. timeout 10 df || skip_ "df fails" @@ -30,7 +33,7 @@ unshare -rm true || skip_ 'User namespace sandbox is disabled' # mask /proc df() { unshare -rm $SHELL -c \ - "mount -t tmpfs tmpfs /proc && command df \"\$@\"" -- "$@"; + "mount -t tmpfs tmpfs /proc && env df \"\$@\"" -- "$@"; } df /proc || fail=1 -- 2.47.3