summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-05-22 10:21:46 +0200
committerJim Meyering <meyering@redhat.com>2011-01-28 23:28:37 +0100
commitb9173f3a8adb6a9545d3691df17c14ffda1a0566 (patch)
tree635656b8d2828189b83e34cb5a23afbd5c6c422e
parentb301d1a0353ded58f8327e7f521283bb50156fbb (diff)
downloadcoreutils-b9173f3a8adb6a9545d3691df17c14ffda1a0566.tar.gz
tests: test fiemap-enabled cp more thoroughly
* tests/cp/sparse-fiemap: More tests.
-rwxr-xr-xtests/cp/sparse-fiemap61
1 files changed, 32 insertions, 29 deletions
diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index 1f78671ce..907ccbdbc 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -66,34 +66,37 @@ test $(stat --printf %s sparse) = $(stat --printf %s fiemap) || fail=1
$PERL -e 1 || skip_test_ 'skipping part of this test; you lack perl'
-$PERL -e 'BEGIN { $n = 16 * 1024; *F = *STDOUT }' \
- -e 'for (1..100) { sysseek (*F, $n, 1)' \
- -e '&& syswrite (*F, "."x$n) or die "$!"}' > j1 || fail=1
-
-cp --sparse=always j1 j2 || fail=1
-cmp j1 j2 || fail=1
-
-filefrag j1 | grep extent \
- || skip_test_ 'skipping part of this test; you lack filefrag'
-
-# Here is sample filefrag output:
-# $ perl -e 'BEGIN{$n=16*1024; *F=*STDOUT}' \
-# -e 'for (1..5) { sysseek(*F,$n,1)' \
-# -e '&& syswrite *F,"."x$n or die "$!"}' > j
-# $ filefrag -v j
-# File system type is: ef53
-# File size of j is 163840 (40 blocks, blocksize 4096)
-# ext logical physical expected length flags
-# 0 4 6258884 4
-# 1 12 6258892 6258887 4
-# 2 20 6258900 6258895 4
-# 3 28 6258908 6258903 4
-# 4 36 6258916 6258911 4 eof
-# j: 6 extents found
-
-# exclude the physical block numbers; they always differ
-filefrag -v j1 | awk '/^ / {print $1,$2,$NF}' > ff1 || fail=1
-filefrag -v j2 | awk '/^ / {print $1,$2,$NF}' > ff2 || fail=1
-compare ff1 ff2 || fail=1
+for i in $(seq 20); do
+ for j in 1 2 31 100; do
+ $PERL -e 'BEGIN { $n = '$i' * 1024; *F = *STDOUT }' \
+ -e 'for (1..'$j') { sysseek (*F, $n, 1)' \
+ -e '&& syswrite (*F, "."x$n) or die "$!"}' > j1 || fail=1
+
+ cp --sparse=always j1 j2 || fail=1
+ cmp j1 j2 || fail=1
+ filefrag -v j1 | grep extent \
+ || skip_test_ 'skipping part of this test; you lack filefrag'
+
+ # Here is sample filefrag output:
+ # $ perl -e 'BEGIN{$n=16*1024; *F=*STDOUT}' \
+ # -e 'for (1..5) { sysseek(*F,$n,1)' \
+ # -e '&& syswrite *F,"."x$n or die "$!"}' > j
+ # $ filefrag -v j
+ # File system type is: ef53
+ # File size of j is 163840 (40 blocks, blocksize 4096)
+ # ext logical physical expected length flags
+ # 0 4 6258884 4
+ # 1 12 6258892 6258887 4
+ # 2 20 6258900 6258895 4
+ # 3 28 6258908 6258903 4
+ # 4 36 6258916 6258911 4 eof
+ # j: 6 extents found
+
+ # exclude the physical block numbers; they always differ
+ filefrag -v j1 | awk '/^ / {print $1,$2}' > ff1 || fail=1
+ filefrag -v j2 | awk '/^ / {print $1,$2}' > ff2 || fail=1
+ compare ff1 ff2 || fail=1
+ done
+done
Exit $fail