diff mbox series

[10/24] xfs: add a _require_xfs_copy helper

Message ID 160013423963.2923511.3348023490177095472.stgit@magnolia
State Accepted
Headers show
Series fstests: tons of random fixes | expand

Commit Message

Darrick J. Wong Sept. 15, 2020, 1:43 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 common/xfs    |    7 +++++++
 tests/xfs/032 |    4 +---
 tests/xfs/073 |    5 +----
 tests/xfs/077 |    3 +--
 tests/xfs/284 |    3 +--
 tests/xfs/503 |    1 +
 6 files changed, 12 insertions(+), 11 deletions(-)

Comments

Christoph Hellwig Sept. 17, 2020, 7:55 a.m. UTC | #1
On Mon, Sep 14, 2020 at 06:43:59PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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).

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index eab5e292..f4a47dfb 100644
--- a/common/xfs
+++ b/common/xfs
@@ -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"
+}
diff --git a/tests/xfs/032 b/tests/xfs/032
index af18f755..8ece957d 100755
--- a/tests/xfs/032
+++ b/tests/xfs/032
@@ -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
 
diff --git a/tests/xfs/073 b/tests/xfs/073
index 6939e102..dc0cde4f 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -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
 
diff --git a/tests/xfs/077 b/tests/xfs/077
index 02bcc9f7..b11b2c07 100755
--- a/tests/xfs/077
+++ b/tests/xfs/077
@@ -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
diff --git a/tests/xfs/284 b/tests/xfs/284
index 7af77634..8f997e17 100755
--- a/tests/xfs/284
+++ b/tests/xfs/284
@@ -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
diff --git a/tests/xfs/503 b/tests/xfs/503
index 41754353..756bcda3 100755
--- a/tests/xfs/503
+++ b/tests/xfs/503
@@ -33,6 +33,7 @@  testdir=$TEST_DIR/test-$seq
 _supported_os Linux
 _supported_fs xfs
 
+_require_xfs_copy
 _require_scratch_nocheck
 _require_populate_commands