summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-06-19 10:29:24 -0400
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-06-25 11:26:08 +0000
commit5dd6a7b29f23b89aaad4fdaba0579ca5b37d7929 (patch)
tree022629af8673c454165d733a1f00b28a9f516294 /test/framework.py
parent08d82e98cdf75c810659fcb347e89198cf7b0bc5 (diff)
tests: if vpp is dead, specify the test name in the output
'Exception: VPP is dead when setting up the test' is more helpful with the test info. Type: test Change-Id: I6a262fdcf2ecb33aae17bef3d19745053a0bade8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/framework.py b/test/framework.py
index 00fee86e9b0..79dfe1ae866 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -76,15 +76,24 @@ class VppDiedError(Exception):
signals_by_value = {v: k for k, v in signal.__dict__.items() if
k.startswith('SIG') and not k.startswith('SIG_')}
- def __init__(self, rv=None):
+ def __init__(self, rv=None, testcase=None, method_name=None):
self.rv = rv
self.signal_name = None
+ self.testcase = testcase
+ self.method_name = method_name
+
try:
self.signal_name = VppDiedError.signals_by_value[-rv]
except KeyError:
pass
- msg = "VPP subprocess died unexpectedly with return code: %d%s." % (
+ if testcase is None and method_name is None:
+ in_msg = ''
+ else:
+ in_msg = 'running %s.%s ' % (testcase, method_name)
+
+ msg = "VPP subprocess died %sunexpectedly with return code: %d%s." % (
+ in_msg,
self.rv,
' [%s]' % self.signal_name if
self.signal_name is not None else '')
@@ -672,7 +681,10 @@ class VppTestCase(unittest.TestCase):
super(VppTestCase, self).setUp()
self.reporter.send_keep_alive(self)
if self.vpp_dead:
- raise Exception("VPP is dead when setting up the test")
+ raise VppDiedError(self.__class__.__name__, self._testMethodName,
+ "VPP is dead when setting up the test "
+ "(%s.%s)." % (self.__class__.__name__,
+ self._testMethodName))
self.sleep(.1, "during setUp")
self.vpp_stdout_deque.append(
"--- test setUp() for %s.%s(%s) starts here ---\n" %