diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-05-14 11:43:54 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-05-14 14:08:02 +0100 |
commit | 7f0f58fdd68e7ca86dd5db7effb2c7f94adc4a08 (patch) | |
tree | 6b50d29fb53c6d45bc9f43330abe6bf6b87f6c81 /tests/dd | |
parent | 45b8fe430dced8c489cb64491b8716cffeeca8c3 (diff) | |
download | coreutils-7f0f58fdd68e7ca86dd5db7effb2c7f94adc4a08.tar.xz |
tests: fix async allocation race on BTRFS
* tests/dd/sparse.sh: Sync files before checking allocations,
which may be done asynchronously on NFS and BTRFS at least.
Also mark this test as very expensive on remote file systems.
* tests/du/2g.sh: Likewise, also use fallocate if available
to efficiently allocate the large file, otherwise skip
on remote file systems.
* tests/tail-2/inotify-rotate-resources.sh: Use the more
standard is_local_dir_() to check remoteness.
* tests/cp/fiemap-empty.sh: Comment on the sync issue
for this currerntly unused test.
Fixes http://bugs.gnu.org/20570
Diffstat (limited to 'tests/dd')
-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 4fdabad0c..626b4059e 100755 --- a/tests/dd/sparse.sh +++ b/tests/dd/sparse.sh @@ -17,6 +17,7 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ dd +is_local_dir_ . || very_expensive_ require_sparse_support_ # Ensure basic sparse generation works @@ -50,6 +51,9 @@ dd if=/dev/zero of=file.in bs=1M count=1 seek=1 conv=notrunc || fail=1 kb_alloc() { du -k "$1"|cut -f1; } +# sync out data for async allocators like NFS/BTRFS +# sync file.in || fail=1 + # If our just-created input file appears to be too small, # skip the remaining tests. On at least Solaris 10 with NFS, # file.in is reported to occupy <= 1KiB for about 50 seconds @@ -58,7 +62,10 @@ if test $(kb_alloc file.in) -gt 3000; then # Ensure NUL blocks smaller than the block size are not made sparse. # Here, with a 2MiB block size, dd's conv=sparse must *not* introduce a hole. - dd if=file.in of=file.out bs=2M conv=sparse + dd if=file.in of=file.out bs=2M conv=sparse || fail=1 + + # Intermittently BTRFS returns 0 allocation for file.out unless synced + sync file.out || framework_failure_ test 2500 -lt $(kb_alloc file.out) || fail=1 # Note we recreate a sparse file first to avoid |