On 24/02/11 10:05, Jim Meyering wrote:
> That looks fine, but I'd drop the use of -F,
> since it's just an optimization in this case, and
> probably not portable to some crufty targets.
> 
> Hmm.. but I see uses of grep -F in other tests and
> even in bootstrap, so maybe it's not a problem, these days:
> 
>     $ git grep -l grep.-F
>     bootstrap
>     tests/cp/cp-mv-enotsup-xattr
>     tests/cp/fiemap-perf
>     tests/misc/xattr

I did base the use on bootstrap and so decided it's OK.
This prompted me to look at the skipping in cp/sparse-fiemap
which didn't match the comment at least. Fixed with the attached.

cheers,
Pádraig.
>From e0341fbf15d2ff6292718e1bb80326551dcb177b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 24 Feb 2011 10:25:52 +0000
Subject: [PATCH] tests: without filefrag, only skip part of sparse-fiemap

* tests/cp/sparse-fiemap: don't use skip_test_ which will
exit the test completely.
---
 tests/cp/sparse-fiemap |   51 ++++++++++++++++++++++++-----------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/tests/cp/sparse-fiemap b/tests/cp/sparse-fiemap
index 4eced1d..3046046 100755
--- a/tests/cp/sparse-fiemap
+++ b/tests/cp/sparse-fiemap
@@ -78,32 +78,33 @@ for i in $(seq 1 2 21); do
     dd if=/dev/null of=j2 conv=notrunc,fdatasync
 
     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 > ff1 || fail=1
-    filefrag -v j2 > ff2 || fail=1
-    { f ff1; f ff2; } \
-      | $PERL $abs_top_srcdir/tests/filefrag-extent-compare \
-        || { fail=1; break; }
+    if ! filefrag -v j1 | grep -F extent >/dev/null; then
+      test $skip != 1 && warn_ 'skipping part; you lack filefrag'
+      skip=1
+    else
+      # 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 > ff1 || framework_failure
+      filefrag -v j2 > ff2 || framework_failure
+      { f ff1; f ff2; } | $PERL $abs_top_srcdir/tests/filefrag-extent-compare ||
+        fail=1
+    fi
+    test $fail = 1 && break 2
   done
-  test $fail = 1 && break
 done
 
 Exit $fail
-- 
1.7.4

Reply via email to