From 15bd6a29b91d3b733d7f4c064479897182de8eff Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 12 May 2010 11:23:16 +0000 Subject: [PATCH] Revert the "repeat failed tests with -vvvv" feature. Instead, dump debug logs to a file using log/file, with log/overwrite set and dump this file in STACKTRACE. The overall effect is that only the command that ran last before the failure has been triggered will get its debug output logged. This is similar to how we treat coredumps. --- test/Makefile.in | 1 + test/harness.c | 9 --------- test/t-lvconvert-repair-dmeventd.sh | 2 +- test/test-utils.sh | 11 +++++++++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/test/Makefile.in b/test/Makefile.in index 9bd8b0bdd..fecb614e2 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -84,6 +84,7 @@ init.sh: $(srcdir)/Makefile.in .bin-dir-stamp bin/not bin/check bin/harness $(SC LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/mirror"; \ LDLPATH="$$LDLPATH:\$$abs_top_builddir/daemons/dmeventd/plugins/snapshot"; \ echo "export LD_LIBRARY_PATH=\"$$LDLPATH\"" >> $@-t + echo 'top_srcdir=$(top_srcdir)' >> $@-t echo 'abs_srcdir=$(abs_srcdir)' >> $@-t echo 'abs_builddir=$(abs_builddir)' >> $@-t echo 'export PATH' >> $@-t diff --git a/test/harness.c b/test/harness.c index dc53196a4..cbf7ed3b1 100644 --- a/test/harness.c +++ b/test/harness.c @@ -20,7 +20,6 @@ struct stats { }; struct stats s; -struct stats backup; char *readbuf = NULL; int readbuf_sz = 0, readbuf_used = 0; @@ -142,7 +141,6 @@ void run(int i, char *f) { int main(int argc, char **argv) { int i; - int repeat = getenv("LVM_TEST_NOVERBOSE") ? 0 : 1; if (argc >= MAX) { fprintf(stderr, "Sorry, my head exploded. Please increase MAX.\n"); @@ -178,13 +176,6 @@ int main(int argc, char **argv) { run(i, argv[i]); if (die) break; - if ( repeat && s.status[i] == FAILED ) { - backup = s; - setenv("LVM_TEST_CONFIG", config_debug, 1); - run(i, argv[i]); - setenv("LVM_TEST_CONFIG", config, 1); - s = backup; - } } printf("\n## %d tests: %d OK, %d warnings, %d failures; %d skipped\n", diff --git a/test/t-lvconvert-repair-dmeventd.sh b/test/t-lvconvert-repair-dmeventd.sh index c000216db..27744bf35 100644 --- a/test/t-lvconvert-repair-dmeventd.sh +++ b/test/t-lvconvert-repair-dmeventd.sh @@ -20,7 +20,7 @@ lvcreate -m 3 --ig -L 1 -n 4way $vg lvchange --monitor y $vg/4way disable_dev $dev2 $dev4 mkfs.ext2 $DM_DEV_DIR/$vg/4way -sleep 3 # FIXME : - ( +sleep 3 # FIXME: need a "poll" utility, akin to "check" enable_dev $dev2 $dev4 check mirror $vg 4way check mirror_legs $vg 4way 2 diff --git a/test/test-utils.sh b/test/test-utils.sh index e85717920..0bfa701ab 100644 --- a/test/test-utils.sh +++ b/test/test-utils.sh @@ -17,23 +17,27 @@ aux() { STACKTRACE() { trap - ERR; i=0; + while FUNC=${FUNCNAME[$i]}; test "$FUNC" != "main"; do echo "$i ${FUNC}() called from ${BASH_SOURCE[$i]}:${BASH_LINENO[$i]}" i=$(($i + 1)); done # Get backtraces from coredumps - TEST_LVM_BINARY=$(dirname $(which lvm))/../../tools/lvm if which gdb >& /dev/null; then echo bt full > gdb_commands.txt echo l >> gdb_commands.txt echo quit >> gdb_commands.txt - for core in core*; do + for core in `ls core* 2>/dev/null`; do bin=$(gdb -batch -c $core 2>&1 | grep "generated by" | \ sed -e "s,.*generated by \`\([^ ']*\).*,\1,") gdb -batch -c $core -x gdb_commands.txt `which $bin` done fi + + test -f debug.log && { + sed -e "s,^,## DEBUG: ,;s,$top_srcdir/\?,," < debug.log + } } init_udev_transaction() { @@ -367,6 +371,9 @@ prepare_lvmconf() { log { syslog = 0 indent = 1 + level = 4 + file = "$TESTDIR/debug.log" + overwrite = 1 } backup { backup = 0 -- 2.43.5