summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-12-11 10:25:15 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2016-12-11 23:24:19 +0100
commit56e4e2ce2ba05990eb4e8ced8a9a966b986f14ab (patch)
tree908f854d1e3455264fc4f159f7112b9ae65aa868
parent273ccb11704075b1876f6931e9e8de19ff2b31a3 (diff)
downloadlvm2-56e4e2ce2ba05990eb4e8ced8a9a966b986f14ab.tar.gz
tests: track leaked devices in tests
When test calls teardown, no devices created by test are expected to be left in table. Trap such orphans and make the test fail.
-rw-r--r--test/lib/aux.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 7f3c84ad8..4749f817c 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -520,6 +520,8 @@ teardown() {
if test -f TESTNAME ; then
+ TEST_LEAKED_DEVICES=$(dmsetup table | grep "$PREFIX" | grep -v "${PREFIX}pv") || true
+
kill_tagged_processes
if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then
@@ -567,6 +569,12 @@ teardown() {
fi
+ test -z "$TEST_LEAKED_DEVICES" || {
+ echo "Unexpected devices left dm table:"
+ echo "$TEST_LEAKED_DEVICES"
+ return 1
+ }
+
test -n "$TESTDIR" && {
cd "$TESTOLDPWD"
rm -rf "$TESTDIR" || echo BLA