summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-03-12 18:16:10 +0100
committerNeale Ranns <neale@graphiant.com>2021-03-15 12:42:29 +0000
commit79a31db11d677bec5b55f81fd0598197644ee216 (patch)
treefbdbc5c6748c52504146b48578c1e41830980341 /test
parent45723b8d305c7c6d034e16fcbf1904fd72dd6bb2 (diff)
tests: fix NoneType printing if VPP died early
Make error message more meaningful. Type: fix Change-Id: I3c49cb179c3ee7a59657b3ae9a06311f57dc52ac Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/framework.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/test/framework.py b/test/framework.py
index 4d0f45621b4..4ccbc454b5b 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -106,13 +106,16 @@ class VppDiedError(Exception):
if testcase is None and method_name is None:
in_msg = ''
else:
- in_msg = 'running %s.%s ' % (testcase, method_name)
+ in_msg = ' while running %s.%s' % (testcase, method_name)
+
+ if self.rv:
+ msg = "VPP subprocess died unexpectedly%s with return code: %d%s."\
+ % (in_msg, self.rv, ' [%s]' %
+ (self.signal_name if
+ self.signal_name is not None else ''))
+ else:
+ msg = "VPP subprocess died unexpectedly%s." % in_msg
- 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 ''))
super(VppDiedError, self).__init__(msg)
@@ -1191,8 +1194,8 @@ class VppTestCase(unittest.TestCase):
after - before, timeout)
cls.logger.debug(
- "Finished sleep (%s) - slept %es (wanted %es)",
- remark, after - before, timeout)
+ "Finished sleep (%s) - slept %es (wanted %es)",
+ remark, after - before, timeout)
def pg_send(self, intf, pkts, worker=None, trace=True):
intf.add_stream(pkts, worker=worker)
@@ -1332,13 +1335,13 @@ class VppTestResult(unittest.TestResult):
os.path.basename(self.current_test_case_info.tempdir))
self.current_test_case_info.logger.debug(
- "creating a link to the failed test")
+ "creating a link to the failed test")
self.current_test_case_info.logger.debug(
- "os.symlink(%s, %s)" %
- (self.current_test_case_info.tempdir, link_path))
+ "os.symlink(%s, %s)" %
+ (self.current_test_case_info.tempdir, link_path))
if os.path.exists(link_path):
self.current_test_case_info.logger.debug(
- 'symlink already exists')
+ 'symlink already exists')
else:
os.symlink(self.current_test_case_info.tempdir, link_path)