1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

tests: fix detection of running dmeventd after test

The checking order here has happend after TESTDIR was removed
resulting in weird further error on trap path.

Properly check for unexpected dmeventd before removing TESTDIR
since  'trap' codepath is still using it.

Also try to kill this unexpected dmeventd so testing is
not skipping all next  dmeventd tests.

(Downside would be - if user would be accidentally starting
dmeventd by some regular system admin work - such dmeventd
might be killd if it's unused. It can't kill dmeventd in-use.
This commit is contained in:
Zdenek Kabelac 2017-07-12 13:38:07 +02:00
parent d9ef564e42
commit 5a91b0a2e2
2 changed files with 12 additions and 9 deletions

View File

@ -589,16 +589,19 @@ teardown() {
return 1
}
if test "${LVM_TEST_PARALLEL:-0}" = 0 && test -z "$RUNNING_DMEVENTD"; then
not pgrep dmeventd &>/dev/null # printed in STACKTRACE
fi
echo -n .
test -n "$TESTDIR" && {
cd "$TESTOLDPWD" || die "Failed to enter $TESTOLDPWD"
# after this delete no further write is possible
rm -rf "$TESTDIR" || echo BLA
}
echo "ok"
if test "${LVM_TEST_PARALLEL:-0}" = 1 || test -n "$RUNNING_DMEVENTD"; then
not pgrep dmeventd #&>/dev/null
fi
}
prepare_loop() {

View File

@ -124,10 +124,11 @@ STACKTRACE() {
stacktrace
test "${LVM_TEST_PARALLEL:-0}" -eq 1 -o -n "$RUNNING_DMEVENTD" -o -f LOCAL_DMEVENTD || {
pgrep dmeventd &>/dev/null && \
die "ERROR: The test started dmeventd unexpectedly."
}
test "${LVM_TEST_PARALLEL:-0}" -eq 0 && test -z "$RUNNING_DMEVENTD" && \
test ! -f LOCAL_DMEVENTD && pgrep dmeventd >DPID 2>/dev/null && {
echo "## ERROR: The test started dmeventd ($(< DPID)) unexpectedly."
kill "$(< DPID)"
}
# Get backtraces from coredumps
if which gdb &>/dev/null; then
@ -143,7 +144,6 @@ STACKTRACE() {
sed -e "s,.*generated by \`\([^ ']*\).*,\1,") || continue
gdb -batch -c "$i" -x gdb_commands.txt "$(which "$bin")" || continue
done
rm -f gdb_commands.txt
fi
test -f SKIP_THIS_TEST && exit 200