master - tests: track leaked devices in tests
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=56e4e2ce2ba05990eb4e8ced8a9a966b986f14ab Commit: 56e4e2ce2ba05990eb4e8ced8a9a966b986f14ab Parent: 273ccb11704075b1876f6931e9e8de19ff2b31a3 Author: Zdenek Kabelac <[email protected]> AuthorDate: Sun Dec 11 10:25:15 2016 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Sun Dec 11 23:24:19 2016 +0100
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.
--- test/lib/aux.sh | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
test/lib/aux.sh +8 -0
@@ -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