]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure with sanitizer builds
authorPádraig Brady <P@draigBrady.com>
Wed, 21 Jan 2026 17:31:24 +0000 (17:31 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 21 Jan 2026 17:49:39 +0000 (17:49 +0000)
* 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
tests/df/no-mtab-status-masked-proc.sh

index f453279bfa7059973f17978c092e27b863512c37..9224c5df0fdb29571416a3b7fcd67f74ad2ecd44 100644 (file)
--- 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_
index 11975ea204aa82892557f45ed9698d68df23226e..fccf7cd7887667614dbd839f571cb3cc0a2d4e91 100755 (executable)
@@ -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