Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
classify: fix multiple filters support
[vpp.git]
/
test
/
framework.py
diff --git
a/test/framework.py
b/test/framework.py
index
7ab5b45
..
4d0f456
100644
(file)
--- a/
test/framework.py
+++ b/
test/framework.py
@@
-257,7
+257,11
@@
class KeepAliveReporter(object):
class TestCaseTag(Enum):
class TestCaseTag(Enum):
+ # marks the suites that must run at the end
+ # using only a single test runner
RUN_SOLO = 1
RUN_SOLO = 1
+ # marks the suites broken on VPP multi-worker
+ FIXME_VPP_WORKERS = 2
def create_tag_decorator(e):
def create_tag_decorator(e):
@@
-269,7
+273,9
@@
def create_tag_decorator(e):
return cls
return decorator
return cls
return decorator
+
tag_run_solo = create_tag_decorator(TestCaseTag.RUN_SOLO)
tag_run_solo = create_tag_decorator(TestCaseTag.RUN_SOLO)
+tag_fixme_vpp_workers = create_tag_decorator(TestCaseTag.FIXME_VPP_WORKERS)
class VppTestCase(unittest.TestCase):
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"):
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:
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.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:
del cls.vpp
if cls.vpp_startup_failed:
@@
-813,9
+824,11
@@
class VppTestCase(unittest.TestCase):
cls.sleep(0.1)
@classmethod
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 """
""" 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,
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)
"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)
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)
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
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)
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
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)
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)
if not hasattr(test.__class__, '_header_printed'):
print(double_line_delim)
print(test_title_colored)