diff options
author | Klement Sekera <ksekera@cisco.com> | 2021-03-15 16:58:10 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2021-03-20 01:14:20 +0000 |
commit | 8d8150262b00435c365a43c8f859584901736aff (patch) | |
tree | c7eace6feab4895d6f40b16a54ef65cc63bebe67 /test/framework.py | |
parent | 290526e3c72888ac05928ed0a6dddee02f7df650 (diff) |
tests: add support for worker awareness
VppTestCase now has vpp_worker_count property set to number of workers.
This can be overriden by child classes. Also overriden by
VPP_WORKER_CONFIG variable for legacy reasons.
Type: improvement
Change-Id: Ic328bacb9003ddf9e92815767653bd362aa7f086
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/test/framework.py b/test/framework.py index 4e0949bcf45..22a9509f030 100644 --- a/test/framework.py +++ b/test/framework.py @@ -406,11 +406,18 @@ class VppTestCase(unittest.TestCase): coredump_size = "coredump-size unlimited" cpu_core_number = cls.get_least_used_cpu() - if not hasattr(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 = "" + if not hasattr(cls, "vpp_worker_count"): + cls.vpp_worker_count = 0 + worker_config = os.getenv("VPP_WORKER_CONFIG", "") + if worker_config: + elems = worker_config.split(" ") + if elems[0] != "workers" or len(elems) != 2: + raise ValueError("Wrong VPP_WORKER_CONFIG == '%s' value." % + worker_config) + cls.vpp_worker_count = int(elems[1]) + if cls.vpp_worker_count > 0 and\ + cls.has_tag(TestCaseTag.FIXME_VPP_WORKERS): + cls.vpp_worker_count = 0 default_variant = os.getenv("VARIANT") if default_variant is not None: @@ -422,25 +429,27 @@ class VppTestCase(unittest.TestCase): if api_fuzzing is None: api_fuzzing = 'off' - cls.vpp_cmdline = [cls.vpp_bin, "unix", - "{", "nodaemon", debug_cli, "full-coredump", - coredump_size, "runtime-dir", cls.tempdir, "}", - "api-trace", "{", "on", "}", "api-segment", "{", - "prefix", cls.shm_prefix, "}", "cpu", "{", - "main-core", str(cpu_core_number), - cls.worker_config, "}", - "physmem", "{", "max-size", "32m", "}", - "statseg", "{", "socket-name", cls.stats_sock, "}", - "socksvr", "{", "socket-name", cls.api_sock, "}", - "node { ", default_variant, "}", - "api-fuzz {", api_fuzzing, "}", - "plugins", - "{", "plugin", "dpdk_plugin.so", "{", "disable", - "}", "plugin", "rdma_plugin.so", "{", "disable", - "}", "plugin", "lisp_unittest_plugin.so", "{", - "enable", - "}", "plugin", "unittest_plugin.so", "{", "enable", - "}"] + cls.extra_vpp_plugin_config + ["}", ] + cls.vpp_cmdline = [ + cls.vpp_bin, + "unix", "{", "nodaemon", debug_cli, "full-coredump", + coredump_size, "runtime-dir", cls.tempdir, "}", + "api-trace", "{", "on", "}", + "api-segment", "{", "prefix", cls.shm_prefix, "}", + "cpu", "{", "main-core", str(cpu_core_number), ] + if cls.vpp_worker_count: + cls.vpp_cmdline.extend(["workers", str(cls.vpp_worker_count)]) + cls.vpp_cmdline.extend([ + "}", + "physmem", "{", "max-size", "32m", "}", + "statseg", "{", "socket-name", cls.stats_sock, "}", + "socksvr", "{", "socket-name", cls.api_sock, "}", + "node { ", default_variant, "}", + "api-fuzz {", api_fuzzing, "}", + "plugins", "{", "plugin", "dpdk_plugin.so", "{", "disable", "}", + "plugin", "rdma_plugin.so", "{", "disable", "}", + "plugin", "lisp_unittest_plugin.so", "{", "enable", "}", + "plugin", "unittest_plugin.so", "{", "enable", "}" + ] + cls.extra_vpp_plugin_config + ["}", ]) if cls.extra_vpp_punt_config is not None: cls.vpp_cmdline.extend(cls.extra_vpp_punt_config) @@ -774,7 +783,6 @@ class VppTestCase(unittest.TestCase): super(VppTestCase, self).setUp() self.reporter.send_keep_alive(self) if self.vpp_dead: - raise VppDiedError(rv=None, testcase=self.__class__.__name__, method_name=self._testMethodName) self.sleep(.1, "during setUp") |