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
This commit is contained in:

committed by
Dave Wallace

parent
12b517b3ff
commit
3a49130c75
@ -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)
|
||||
|
Reference in New Issue
Block a user