]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid FP failure when cp fails for /proc/cpuinfo
authorBernhard Voelker <mail@bernhard-voelker.de>
Thu, 9 Jan 2014 01:14:17 +0000 (02:14 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Thu, 9 Jan 2014 01:14:17 +0000 (02:14 +0100)
On emulated aarch64 systems like in the qemu-based OpenBuildService
of openSUSE, cp fails to copy /proc/cpuinfo because the inode number
changes 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

index d6f05e256845f1a75df8e5ac98f30570754c007d..3369cfb3cd8bc8f5c8f5a804ceed674ccb1edd68 100755 (executable)
@@ -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.