Skip to contentSkip to conversation

master - tests: remove only existing loops

PATCH Zdenek Kabelac 1 participant 1 message Sep 10, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9b8c876293b883f6c84d349d04e20a77facb69d1
Commit:        9b8c876293b883f6c84d349d04e20a77facb69d1
Parent:        e94ab01940828f471a9498f112d2023c3bf06ffd
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Sep 9 09:40:17 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Sep 10 17:28:47 2015 +0200

tests: remove only existing loops

If loop device meanwhile dissapered, skip 'losetup -d' call.

---
 test/lib/aux.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
test/lib/aux.sh +1 -1
index 25700f6..a59f98a 100644
@@ -253,7 +253,7 @@ teardown_devs() {
 		test ${#stray_loops[@]} -eq 0 || {
 			teardown_devs_prefixed "$COMMON_PREFIX" 1
 			echo "Removing stray loop devices containing $COMMON_PREFIX: ${stray_loops[@]}"
-			for i in "${stray_loops[@]}" ; do losetup -d $i ; done
+			for i in "${stray_loops[@]}" ; do test ! -f $i || losetup -d $i ; done
 			# Leave test when udev processed all removed devices
 			udev_wait
 		}