Try to get automatic backtraces when unit tests crash.
authorCarl Hetherington <cth@carlh.net>
Sat, 14 Oct 2017 21:12:04 +0000 (22:12 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 14 Oct 2017 21:12:04 +0000 (22:12 +0100)
cscript

diff --git a/cscript b/cscript
index 519e0d8069634d30b6309f2adfb4a8f916dbc6f7..28be96c7555575f2e803297c7551ef09b1d8fb7e 100644 (file)
--- a/cscript
+++ b/cscript
@@ -452,9 +452,11 @@ def make_manual(target):
 def test(target, test):
     if target.platform != 'windows':
         target.set('LC_ALL', 'C')
-        cmd = 'run/tests '
-        if target.debug:
-            cmd += '--backtrace '
+        base = 'run/tests '
         if test is not None:
-            cmd += '--run_test=%s' % test
+            base += '--run_test=%s' % test
+        if target.debug:
+            cmd = 'gdb -batch -ex "run" -ex "bt" "%s" 2>&1 | grep -v ^"No stack."' % base
+        else:
+            cmd = base
         target.command(cmd)