1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: improve tracing messages

Avoid printing lvm2 command trace, if the test finds the 'dmeventd'
was started unxpectedly during testing as the last command is hardly
ever responsible for this

Also reorder some messages when doing teardown of devices.

Do not print 'help' message from hostname command, when it does
not support option '-I'.
This commit is contained in:
Zdenek Kabelac 2024-11-11 22:17:05 +01:00
parent 7b9bdcb4d4
commit 270f9306bc
3 changed files with 16 additions and 10 deletions

View File

@ -430,8 +430,13 @@ teardown_devs_prefixed() {
local force="-f"
if test "$i" = 0; then
if test "$once" = 1 ; then
case "$DM_NAME" in
*pv[0-9]*) ;; # do not report removal of our own PVs
*)
once=0
echo "## removing stray mapped devices with names beginning with $prefix: "
;;
esac
fi
test "$DM_OPEN" = 0 || break # stop loop with 1st. opened device
force=""
@ -607,9 +612,9 @@ teardown() {
echo -n .
test -d "$DM_DEV_DIR/mapper" && teardown_devs
echo "ok"
echo -n .
test -d "$DM_DEV_DIR/mapper" && teardown_devs
fi
@ -620,11 +625,10 @@ teardown() {
}
if test "${LVM_TEST_PARALLEL:-0}" = 0 && test -z "$RUNNING_DMEVENTD"; then
rm -f debug.log* # no trace of lvm2 command for this case
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
@ -641,6 +645,8 @@ teardown() {
LEAKED_LINKS=( $(find /dev -path "/dev/mapper/${PREFIX}*" -type l -exec test ! -e {} \; -print -o \
-path "/dev/${PREFIX}*/" -type l -exec test ! -e {} \; -print 2>/dev/null || true) )
test "${#LEAKED_LINKS[@]}" -eq 0 || echo "## removing stray symlinks the names beginning with ${PREFIX}"
if test "${LVM_TEST_PARALLEL:-0}" = 0 ; then
# for non parallel testing erase any dangling links prefixed with LVMTEST
find /dev -path "/dev/mapper/${COMMON_PREFIX}*" -type l -exec test ! -e {} \; -print0 -o \
@ -656,8 +662,6 @@ teardown() {
# Fail test with leaked links as most likely somewhere is missing synchronization...
test "${#LEAKED_LINKS[@]}" -eq 0 || die "Test leaked these symlinks ${LEAKED_LINKS[@]}"
echo "ok"
}
prepare_loop() {

View File

@ -176,7 +176,9 @@ echo "@PREFIX=$PREFIX"
echo "## DATE: $(date || true)"
# Hostname IP address
echo "## HOST: $(hostname -I 2>/dev/null || hostname 2>/dev/null || true)"
HOSTNAME=$(hostname -I 2>/dev/null) || HOSTNAME=
HOSTNAME="$(hostname 2>/dev/null) ${HOSTNAME}" || true
echo "## HOST: $HOSTNAME"
if test -z "$SKIP_ROOT_DM_CHECK" ; then
aux lvmconf

View File

@ -128,9 +128,9 @@ STACKTRACE() {
stacktrace
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)"
test ! -f LOCAL_DMEVENTD && DPID=$(pgrep -n dmeventd 2>/dev/null) && {
echo "## ERROR: The test started dmeventd ($DPID) unexpectedly."
kill "$DPID" 2>/dev/null || echo "## ERROR: Failed to kill dmeventd ($DPID)."
}
# Get backtraces from coredumps