summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/framework.py58
-rw-r--r--test/template_ipsec.py4
-rw-r--r--test/test_ip4.py2
-rw-r--r--test/test_ip6.py2
-rw-r--r--test/test_ipsec_esp.py4
-rw-r--r--test/test_reassembly.py39
-rw-r--r--test/test_vlib.py2
-rw-r--r--test/test_vppinfra.py2
8 files changed, 59 insertions, 54 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")
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index f7becf0f82a..62271d33579 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -1217,7 +1217,7 @@ class IpsecTun6Tests(IpsecTun6):
class IpsecTun6HandoffTests(IpsecTun6):
""" UT test methods for Tunnel v6 with multiple workers """
- worker_config = "workers 2"
+ vpp_worker_count = 2
def test_tun_handoff_66(self):
""" ipsec 6o6 tunnel worker hand-off test """
@@ -1251,7 +1251,7 @@ class IpsecTun6HandoffTests(IpsecTun6):
class IpsecTun4HandoffTests(IpsecTun4):
""" UT test methods for Tunnel v4 with multiple workers """
- worker_config = "workers 2"
+ vpp_worker_count = 2
def test_tun_handooff_44(self):
""" ipsec 4o4 tunnel worker hand-off test """
diff --git a/test/test_ip4.py b/test/test_ip4.py
index f9fa33c1c7c..3f2894d01c1 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -1605,7 +1605,7 @@ class TestIPPunt(IPPuntSetup, VppTestCase):
class TestIPPuntHandoff(IPPuntSetup, VppTestCase):
""" IPv4 Punt Policer thread handoff """
- worker_config = "workers 2"
+ vpp_worker_count = 2
def setUp(self):
super(TestIPPuntHandoff, self).setUp()
diff --git a/test/test_ip6.py b/test/test_ip6.py
index db90b84ed0f..8abd8d6807f 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -2320,7 +2320,7 @@ class TestIP6Punt(IP6PuntSetup, VppTestCase):
class TestIP6PuntHandoff(IP6PuntSetup, VppTestCase):
""" IPv6 Punt Police/Redirect """
- worker_config = "workers 2"
+ vpp_worker_count = 2
def setUp(self):
super(TestIP6PuntHandoff, self).setUp()
diff --git a/test/test_ipsec_esp.py b/test/test_ipsec_esp.py
index dcbbb826775..acff595996b 100644
--- a/test/test_ipsec_esp.py
+++ b/test/test_ipsec_esp.py
@@ -470,7 +470,7 @@ class TestIpsecEsp2(TemplateIpsecEsp, IpsecTcpTests):
class TestIpsecEspAsync(TemplateIpsecEsp):
""" Ipsec ESP - Aysnc tests """
- worker_config = "workers 2"
+ vpp_worker_count = 2
def setUp(self):
super(TestIpsecEspAsync, self).setUp()
@@ -852,7 +852,7 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
test_args = str.split(cls.__doc__, " ")
engine = test_args[0]
if engine == "async":
- cls.worker_config = "workers 2"
+ cls.vpp_worker_count = 2
super(RunTestIpsecEspAll, cls).setUpConstants()
def setUp(self):
diff --git a/test/test_reassembly.py b/test/test_reassembly.py
index a8dc60a2df6..124fec0a820 100644
--- a/test/test_reassembly.py
+++ b/test/test_reassembly.py
@@ -21,9 +21,6 @@ from vpp_papi import VppEnum
# 35 is enough to have >257 400-byte fragments
test_packet_count = 35
-# number of workers used for multi-worker test cases
-worker_count = 3
-
class TestIPv4Reassembly(VppTestCase):
""" IPv4 Reassembly """
@@ -789,13 +786,13 @@ class TestIPv4SVReassembly(VppTestCase):
class TestIPv4MWReassembly(VppTestCase):
""" IPv4 Reassembly (multiple workers) """
- worker_config = "workers %d" % worker_count
+ vpp_worker_count = 3
@classmethod
def setUpClass(cls):
super(TestIPv4MWReassembly, cls).setUpClass()
- cls.create_pg_interfaces(range(worker_count+1))
+ cls.create_pg_interfaces(range(cls.vpp_worker_count+1))
cls.src_if = cls.pg0
cls.send_ifs = cls.pg_interfaces[:-1]
cls.dst_if = cls.pg_interfaces[-1]
@@ -908,7 +905,7 @@ class TestIPv4MWReassembly(VppTestCase):
"Packet with packet_index %d not received" % index)
def send_packets(self, packets):
- for counter in range(worker_count):
+ for counter in range(self.vpp_worker_count):
if 0 == len(packets[counter]):
continue
send_if = self.send_ifs[counter]
@@ -924,19 +921,19 @@ class TestIPv4MWReassembly(VppTestCase):
# in first wave we send fragments which don't start at offset 0
# then we send fragments with offset 0 on a different thread
# then the rest of packets on a random thread
- first_packets = [[] for n in range(worker_count)]
- second_packets = [[] for n in range(worker_count)]
- rest_of_packets = [[] for n in range(worker_count)]
+ first_packets = [[] for n in range(self.vpp_worker_count)]
+ second_packets = [[] for n in range(self.vpp_worker_count)]
+ rest_of_packets = [[] for n in range(self.vpp_worker_count)]
for (_, p) in self.pkt_infos:
- wi = randrange(worker_count)
+ wi = randrange(self.vpp_worker_count)
second_packets[wi].append(p[0])
if len(p) <= 1:
continue
wi2 = wi
while wi2 == wi:
- wi2 = randrange(worker_count)
+ wi2 = randrange(self.vpp_worker_count)
first_packets[wi2].append(p[1])
- wi3 = randrange(worker_count)
+ wi3 = randrange(self.vpp_worker_count)
rest_of_packets[wi3].extend(p[2:])
self.pg_enable_capture()
@@ -1437,13 +1434,13 @@ class TestIPv6Reassembly(VppTestCase):
class TestIPv6MWReassembly(VppTestCase):
""" IPv6 Reassembly (multiple workers) """
- worker_config = "workers %d" % worker_count
+ vpp_worker_count = 3
@classmethod
def setUpClass(cls):
super(TestIPv6MWReassembly, cls).setUpClass()
- cls.create_pg_interfaces(range(worker_count+1))
+ cls.create_pg_interfaces(range(cls.vpp_worker_count+1))
cls.src_if = cls.pg0
cls.send_ifs = cls.pg_interfaces[:-1]
cls.dst_if = cls.pg_interfaces[-1]
@@ -1556,7 +1553,7 @@ class TestIPv6MWReassembly(VppTestCase):
"Packet with packet_index %d not received" % index)
def send_packets(self, packets):
- for counter in range(worker_count):
+ for counter in range(self.vpp_worker_count):
if 0 == len(packets[counter]):
continue
send_if = self.send_ifs[counter]
@@ -1572,19 +1569,19 @@ class TestIPv6MWReassembly(VppTestCase):
# in first wave we send fragments which don't start at offset 0
# then we send fragments with offset 0 on a different thread
# then the rest of packets on a random thread
- first_packets = [[] for n in range(worker_count)]
- second_packets = [[] for n in range(worker_count)]
- rest_of_packets = [[] for n in range(worker_count)]
+ first_packets = [[] for n in range(self.vpp_worker_count)]
+ second_packets = [[] for n in range(self.vpp_worker_count)]
+ rest_of_packets = [[] for n in range(self.vpp_worker_count)]
for (_, p) in self.pkt_infos:
- wi = randrange(worker_count)
+ wi = randrange(self.vpp_worker_count)
second_packets[wi].append(p[0])
if len(p) <= 1:
continue
wi2 = wi
while wi2 == wi:
- wi2 = randrange(worker_count)
+ wi2 = randrange(self.vpp_worker_count)
first_packets[wi2].append(p[1])
- wi3 = randrange(worker_count)
+ wi3 = randrange(self.vpp_worker_count)
rest_of_packets[wi3].extend(p[2:])
self.pg_enable_capture()
diff --git a/test/test_vlib.py b/test/test_vlib.py
index 89ccb396ecd..64218eabbb3 100644
--- a/test/test_vlib.py
+++ b/test/test_vlib.py
@@ -11,7 +11,7 @@ from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
class TestVlib(VppTestCase):
""" Vlib Unit Test Cases """
- worker_config = "workers 1"
+ vpp_worker_count = 1
@classmethod
def setUpClass(cls):
diff --git a/test/test_vppinfra.py b/test/test_vppinfra.py
index 9cb782d3593..8b6ec965fea 100644
--- a/test/test_vppinfra.py
+++ b/test/test_vppinfra.py
@@ -8,7 +8,7 @@ from framework import running_gcov_tests
class TestVppinfra(VppTestCase):
""" Vppinfra Unit Test Cases """
- worker_config = "workers 1"
+ vpp_worker_count = 1
@classmethod
def setUpClass(cls):