tests: Save corefiles back to tests/ directory if one exists
authorWilliam Manley <will@williammanley.net>
Thu, 28 Jun 2018 11:10:13 +0000 (12:10 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 28 Jun 2018 15:07:14 +0000 (15:07 +0000)
Makes it easier to debug failures from the tests.

Closes: #1657
Approved by: cgwalters

tests/libtest.sh

index f6b6eb2f54829f0fa1002f300a96f46fe18ba335..388408df7150338d92cd00e92b13d19b9f740933 100755 (executable)
@@ -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