diff options
author | juraj.linkes <juraj.linkes@pantheon.tech> | 2018-12-13 11:10:47 +0100 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-12-14 19:46:42 +0000 |
commit | 2eca70db953c21d2cb797ad7a172e9b1c0ccd299 (patch) | |
tree | 3c62fad03c7357db8e861386878d9aa04d24e3e4 /test/run_tests.py | |
parent | ac475f4bf4d10ae603f57a406ef607f0de840328 (diff) |
Fix test results
In a rare case a failure can occur in a VppTestCase which hasn't been
part of the original TestSuite, such as in memif testcases. Fix the
reporting after test run in these cases.
Change-Id: Ib2a34fc195179605c22b95bd0e2c7cebca17012f
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'test/run_tests.py')
-rw-r--r-- | test/run_tests.py | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/test/run_tests.py b/test/run_tests.py index f5d5211078e..0af57ac46b8 100644 --- a/test/run_tests.py +++ b/test/run_tests.py @@ -87,33 +87,37 @@ class TestResult(dict): return suite_from_failed(self.testcase_suite, rerun_ids) def get_testcase_names(self, test_id): - if re.match(r'.+\..+\..+', test_id): + # could be tearDownClass (test_ipsec_esp.TestIpsecEsp1) + setup_teardown_match = re.match( + r'((tearDownClass)|(setUpClass)) \((.+\..+)\)', test_id) + if setup_teardown_match: + test_name, _, _, testcase_name = setup_teardown_match.groups() + if len(testcase_name.split('.')) == 2: + for key in self.testcases_by_id.keys(): + if key.startswith(testcase_name): + testcase_name = key + break + testcase_name = self._get_testcase_doc_name(testcase_name) + else: test_name = self._get_test_description(test_id) testcase_name = self._get_testcase_doc_name(test_id) - else: - # could be tearDownClass (test_ipsec_esp.TestIpsecEsp1) - setup_teardown_match = re.match( - r'((tearDownClass)|(setUpClass)) \((.+\..+)\)', test_id) - if setup_teardown_match: - test_name, _, _, testcase_name = setup_teardown_match.groups() - if len(testcase_name.split('.')) == 2: - for key in self.testcases_by_id.keys(): - if key.startswith(testcase_name): - testcase_name = key - break - testcase_name = self._get_testcase_doc_name(testcase_name) - else: - test_name = test_id - testcase_name = test_id return testcase_name, test_name def _get_test_description(self, test_id): - return get_test_description(descriptions, - self.testcases_by_id[test_id]) + if test_id in self.testcases_by_id: + desc = get_test_description(descriptions, + self.testcases_by_id[test_id]) + else: + desc = test_id + return desc def _get_testcase_doc_name(self, test_id): - return get_testcase_doc_name(self.testcases_by_id[test_id]) + if test_id in self.testcases_by_id: + doc_name = get_testcase_doc_name(self.testcases_by_id[test_id]) + else: + doc_name = test_id + return doc_name def test_runner_wrapper(suite, keep_alive_pipe, stdouterr_queue, |