summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2020-06-15 17:38:12 -0400
committerDave Wallace <dwallacelf@gmail.com>2020-06-20 01:58:34 +0000
commit3a49130c75caa153cc65471fd860340cb13dcd90 (patch)
treea6c69e39e1eefe324103941a5893f925a9c2bed5
parent12b517b3ffe3ca4b447263548cfa2bcac857c836 (diff)
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 <dave@barachs.net> Change-Id: I3c712fa011df2e23761a2e73c1aba0c7e50123a6
-rw-r--r--test/test_vlib.py20
1 files changed, 19 insertions, 1 deletions
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)