From 9d0881fae513daaa8eaff55d78d4fc4b37dbd38a Mon Sep 17 00:00:00 2001
From: Martine Lenders <mail@martine-lenders.eu>
Date: Fri, 8 Apr 2016 22:39:49 +0200
Subject: [PATCH] dist: testrunner: optionally print traceback

---
 dist/tools/testrunner/testrunner.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dist/tools/testrunner/testrunner.py b/dist/tools/testrunner/testrunner.py
index 2eff14e239..f36da3bbea 100755
--- a/dist/tools/testrunner/testrunner.py
+++ b/dist/tools/testrunner/testrunner.py
@@ -9,8 +9,9 @@
 
 import os, signal, sys, subprocess
 from pexpect import spawnu, TIMEOUT, EOF
+from traceback import print_tb
 
-def run(testfunc, timeout=10, echo=True):
+def run(testfunc, timeout=10, echo=True, traceback=False):
     env = os.environ.copy()
     child = spawnu("make term", env=env, timeout=timeout)
     if echo:
@@ -26,6 +27,8 @@ def run(testfunc, timeout=10, echo=True):
         testfunc(child)
     except TIMEOUT:
         print("Timeout in expect script")
+        if traceback:
+            print_tb(sys.exc_info()[2])
         return 1
     finally:
         print("")
-- 
GitLab