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 eab5e29..f4a47df 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 af18f75..8ece957 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 6939e10..dc0cde4 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 02bcc9f..b11b2c0 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 7af7763..8f997e1 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 4175435..756bcda 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