1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-04-01 18:50:41 +03:00

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).
This commit is contained in:
Zdenek Kabelac 2015-10-06 14:55:24 +02:00
parent ded9452174
commit 277dd0aa7a

View File

@ -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}"