tests: support older fallocate number formats

* 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.
This commit is contained in:
Pádraig Brady 2016-01-14 02:18:58 +00:00
parent 89f7adb158
commit b955a4fb6d

View File

@ -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