|
|
22a545 |
From 8822103e30121d95fa58b5e8b7ce8ce91d4e778e Mon Sep 17 00:00:00 2001
|
|
|
22a545 |
From: Karel Zak <kzak@redhat.com>
|
|
|
22a545 |
Date: Mon, 3 Jun 2019 22:29:51 +0200
|
|
|
22a545 |
Subject: [PATCH] tests: make mount -oloop use more robust
|
|
|
22a545 |
|
|
|
22a545 |
The command creates loop device, so udevd is in the game and it seems
|
|
|
22a545 |
better to wait for him.
|
|
|
22a545 |
|
|
|
22a545 |
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1681062
|
|
|
22a545 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
22a545 |
---
|
|
|
22a545 |
tests/ts/libmount/loop | 4 ++++
|
|
|
22a545 |
tests/ts/libmount/loop-overlay | 11 +++++++++++
|
|
|
22a545 |
2 files changed, 15 insertions(+)
|
|
|
22a545 |
|
|
|
22a545 |
diff --git a/tests/ts/libmount/loop b/tests/ts/libmount/loop
|
|
|
22a545 |
index 090b79fa4..50764781c 100755
|
|
|
22a545 |
--- a/tests/ts/libmount/loop
|
|
|
22a545 |
+++ b/tests/ts/libmount/loop
|
|
|
22a545 |
@@ -65,6 +65,7 @@ ts_finalize_subtest
|
|
|
22a545 |
ts_init_subtest "file-o-loop"
|
|
|
22a545 |
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
udevadm settle
|
|
|
22a545 |
ts_log "Success"
|
|
|
22a545 |
@@ -89,6 +90,7 @@ else
|
|
|
22a545 |
[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT
|
|
|
22a545 |
LODEV=$( $TS_CMD_LOSETUP --find 2>> $TS_OUTPUT )
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+ udevadm settle
|
|
|
22a545 |
verify_mount_dev "$LODEV" "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
$TS_CMD_UMOUNT "$TS_MOUNTPOINT" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
udevadm settle
|
|
|
22a545 |
@@ -122,6 +124,7 @@ ts_init_subtest "o-loop-val-initialized"
|
|
|
22a545 |
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE" 2>>$TS_OUTPUT)
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
|
|
|
22a545 |
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
udevadm settle
|
|
|
22a545 |
ts_log "Success"
|
|
|
22a545 |
@@ -133,6 +136,7 @@ cp "$BACKFILE" "$BACKFILE"-2
|
|
|
22a545 |
LODEV=$( $TS_CMD_LOSETUP --show -f "$BACKFILE"-2 2>> $TS_OUTPUT)
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop=$LODEV "$BACKFILE" "$TS_MOUNTPOINT" 2>&1 \
|
|
|
22a545 |
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' > $TS_OUTPUT
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_LOSETUP --detach $LODEV >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
rm "$BACKFILE"-2
|
|
|
22a545 |
udevadm settle
|
|
|
22a545 |
diff --git a/tests/ts/libmount/loop-overlay b/tests/ts/libmount/loop-overlay
|
|
|
22a545 |
index fffb823c0..1ba6eb06e 100755
|
|
|
22a545 |
--- a/tests/ts/libmount/loop-overlay
|
|
|
22a545 |
+++ b/tests/ts/libmount/loop-overlay
|
|
|
22a545 |
@@ -43,23 +43,34 @@ dd if="$IMG" of="$IMG" oflag=append bs=1024k count=5 conv=notrunc &>/dev/null
|
|
|
22a545 |
|
|
|
22a545 |
echo "second should fail" >>$TS_OUTPUT
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 \
|
|
|
22a545 |
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
|
|
|
22a545 |
echo "should succeed" >>$TS_OUTPUT
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-1" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_UMOUNT "$TS_MOUNTPOINT-2" >> $TS_OUTPUT 2>&1
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
|
|
|
22a545 |
echo "both should fail" >>$TS_OUTPUT
|
|
|
22a545 |
LOOPDEV=$($TS_CMD_LOSETUP --show -f --offset 1 --sizelimit $OFFSET "$IMG")
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop,sizelimit=$OFFSET "$IMG" "$TS_MOUNTPOINT-1" 2>&1 \
|
|
|
22a545 |
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_MOUNT -oloop,offset=$OFFSET "$IMG" "$TS_MOUNTPOINT-2" 2>&1 \
|
|
|
22a545 |
| sed 's/:.*:/: <target>/; s/for .*/for <source>/' >> $TS_OUTPUT
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
$TS_CMD_LOSETUP --detach $LOOPDEV
|
|
|
22a545 |
+udevadm settle
|
|
|
22a545 |
|
|
|
22a545 |
ts_log "Success"
|
|
|
22a545 |
ts_finalize
|
|
|
22a545 |
--
|
|
|
22a545 |
2.21.0
|
|
|
22a545 |
|