common: add helper require function _require_btrfs_cloner
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 27 May 2014 02:07:36 +0000 (12:07 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 27 May 2014 02:07:36 +0000 (12:07 +1000)
So that the same check (btrfs cloner program presence) can be reused
by other tests.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/rc
tests/btrfs/035

index d1788d1f6df537793b1c00457c92b2b35cdd5f70..f27ee5337e98625b16f9f5bf2f6012087ca37552 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2085,6 +2085,13 @@ _require_fssum()
        [ -x $FSSUM_PROG ] || _notrun "fssum not built"
 }
 
+_require_btrfs_cloner()
+{
+       CLONER_PROG=$here/src/cloner
+       [ -x $CLONER_PROG ] || \
+               _notrun "cloner binary not present at $CLONER_PROG"
+}
+
 # Given 2 files, verify that they have the same mapping but different
 # inodes - i.e. an undisturbed reflink
 # Silent if so, make noise if not
index 6808179a5b37621bbf8993d4b3e445059b65f9e6..dd303af40667b159666d17c4f37c4acc5a33e20d 100755 (executable)
@@ -45,13 +45,11 @@ trap "_cleanup ; exit \$status" 0 1 2 3 15
 _supported_fs btrfs
 _supported_os Linux
 _require_scratch
+_require_btrfs_cloner
 
 _scratch_mkfs > /dev/null 2>&1
 _scratch_mount
 
-CLONER_PROG=$here/src/cloner
-[ -x $CLONER_PROG ] || _notrun "cloner binary not present at $CLONER_PROG"
-
 src_str="aaaaaaaaaa"
 
 echo -n "$src_str" > $SCRATCH_MNT/src