diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-04-11 23:44:13 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-04-11 23:52:08 +0100 |
commit | 7c03fe2c9f498bad7e40d29f2eb4573d23e102d0 (patch) | |
tree | dfee25f3115d501d25fc233bb76b7194244dc379 /tests | |
parent | e9cb3eb6cee714865eff7a29e6c2101e545617c2 (diff) | |
download | coreutils-7c03fe2c9f498bad7e40d29f2eb4573d23e102d0.tar.xz |
tests: fix false dd conv=sparse failure on newer XFS
* tests/dd/sparse.sh: When testing that a hole is created,
use an existing sparse destination file, so that we're
not write extending the file size, and thus avoiding
speculative preallocation which can result in smaller
holes than requested.
Workaround suggested by Brian Foster
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/dd/sparse.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/dd/sparse.sh b/tests/dd/sparse.sh index 06efc7017..a7e90d2be 100755 --- a/tests/dd/sparse.sh +++ b/tests/dd/sparse.sh @@ -61,8 +61,15 @@ if test $(kb_alloc file.in) -gt 3000; then dd if=file.in of=file.out bs=2M conv=sparse test 2500 -lt $(kb_alloc file.out) || fail=1 + # Note we recreate a sparse file first to avoid + # speculative preallocation seen in XFS, where a write() that + # extends a file can preallocate some extra space that + # a subsequent seek will not convert to a hole. + rm -f file.out + truncate --size=3M file.out + # Ensure that this 1MiB string of NULs *is* converted to a hole. - dd if=file.in of=file.out bs=1M conv=sparse + dd if=file.in of=file.out bs=1M conv=sparse,notrunc test $(kb_alloc file.out) -lt 2500 || fail=1 fi |