]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid failure when cp fails for proc files
authorAndreas Schwab <schwab@linux-m68k.org>
Mon, 24 Apr 2023 08:15:01 +0000 (10:15 +0200)
committerPádraig Brady <P@draigBrady.com>
Mon, 24 Apr 2023 10:37:09 +0000 (11:37 +0100)
When run under QEmu emulation emulated /proc files have
unstable inode numbers.

* tests/cp/proc-short-read.sh: Skip if unstable inode numbers detected.

tests/cp/proc-short-read.sh

index 0f7c9e69742d9e0028a3088a6d6983d74886929c..806fe285b004b5eda2f884486a06a377c82de324 100755 (executable)
@@ -24,7 +24,13 @@ proc_large=/proc/cpuinfo  # usually > 4KiB
 test -r $proc_large || skip_ "your system lacks $proc_large"
 
 # Before coreutils-7.3, cp would copy less than 4KiB of this file.
-cp $proc_large 1    || fail=1
+# Skip this test when run under QEmu emulation where emulated /proc files
+# have unstable inode numbers.
+cp $proc_large 1 2>err \
+  || { fail=1
+       grep 'replaced while being copied' err \
+         && skip_ "File $proc_large is being replaced while being copied"; }
+
 cat $proc_large > 2 || fail=1
 
 # adjust varying parts