Blame SOURCES/0022-tests-make-mount-oloop-use-more-robust.patch

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