From 3e9b7a219df7ba52db719af5216a44b31f21f770 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Tue, 9 Apr 2019 20:19:51 -0400 Subject: make test: Fix truncated core file - Wait for coredump to complete before killing VPP. Change-Id: Ib7b96b339f796f9ef7e0eadff81d181464b8a03a Signed-off-by: Dave Wallace --- test/framework.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/framework.py b/test/framework.py index 4ce8bc1380d..989fb3d75cf 100644 --- a/test/framework.py +++ b/test/framework.py @@ -400,6 +400,28 @@ class VppTestCase(unittest.TestCase): if not ok: cls.logger.critical("Couldn't stat : {}".format(cls.stats_sock)) + @classmethod + def wait_for_coredump(cls): + corefile = cls.tempdir + "/core" + if os.path.isfile(corefile): + cls.logger.error("Waiting for coredump to complete: %s", corefile) + curr_size = os.path.getsize(corefile) + deadline = time.time() + 60 + ok = False + while time.time() < deadline: + cls.sleep(1) + size = curr_size + curr_size = os.path.getsize(corefile) + if size == curr_size: + ok = True + break + if not ok: + cls.logger.error("Timed out waiting for coredump to complete:" + " %s", corefile) + else: + cls.logger.error("Coredump complete: %s, size %d", + corefile, curr_size) + @classmethod def setUpClass(cls): """ @@ -529,6 +551,7 @@ class VppTestCase(unittest.TestCase): del cls.vapi cls.vpp.poll() if cls.vpp.returncode is None: + cls.wait_for_coredump() cls.logger.debug("Sending TERM to vpp") cls.vpp.terminate() cls.logger.debug("Waiting for vpp to die") -- cgit 1.2.3-korg