dist: testrunner: optionally print traceback
This commit is contained in:
parent
fa475a6730
commit
9d0881fae5
5
dist/tools/testrunner/testrunner.py
vendored
5
dist/tools/testrunner/testrunner.py
vendored
@ -9,8 +9,9 @@
|
|||||||
|
|
||||||
import os, signal, sys, subprocess
|
import os, signal, sys, subprocess
|
||||||
from pexpect import spawnu, TIMEOUT, EOF
|
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()
|
env = os.environ.copy()
|
||||||
child = spawnu("make term", env=env, timeout=timeout)
|
child = spawnu("make term", env=env, timeout=timeout)
|
||||||
if echo:
|
if echo:
|
||||||
@ -26,6 +27,8 @@ def run(testfunc, timeout=10, echo=True):
|
|||||||
testfunc(child)
|
testfunc(child)
|
||||||
except TIMEOUT:
|
except TIMEOUT:
|
||||||
print("Timeout in expect script")
|
print("Timeout in expect script")
|
||||||
|
if traceback:
|
||||||
|
print_tb(sys.exc_info()[2])
|
||||||
return 1
|
return 1
|
||||||
finally:
|
finally:
|
||||||
print("")
|
print("")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user