diff mbox series

fstests: check if the scratch device is an lv device for certain tests

Message ID e8889f411f37867d3740f623508fd2d3415b63ba.1636751413.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series fstests: check if the scratch device is an lv device for certain tests | expand

Commit Message

Josef Bacik Nov. 12, 2021, 9:10 p.m. UTC
I use lvm to carve up a large disk so I can run the btrfs raid related xfstests.
However this messes with tests that try to greate lvm devices ontop of
SCRATCH_DEV.  Handle this by adding a _require_scratch_nolvm helper to skip
tests that are going to try and create lvm devices.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 common/rc         | 11 +++++++++++
 tests/generic/081 |  2 +-
 tests/generic/108 |  2 +-
 tests/generic/459 |  2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 0d261184..c0fb11c6 100644
--- a/common/rc
+++ b/common/rc
@@ -1676,6 +1676,17 @@  _require_scratch_nocheck()
     rm -f ${RESULT_DIR}/require_scratch
 }
 
+# we need the scratch device and it needs to not be an lvm device
+_require_scratch_nolvm()
+{
+	_require_scratch_nocheck
+
+	# This works if we don't have LVM, all we want is to skip if the scratch
+	# device is an lvm device.
+	$LVM_PROG lvdisplay $SCRATCH_DEV > /dev/null 2>&1
+	[ $? -eq 0 ] && _notrun "test requires a non-lvm scratch device"
+}
+
 # we need the scratch device and it should be checked post test.
 _require_scratch()
 {
diff --git a/tests/generic/081 b/tests/generic/081
index 9f294c11..22ac94de 100755
--- a/tests/generic/081
+++ b/tests/generic/081
@@ -50,7 +50,7 @@  _cleanup()
 # real QA test starts here
 _supported_fs generic
 _require_test
-_require_scratch_nocheck
+_require_scratch_nolvm
 _require_dm_target snapshot
 _require_command $LVM_PROG lvm
 
diff --git a/tests/generic/108 b/tests/generic/108
index 6e1ea5b9..ad43269f 100755
--- a/tests/generic/108
+++ b/tests/generic/108
@@ -32,7 +32,7 @@  _cleanup()
 
 # real QA test starts here
 _supported_fs generic
-_require_scratch_nocheck
+_require_scratch_nolvm
 _require_block_device $SCRATCH_DEV
 _require_scsi_debug
 _require_command "$LVM_PROG" lvm
diff --git a/tests/generic/459 b/tests/generic/459
index 5b44e245..cda19e6e 100755
--- a/tests/generic/459
+++ b/tests/generic/459
@@ -39,7 +39,7 @@  _cleanup()
 # This tests for filesystem lockup not consistency, so don't check for fs
 # consistency after test
 _supported_fs generic
-_require_scratch_nocheck
+_require_scratch_nolvm
 _require_dm_target thin-pool
 _require_dm_target snapshot
 _require_command $LVM_PROG lvm