master - tests: fix detection of running dmeventd after test
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5a91b0a2e24dca07441aefb09fcaccaf98088a03 Commit: 5a91b0a2e24dca07441aefb09fcaccaf98088a03 Parent: d9ef564e42390e290241ec3a2e3988c1067a0139 Author: Zdenek Kabelac <[email protected]> AuthorDate: Wed Jul 12 13:38:07 2017 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Jul 12 13:38:07 2017 +0200
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.
--- test/lib/aux.sh | 11 +++++++---- test/lib/utils.sh | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-)
test/lib/aux.sh +7 -4
@@ -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() {
test/lib/utils.sh +5 -5
@@ -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