xfs: add a _require_xfs_copy helper
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 15 Sep 2020 01:43:59 +0000 (18:43 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Sep 2020 16:53:02 +0000 (00:53 +0800)
Add a _require helper so that tests can ensure that they're running in
the correct environment for xfs_copy to work (no external devices).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs
tests/xfs/032
tests/xfs/073
tests/xfs/077
tests/xfs/284
tests/xfs/503

index eab5e2929a90d7f3799f8ed80397a25b588f32db..f4a47dfb128c2f72f25b40d905ae3f1a72228146 100644 (file)
@@ -945,3 +945,10 @@ _try_wipe_scratch_xfs()
        fi
        rm -f $tmp.mkfs
 }
+
+_require_xfs_copy()
+{
+       [ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
+       [ "$USE_EXTERNAL" = yes ] && \
+               _notrun "Cannot xfs_copy with external devices"
+}
index af18f7557f4725625bd706bd2a30c3e03774589f..8ece957d1e22945c0a23fecc0adb9403e26b21a2 100755 (executable)
@@ -25,9 +25,7 @@ _supported_os Linux
 
 _require_scratch
 _require_test_program "feature"
-
-[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
-[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
+_require_xfs_copy
 
 rm -f $seqres.full
 
index 6939e1027d520e17fc77dac1df0afec95d7dd291..dc0cde4f2f909d27b1b3654e7b0530261f7ba78d 100755 (executable)
@@ -113,10 +113,7 @@ _supported_fs xfs
 _supported_os Linux
 _require_test
 _require_attrs
-
-[ "$USE_EXTERNAL" = yes ] && _notrun "Cannot xfs_copy with external devices"
-[ -n "$XFS_COPY_PROG" ] || _notrun "xfs_copy binary not yet installed"
-
+_require_xfs_copy
 _require_scratch
 _require_loop
 
index 02bcc9f7d8438a6bbe86833987fed4ed4b93d70c..b11b2c07abff235a5995d80370711c8cd97250d4 100755 (executable)
@@ -35,8 +35,7 @@ _cleanup()
 
 _supported_fs xfs
 _supported_os Linux
-# xfs_copy does not support realtime devices
-_require_no_realtime
+_require_xfs_copy
 _require_scratch
 _require_no_large_scratch_dev
 _require_xfs_crc
index 7af77634b51163974ab2fc7ff8f89a6ee308645a..8f997e17325314e8cf85f490cf6c1f243b465384 100755 (executable)
@@ -34,8 +34,7 @@ rm -f $seqres.full
 # real QA test starts here
 _supported_fs xfs
 _supported_os Linux
-# xfs_copy does not support realtime devices
-_require_no_realtime
+_require_xfs_copy
 _require_test
 _require_scratch
 _require_no_large_scratch_dev
index 417543530f57213ad3568a0bf820e4d7968dfd8f..756bcda3a9e69b1d7576ebd9266ddc410a1aa4d0 100755 (executable)
@@ -33,6 +33,7 @@ testdir=$TEST_DIR/test-$seq
 _supported_os Linux
 _supported_fs xfs
 
+_require_xfs_copy
 _require_scratch_nocheck
 _require_populate_commands