X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=test%2Fframework.py;h=4d0f45621b4ecca86b49bc0cf28d79e7ff6a8d20;hb=8c45e5109522cf9bbc98785283cd4c923f486fe6;hp=7ab5b453b8e06f5fbebe84d06f7595133404d266;hpb=06f328129a01276858fff1086215478fa106dd8e;p=vpp.git diff --git a/test/framework.py b/test/framework.py index 7ab5b453b8e..4d0f45621b4 100644 --- a/test/framework.py +++ b/test/framework.py @@ -257,7 +257,11 @@ class KeepAliveReporter(object): class TestCaseTag(Enum): + # marks the suites that must run at the end + # using only a single test runner RUN_SOLO = 1 + # marks the suites broken on VPP multi-worker + FIXME_VPP_WORKERS = 2 def create_tag_decorator(e): @@ -269,7 +273,9 @@ def create_tag_decorator(e): return cls return decorator + tag_run_solo = create_tag_decorator(TestCaseTag.RUN_SOLO) +tag_fixme_vpp_workers = create_tag_decorator(TestCaseTag.FIXME_VPP_WORKERS) class VppTestCase(unittest.TestCase): @@ -398,7 +404,10 @@ class VppTestCase(unittest.TestCase): cpu_core_number = cls.get_least_used_cpu() if not hasattr(cls, "worker_config"): - cls.worker_config = "" + cls.worker_config = os.getenv("VPP_WORKER_CONFIG", "") + if cls.worker_config != "": + if cls.has_tag(TestCaseTag.FIXME_VPP_WORKERS): + cls.worker_config = "" default_variant = os.getenv("VARIANT") if default_variant is not None: @@ -670,6 +679,8 @@ class VppTestCase(unittest.TestCase): cls.vpp.communicate() cls.logger.debug("Deleting class vpp attribute on %s", cls.__name__) + cls.vpp.stdout.close() + cls.vpp.stderr.close() del cls.vpp if cls.vpp_startup_failed: @@ -813,9 +824,11 @@ class VppTestCase(unittest.TestCase): cls.sleep(0.1) @classmethod - def pg_start(cls): + def pg_start(cls, trace=True): """ Enable the PG, wait till it is done, then clean up """ - cls.vapi.cli("trace add pg-input 1000") + if trace: + cls.vapi.cli("clear trace") + cls.vapi.cli("trace add pg-input 1000") cls.vapi.cli('packet-generator enable') # PG, when starts, runs to completion - # so let's avoid a race condition, @@ -1181,11 +1194,10 @@ class VppTestCase(unittest.TestCase): "Finished sleep (%s) - slept %es (wanted %es)", remark, after - before, timeout) - def pg_send(self, intf, pkts, worker=None): - self.vapi.cli("clear trace") + def pg_send(self, intf, pkts, worker=None, trace=True): intf.add_stream(pkts, worker=worker) self.pg_enable_capture(self.pg_interfaces) - self.pg_start() + self.pg_start(trace=trace) def send_and_assert_no_replies(self, intf, pkts, remark="", timeout=None): self.pg_send(intf, pkts) @@ -1196,10 +1208,11 @@ class VppTestCase(unittest.TestCase): i.assert_nothing_captured(remark=remark) timeout = 0.1 - def send_and_expect(self, intf, pkts, output, n_rx=None, worker=None): + def send_and_expect(self, intf, pkts, output, n_rx=None, worker=None, + trace=True): if not n_rx: n_rx = len(pkts) - self.pg_send(intf, pkts, worker=worker) + self.pg_send(intf, pkts, worker=worker, trace=trace) rx = output.get_capture(n_rx) return rx @@ -1435,6 +1448,13 @@ class VppTestResult(unittest.TestResult): c = YELLOW test_title_colored = colorize("SOLO RUN: " + test_title, c) + # This block may overwrite the colorized title above, + # but we want this to stand out and be fixed + if test.has_tag(TestCaseTag.FIXME_VPP_WORKERS): + c = RED + w = "FIXME with VPP workers: " + test_title_colored = colorize(w + test_title, c) + if not hasattr(test.__class__, '_header_printed'): print(double_line_delim) print(test_title_colored)