summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/functions.sh12
-rwxr-xr-xtests/ts-cramfs-mkfs10
-rwxr-xr-xtests/ts-mkswap-doit10
3 files changed, 18 insertions, 14 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 86abfb4e9..6c0658b1b 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -99,4 +99,16 @@ function ts_device_deinit {
rm -f "$IMAGE" &> /dev/null
fi
}
+
+function ts_udev_loop_support {
+ ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT
+ if [ "$?" == "0" ]; then
+ HAS_VOLUMEID="yes"
+ fi
+ if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$1" ]; then
+ return 1
+ fi
+ return 0
+}
+
diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs
index c1f46f116..715f575c0 100755
--- a/tests/ts-cramfs-mkfs
+++ b/tests/ts-cramfs-mkfs
@@ -36,11 +36,6 @@ IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' )
LABEL="testCramfs"
MOUNTPOINT="$TS_OUTDIR/cramfs-mnt"
-ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT
-if [ "$?" == "0" ]; then
- HAS_VOLUMEID="yes"
-fi
-
echo "create mountpoint dir" >> $TS_OUTPUT
if [ ! -d "$MOUNTPOINT" ]; then
mkdir -p $MOUNTPOINT
@@ -85,8 +80,9 @@ if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "cramfs" ]; then
ts_finalize
fi
-if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then
- $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT
+ts_udev_loop_support $LABEL
+if [ "$?" != "0" ]; then
+ ts_device_deinit;
ts_skip "udev ignores /dev/loop*"
fi
diff --git a/tests/ts-mkswap-doit b/tests/ts-mkswap-doit
index cd567cf32..600acbac7 100755
--- a/tests/ts-mkswap-doit
+++ b/tests/ts-mkswap-doit
@@ -32,11 +32,6 @@ touch $TS_OUTPUT
LABEL="testSwap"
-ldd $TS_CMD_SWAPON | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT
-if [ "$?" == "0" ]; then
- HAS_VOLUMEID="yes"
-fi
-
ts_device_init || ts_finalize
$TS_CMD_MKSWAP -L $LABEL $DEVICE 2>&1 >> $TS_OUTPUT
@@ -47,8 +42,9 @@ if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "swap" ]; then
ts_finalize
fi
-if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then
- ts_device_deinit
+ts_udev_loop_support $LABEL
+if [ "$?" != "0" ]; then
+ ts_device_deinit;
ts_skip "udev ignores /dev/loop*"
fi