]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: support older fallocate number formats
authorPádraig Brady <P@draigBrady.com>
Thu, 14 Jan 2016 02:18:58 +0000 (02:18 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 15 Jan 2016 14:14:05 +0000 (14:14 +0000)
* tests/cp/fiemap-extents.sh: Support RHEL6 fallocate
which doesn't support IEC suffixes like "MiB" on numbers.
Also add some extra framework_failure_ protections.
Reported by Assaf Gordon.

tests/cp/fiemap-extents.sh

index d44a741375da1f6a4bab2aeeabcd3e2fd8adcb5f..672070ea80b95e607ee8caccd6c9f46d476d7c41 100755 (executable)
@@ -21,14 +21,14 @@ print_ver_ cp
 
 require_sparse_support_
 
-touch fiemap_chk
+touch fiemap_chk || framework_failure_
 fiemap_capable_ fiemap_chk ||
   skip_ 'this file system lacks FIEMAP support'
 rm fiemap_chk
 
 fallocate --help >/dev/null || skip_ 'The fallocate utility is required'
 touch falloc.test || framework_failure_
-fallocate -l 1 -o 0 -n falloc.test ||
+fallocate -l 1 -o 1 -n falloc.test ||
   skip_ 'this file system lacks FALLOCATE support'
 rm falloc.test
 
@@ -41,6 +41,9 @@ if false; then
 # which would cause failure of unrelated tests run in parallel.
 require_file_system_bytes_free_ 800000000
 
+fallocate -l 1MiB num.test ||
+  skip_ "this fallocate doesn't support numbers with IEX suffixes"
+
 fallocate -l 600MiB space.test ||
   skip_ 'this test needs at least 600MiB free space'
 
@@ -67,14 +70,14 @@ fi
 # Note the '-l 1' case is an effective noop, and just checks
 # a file with a trailing hole is copied correctly.
 for sparse_mode in always auto never; do
-  for alloc in '-l 4MiB ' '-l 1MiB -o 4MiB' '-l 1'; do
+  for alloc in '-l 4194304' '-l 1048576 -o 4194304' '-l 1'; do
     dd count=10 if=/dev/urandom iflag=fullblock of=unwritten.withdata
     truncate -s 2MiB unwritten.withdata || framework_failure_
     fallocate $alloc -n unwritten.withdata || framework_failure_
     cp --sparse=$sparse_mode unwritten.withdata cp.test || fail=1
     test $(stat -c %s unwritten.withdata) = $(stat -c %s cp.test) || fail=1
     cmp unwritten.withdata cp.test || fail=1
-    rm unwritten.withdata cp.test
+    rm unwritten.withdata cp.test || framework_failure_
   done
 done