mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
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.
This commit is contained in:
parent
273ccb1170
commit
56e4e2ce2b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user