From 36fc62ab817d9610c91065d78598d7a4f579aca0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 26 May 2016 15:25:25 +0930 Subject: [PATCH] test: add --crash option to cause nodes to crash dump on test failure. This causes full logs to be dropped in "crash.log". Signed-off-by: Rusty Russell --- daemon/test/test.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/daemon/test/test.sh b/daemon/test/test.sh index 450728a87..6a17d928d 100755 --- a/daemon/test/test.sh +++ b/daemon/test/test.sh @@ -63,6 +63,9 @@ while [ $# != 0 ]; do ;; x"--normal") ;; + x"--crash") + CRASH_ON_FAIL=1 + ;; x"--verbose") VERBOSE=1 ;; @@ -213,7 +216,11 @@ all_ok() exit 0 } -trap "echo Results in $DIR1 and $DIR2 >&2; cat $DIR1/errors $DIR2/errors >&2" EXIT +if [ -n "$CRASH_ON_FAIL" ]; then + trap "$LCLI1 dev-crash 2>/dev/null || true; $LCLI2 dev-crash 2>/dev/null || true; echo Crash results in $DIR1 and $DIR2 >&2; cat $DIR1/errors $DIR2/errors >&2" EXIT +else + trap "echo Results in $DIR1 and $DIR2 >&2; cat $DIR1/errors $DIR2/errors >&2" EXIT +fi mkdir $DIR1 $DIR2 if [ -n "$MANUALCOMMIT" ]; then