coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tests: avoid failure when cp fails for /proc/cpuinfo


From: Andreas Schwab
Subject: [PATCH] tests: avoid failure when cp fails for /proc/cpuinfo
Date: Mon, 24 Apr 2023 10:15:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

When run under QEmu emulation emulated /proc files have unstable inode
numbers.
---
 tests/cp/proc-short-read.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/cp/proc-short-read.sh b/tests/cp/proc-short-read.sh
index 0f7c9e697..806fe285b 100755
--- a/tests/cp/proc-short-read.sh
+++ b/tests/cp/proc-short-read.sh
@@ -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
-- 
2.40.0


-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]