]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common: skip tests using LVM when the device is no known
authorChristoph Hellwig <hch@lst.de>
Sun, 19 Jan 2025 05:41:52 +0000 (06:41 +0100)
committerChristoph Hellwig <hch@lst.de>
Thu, 30 Jan 2025 05:01:11 +0000 (06:01 +0100)
LVM has a lot of elaborate code to make the users life painful.  This
includes claiming the device type is unknown if it doesn't match it's
elaborately crafted internal list instead of just letting the user use
it.  Skip tests using LVM if this is the case to avoid arcane failures
due to missing lvm devices when using null_blk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
tests/generic/081
tests/generic/108
tests/generic/459

index 37137d937b05ef8f84a10dab293900b8ad49d764..97928bf4a4350a076bcb64d15d715558983c409b 100755 (executable)
@@ -66,7 +66,11 @@ lvsize=$((size * 85 / 100))   # ~256M
 # make sure there's enough disk space for 256M lv, test for 300M here in case
 # lvm uses some space for metadata
 _scratch_mkfs_sized $((size * 1024 * 1024)) >>$seqres.full 2>&1
-$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
+
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1 || \
+       _notrun "LVM is too stupid for this device"
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
 yes | $LVM_PROG lvcreate -L ${lvsize}M -n $lvname $vgname >>$seqres.full 2>&1
index f630450ec66dfbbfd99323297390799157553ee4..4f86ec946511c3575184267b9dd71b02d6544478 100755 (executable)
@@ -51,7 +51,11 @@ test -b "$SCSI_DEBUG_DEV" || _notrun "Failed to initialize scsi debug device"
 echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full
 
 # create striped volume with 4MB stripe size
-$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
+#
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG pvcreate -f $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1 || \
+       _notrun "LVM is too stupid for this device"
 $LVM_PROG vgcreate -f $vgname $SCSI_DEBUG_DEV $SCRATCH_DEV >>$seqres.full 2>&1
 # We use yes pipe instead of 'lvcreate --yes' because old version of lvm
 # (like 2.02.95 in RHEL6) don't support --yes option
index 40c87e20f8b9b10b4f3105cd0dc8a6681fffb25e..3f5f0f2b7dc140b0cbfcb51eb16ad8211f4baa9b 100755 (executable)
@@ -84,7 +84,11 @@ is_shutdown_or_ro()
 _scratch_mkfs_sized $((350 * 1024 * 1024)) >>$seqres.full 2>&1
 
 # Create a 200MB dm-thin POOL
-$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1
+#
+# lvm has a hardcoded list of valid devices and fails with
+# "device type is unknown" for those not in the list like null_blk
+$LVM_PROG pvcreate -f $SCRATCH_DEV >>$seqres.full 2>&1 || \
+       _notrun "LVM is too stupid for this device"
 $LVM_PROG vgcreate -f $vgname $SCRATCH_DEV >>$seqres.full 2>&1
 
 $LVM_PROG lvcreate  --thinpool $poolname  --errorwhenfull y \