diff options
Diffstat (limited to 'test/asf/asfframework.py')
-rw-r--r-- | test/asf/asfframework.py | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/test/asf/asfframework.py b/test/asf/asfframework.py index 24880044cec..bd1b45c6476 100644 --- a/test/asf/asfframework.py +++ b/test/asf/asfframework.py @@ -166,25 +166,28 @@ def _is_distro_ubuntu2204(): is_distro_ubuntu2204 = _is_distro_ubuntu2204() -def _is_distro_debian11(): +def _is_distro_ubuntu2404(): with open("/etc/os-release") as f: for line in f.readlines(): - if "bullseye" in line: + if "noble" in line: return True return False -is_distro_debian11 = _is_distro_debian11() +is_distro_ubuntu2404 = _is_distro_ubuntu2404() -def _is_distro_ubuntu2204(): +def _is_distro_debian11(): with open("/etc/os-release") as f: for line in f.readlines(): - if "jammy" in line: + if "bullseye" in line: return True return False +is_distro_debian11 = _is_distro_debian11() + + class KeepAliveReporter(object): """ Singleton object which reports test start to parent process @@ -236,6 +239,8 @@ class TestCaseTag(Enum): FIXME_DEBIAN11 = 5 # marks suites broken on debug vpp image FIXME_VPP_DEBUG = 6 + # marks suites broken on Ubuntu-24.04 + FIXME_UBUNTU2404 = 7 def create_tag_decorator(e): @@ -255,6 +260,7 @@ tag_fixme_asan = create_tag_decorator(TestCaseTag.FIXME_ASAN) tag_fixme_ubuntu2204 = create_tag_decorator(TestCaseTag.FIXME_UBUNTU2204) tag_fixme_debian11 = create_tag_decorator(TestCaseTag.FIXME_DEBIAN11) tag_fixme_vpp_debug = create_tag_decorator(TestCaseTag.FIXME_VPP_DEBUG) +tag_fixme_ubuntu2404 = create_tag_decorator(TestCaseTag.FIXME_UBUNTU2404) class DummyVpp: @@ -317,6 +323,18 @@ class VppAsfTestCase(CPUInterface, unittest.TestCase): cls = unittest.skip("Skipping @tag_fixme_asan tests")(cls) @classmethod + def skip_fixme_ubuntu2204(cls): + """if @tag_fixme_ubuntu2204 & is Ubuntu22.04 - mark for skip""" + if cls.has_tag(TestCaseTag.FIXME_UBUNTU2204) and is_distro_ubuntu2204 == True: + cls = unittest.skip("Skipping @tag_fixme_ubuntu2204 tests")(cls) + + @classmethod + def skip_fixme_ubuntu2404(cls): + """if @tag_fixme_ubuntu2404 & is Ubuntu24.04 - mark for skip""" + if cls.has_tag(TestCaseTag.FIXME_UBUNTU2404) and is_distro_ubuntu2404 == True: + cls = unittest.skip("Skipping @tag_fixme_ubuntu2404 tests")(cls) + + @classmethod def instance(cls): """Return the instance of this testcase""" return cls.test_instance @@ -1155,16 +1173,13 @@ class VppTestResult(unittest.TestResult): self.runner = runner self.printed = [] - def decodePcapFiles(self, test, when_configured=False): - if when_configured == False or config.decode_pcaps == True: - if hasattr(test, "pg_interfaces") and len(test.pg_interfaces) > 0: - testcase_dir = os.path.dirname(test.pg_interfaces[0].out_path) - test.pg_interfaces[0].decode_pcap_files( - testcase_dir, f"suite{test.__class__.__name__}" - ) - test.pg_interfaces[0].decode_pcap_files( - testcase_dir, test._testMethodName - ) + def decodePcapFiles(self, test): + if hasattr(test, "pg_interfaces") and len(test.pg_interfaces) > 0: + testcase_dir = os.path.dirname(test.pg_interfaces[0].out_path) + test.pg_interfaces[0].decode_pcap_files( + testcase_dir, f"suite{test.__class__.__name__}" + ) + test.pg_interfaces[0].decode_pcap_files(testcase_dir, test._testMethodName) def addSuccess(self, test): """ @@ -1174,7 +1189,8 @@ class VppTestResult(unittest.TestResult): """ self.log_result("addSuccess", test) - self.decodePcapFiles(test, when_configured=True) + if "all" == config.decode_pcaps: + self.decodePcapFiles(test) unittest.TestResult.addSuccess(self, test) self.result_string = colorize("OK", GREEN) self.result_code = TestResultCode.PASS @@ -1182,7 +1198,8 @@ class VppTestResult(unittest.TestResult): def addExpectedFailure(self, test, err): self.log_result("addExpectedFailure", test, err) - self.decodePcapFiles(test) + if "none" != config.decode_pcaps: + self.decodePcapFiles(test) super().addExpectedFailure(test, err) self.result_string = colorize("FAIL", GREEN) self.result_code = TestResultCode.EXPECTED_FAIL @@ -1190,7 +1207,8 @@ class VppTestResult(unittest.TestResult): def addUnexpectedSuccess(self, test): self.log_result("addUnexpectedSuccess", test) - self.decodePcapFiles(test, when_configured=True) + if "none" != config.decode_pcaps: + self.decodePcapFiles(test) super().addUnexpectedSuccess(test) self.result_string = colorize("OK", RED) self.result_code = TestResultCode.UNEXPECTED_PASS @@ -1276,7 +1294,9 @@ class VppTestResult(unittest.TestResult): error_type_str = colorize("ERROR", RED) else: raise Exception(f"Unexpected result code {result_code}") - self.decodePcapFiles(test) + + if "none" != config.decode_pcaps: + self.decodePcapFiles(test) unittest_fn(self, test, err) if self.current_test_case_info: @@ -1361,6 +1381,20 @@ class VppTestResult(unittest.TestResult): test_title = colorize(f"FIXME with ASAN: {test_title}", RED) test.skip_fixme_asan() + if ( + test.has_tag(TestCaseTag.FIXME_UBUNTU2204) + and is_distro_ubuntu2204 == True + ): + test_title = colorize(f"FIXME with Ubuntu 22.04: {test_title}", RED) + test.skip_fixme_ubuntu2204() + + if ( + test.has_tag(TestCaseTag.FIXME_UBUNTU2404) + and is_distro_ubuntu2404 == True + ): + test_title = colorize(f"FIXME with Ubuntu 24.04: {test_title}", RED) + test.skip_fixme_ubuntu2404() + if hasattr(test, "vpp_worker_count"): if test.vpp_worker_count == 0: test_title += " [main thread only]" |