diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2019-04-09 20:19:51 -0400 |
---|---|---|
committer | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-05-06 20:49:32 +0000 |
commit | 3e9b7a219df7ba52db719af5216a44b31f21f770 (patch) | |
tree | 0e6e5c991597b3f1e5e5c7d56775bb6bd01a9869 | |
parent | ad64687e8bc3e208797ce1d5b16936f51d6cf632 (diff) |
make test: Fix truncated core file
- Wait for coredump to complete before killing VPP.
Change-Id: Ib7b96b339f796f9ef7e0eadff81d181464b8a03a
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r-- | test/framework.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/framework.py b/test/framework.py index 4ce8bc1380d..989fb3d75cf 100644 --- a/test/framework.py +++ b/test/framework.py @@ -401,6 +401,28 @@ class VppTestCase(unittest.TestCase): 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): """ Perform class setup before running the testcase @@ -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") |