summaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-09-26 11:19:00 +0200
committerDamjan Marion <dmarion@me.com>2018-10-03 17:38:41 +0000
commit611864f4bddf787aff3323f162da589b1b26529c (patch)
tree685ae115de9e2fac60d14002ed748f4379ac8112 /test/framework.py
parent400ded36422689c1783e220a1846447bc0058234 (diff)
ipsec: add missing ipv6 ah code & ipv6 tests
Change-Id: I89e90193ded1beb6cb0950c15737f9467efac1c3 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/test/framework.py b/test/framework.py
index cd15aec7d34..da34724befd 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -287,8 +287,7 @@ class VppTestCase(unittest.TestCase):
coredump_size, "}", "api-trace", "{", "on", "}",
"api-segment", "{", "prefix", cls.shm_prefix, "}",
"cpu", "{", "main-core", str(cpu_core_number), "}",
- "statseg", "{", "socket-name",
- cls.tempdir + "/stats.sock", "}",
+ "statseg", "{", "socket-name", cls.stats_sock, "}",
"plugins", "{", "plugin", "dpdk_plugin.so", "{",
"disable", "}", "plugin", "unittest_plugin.so",
"{", "enable", "}", "}", ]
@@ -347,6 +346,13 @@ class VppTestCase(unittest.TestCase):
cls.wait_for_enter()
@classmethod
+ def wait_for_stats_socket(cls):
+ deadline = time.time() + 3
+ while time.time() < deadline or cls.debug_gdb or cls.debug_gdbserver:
+ if os.path.exists(cls.stats_sock):
+ break
+
+ @classmethod
def setUpClass(cls):
"""
Perform class setup before running the testcase
@@ -360,6 +366,7 @@ class VppTestCase(unittest.TestCase):
cls.logger.name = cls.__name__
cls.tempdir = tempfile.mkdtemp(
prefix='vpp-unittest-%s-' % cls.__name__)
+ cls.stats_sock = "%s/stats.sock" % cls.tempdir
cls.file_handler = FileHandler("%s/log.txt" % cls.tempdir)
cls.file_handler.setFormatter(
Formatter(fmt='%(asctime)s,%(msecs)03d %(message)s',
@@ -391,14 +398,19 @@ class VppTestCase(unittest.TestCase):
cls.pump_thread = Thread(target=pump_output, args=(cls,))
cls.pump_thread.daemon = True
cls.pump_thread.start()
- cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix, cls)
+ if cls.debug_gdb or cls.debug_gdbserver:
+ read_timeout = 0
+ else:
+ read_timeout = 5
+ cls.vapi = VppPapiProvider(cls.shm_prefix, cls.shm_prefix, cls,
+ read_timeout)
if cls.step:
hook = StepHook(cls)
else:
hook = PollHook(cls)
cls.vapi.register_hook(hook)
- cls.sleep(0.1, "after vpp startup, before initial poll")
- cls.statistics = VPPStats(socketname=cls.tempdir+'/stats.sock')
+ cls.wait_for_stats_socket()
+ cls.statistics = VPPStats(socketname=cls.stats_sock)
try:
hook.poll_vpp()
except VppDiedError:
@@ -459,7 +471,7 @@ class VppTestCase(unittest.TestCase):
cls.vpp.poll()
if cls.vpp.returncode is None:
cls.logger.debug("Sending TERM to vpp")
- cls.vpp.terminate()
+ cls.vpp.kill()
cls.logger.debug("Waiting for vpp to die")
cls.vpp.communicate()
del cls.vpp