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

tests: handle debug.log from clvmd

When clvmd starts, it starts it's own command logging into debug.log.
This is interferring with our other command debug.log.
As as sideeffect we may experience log from command,
followed but lots of zeros and continued with clvmd log.

Fix it by renaming debug.log and now we could also print this trace
to get full list of clvmd activity nicely.

Also improve some post-mortem prints from udevadm and dmsetup to
make the output more usable.
This commit is contained in:
Zdenek Kabelac 2015-04-09 13:13:36 +02:00
parent 073643c9a2
commit 1a7c9ce3bd
3 changed files with 17 additions and 5 deletions

View File

@ -48,9 +48,11 @@ prepare_clvmd() {
for i in $(seq 1 100) ; do
test $i -eq 100 && die "Startup of clvmd is too slow."
test -e "$CLVMD_PIDFILE" && break
test -e "$CLVMD_PIDFILE" -a -e debug.log && break
sleep .2
done
# Keep log of clvmd in separate debug file
mv debug.log clvmddebug.log
}
prepare_dmeventd() {

View File

@ -38,6 +38,9 @@ case "$CMD" in
test ${LVM_DEBUG_LEVEL:-0} -lt 1 && RUN_DBG= ;;
esac
# Capture parallel users of debug.log file
test -z "$(fuser debug.log 2>/dev/null)" || { echo "Test suite problem: \"debug.log\" is still in use!" >&2 ; return 1 ; }
# the exec is important, because otherwise fatal signals inside "not" go unnoticed
if test -n "$abs_top_builddir"; then
exec $RUN_DBG "$abs_top_builddir/tools/lvm" $CMD "$@"

View File

@ -100,6 +100,11 @@ mkdtemp() {
die "$err"
}
# Like grep, just always print 1st. line
grep1_() {
awk -v pattern="${1}" 'NR==1 || $0~pattern' "${@:2}"
}
STACKTRACE() {
trap - ERR
local i=0
@ -129,9 +134,11 @@ STACKTRACE() {
test -z "$LVM_TEST_NODEBUG" -a -f debug.log && {
sed -e "s,^,## DEBUG: ,;s,$top_srcdir/\?,," < debug.log
echo "========= CLVMD debug log ========="
test -e clvmddebug.log && sed -e "s,^,## CLVMD: ,;s,$top_srcdir/\?,," < clvmddebug.log
test -e strace.log && sed -e "s,^,## STRACE: ,;s,$top_srcdir/\?,," < strace.log
echo "========= Info ==========="
dmsetup info -c | grep "$PREFIX"
dmsetup info -c | grep1_ "$PREFIX"
echo "========= Active table ==========="
dmsetup table | grep "$PREFIX"
echo "======== Inactive table =========="
@ -141,9 +148,9 @@ STACKTRACE() {
echo "======== Tree =========="
dmsetup ls --tree
echo "======== Recursive list of $DM_DEV_DIR =========="
ls -Rla "$DM_DEV_DIR"
for i in "/sys/block/dm-* /sys/block/loop*" ; do
udevadm info --export-db "$i" || true
ls -Rl --hide=shm --hide=bus --hide=snd --hide=input "$DM_DEV_DIR"
for i in /sys/block/dm-* /sys/block/loop* ; do
udevadm info -p "$i" || true
done
}