From 3a49130c75caa153cc65471fd860340cb13dcd90 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Mon, 15 Jun 2020 17:38:12 -0400 Subject: tests: improve lcov stats for memory_api.c Cover vl_mem_api_dead_client_scan(...), which is not so simple. Spin up vpp_api_test using pexpect.spawn, make it bootstrap a private memory segment, kill vpp_api_test, and wait for the dead client scanner to run a few times so that it declares the client dead. The test only runs if GCOV_TESTS=yes is set in the environment. Type: test Signed-off-by: Dave Barach Change-Id: I3c712fa011df2e23761a2e73c1aba0c7e50123a6 --- test/test_vlib.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_vlib.py b/test/test_vlib.py index 3c6288c8eb1..8bc5f57a5d5 100644 --- a/test/test_vlib.py +++ b/test/test_vlib.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 import unittest - +import pexpect +import time +import signal from framework import VppTestCase, VppTestRunner, running_extended_tests from framework import running_gcov_tests from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath @@ -186,5 +188,21 @@ class TestVlib(VppTestCase): else: self.logger.info(cmd + " FAIL retval " + str(r.retval)) + @unittest.skipUnless(running_gcov_tests, "part of code coverage tests") + def test_vlib_main_unittest(self): + """ Private Binary API Segment Test (takes 70 seconds) """ + + vat_path = self.vpp_bin + '_api_test' + vat = pexpect.spawn(vat_path, ['socket-name', self.api_sock]) + vat.expect("vat# ", timeout=10) + vat.sendline('sock_init_shm') + vat.expect("vat# ", timeout=10) + vat.sendline('sh api cli') + vat.kill(signal.SIGKILL) + vat.wait() + self.logger.info("vat terminated, 70 second wait for the Reaper") + time.sleep(70) + self.logger.info("Reaper should be complete...") + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) -- cgit 1.2.3-korg