From bab3b2bd4c45ae02c08dc0e43d38d3b542946bac Mon Sep 17 00:00:00 2001 From: William Manley Date: Thu, 28 Jun 2018 12:10:13 +0100 Subject: [PATCH] tests: Save corefiles back to tests/ directory if one exists Makes it easier to debug failures from the tests. Closes: #1657 Approved by: cgwalters --- tests/libtest.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/libtest.sh b/tests/libtest.sh index f6b6eb2f..388408df 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -34,6 +34,14 @@ else fi . ${test_srcdir}/libtest-core.sh +save_core() { + if [ -e core ]; then + cp core "$test_srcdir/core" + fi +} + +trap save_core EXIT; + test_tmpdir=$(pwd) # Sanity check that we're in a tmpdir that has