coreutils
[Top][All Lists]
Advanced

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

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


From: Bernhard Voelker
Subject: [PATCH] tests: avoid FP failure when cp fails for /proc/cpuinfo
Date: Wed, 08 Jan 2014 12:38:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

The following fixes a false-positive for 'cp /proc/cpuinfo exp' on
aarch64 where the inode of the file changes during being copied.

Have a nice day,
Berny


>From 84e67a5bd239179e2faded424861dce5718fa12c Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Tue, 7 Jan 2014 19:18:25 +0100
Subject: [PATCH] tests: avoid FP failure when cp fails for /proc/cpuinfo

On aarch64, cp fails to copy /proc/cpuinfo because the inode number
seems to change between the initial stat() call and copying the file:

  $ cp /proc/cpuinfo exp
  cp: skipping file '/proc/cpuinfo', as it was \
  replaced while being copied

* tests/cp/proc-zero-len.sh: When cp fails, check on the above
error message to skip the test.
---
 tests/cp/proc-zero-len.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/cp/proc-zero-len.sh b/tests/cp/proc-zero-len.sh
index d6f05e2..3369cfb 100755
--- a/tests/cp/proc-zero-len.sh
+++ b/tests/cp/proc-zero-len.sh
@@ -27,7 +27,12 @@ test -r $f || f=empty
 cat $f > out || fail=1

 # With coreutils-6.9, this would create a zero-length "exp" file.
-cp $f exp || fail=1
+# Skip this test on architectures like aarch64 where the inode
+# number of the file changed during the cp run.
+cp $f exp 2>err \
+  || { fail=1;
+       grep 'replaced while being copied' \
+         && skip_ "File $f is being replaced while being copied"; }

 # Don't simply compare contents; they might differ,
 # e.g., if CPU freq changes between cat and cp invocations.
-- 
1.8.4.2




reply via email to

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