Skip to contentSkip to conversation

master - tests: check devices with prefix aren't in use

PATCH Zdenek Kabelac 1 participant 1 message Oct 6, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=277dd0aa7a9013697ae99164900d8d8ec12a2850
Commit:        277dd0aa7a9013697ae99164900d8d8ec12a2850
Parent:        ded9452174664b7e204f5ce266bbd5c770714474
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Oct 6 14:55:24 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Oct 6 15:23:55 2015 +0200

tests: check devices with prefix aren't in use

Avoid running tests, when prefix already exist in the system. As prefix just uses PID number, we may hit a case for long running tests, where devices from some previous runs were not properly cleared away - detect this and fail early. (Such machine should be inspected and fixed).

---
 test/lib/inittest.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
test/lib/inittest.sh +3 -0
index a5eeb57..4ed8d20 100644
@@ -29,6 +29,9 @@ TESTOLDPWD=$(pwd)
 COMMON_PREFIX="LVMTEST"
 PREFIX="${COMMON_PREFIX}$$"
 
+# Check we are not conflickting with some exiting setup
+dmsetup table | not grep "$PREFIX" || die "DM table already has devices with prefix $PREFIX!"
+
 if test -z "$LVM_TEST_DIR"; then LVM_TEST_DIR=$TMPDIR; fi
 TESTDIR=$(mkdtemp "${LVM_TEST_DIR:-/tmp}" "$PREFIX.XXXXXXXXXX") || \
 	die "failed to create temporary directory in ${LVM_TEST_DIR:-$TESTOLDPWD}"