7 from framework import VppTestCase, running_extended_tests, \
8 running_on_centos, VppTestRunner, Worker
11 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
12 class VAPITestCase(VppTestCase):
15 def test_vapi_c(self):
16 """ run C VAPI tests """
18 built_root = os.getenv(var, None)
19 self.assertIsNotNone(built_root,
20 "Environment variable `%s' not set" % var)
21 executable = "%s/vapi_test/vapi_c_test" % built_root
23 [executable, "vapi client", self.shm_prefix], self.logger)
27 self.logger.info("Worker result is `%s'" % worker.result)
29 if worker.result is None:
33 "Timeout! Worker did not finish in %ss" % timeout)
34 os.killpg(os.getpgid(worker.process.pid), signal.SIGTERM)
37 self.logger.debug("Couldn't kill worker-spawned process")
41 "Timeout! Worker did not finish in %ss" % timeout)
42 self.assert_equal(worker.result, 0, "Binary test return code")
44 @unittest.skipIf(running_on_centos(), "Centos's gcc can't compile our C++")
45 def test_vapi_cpp(self):
46 """ run C++ VAPI tests """
48 built_root = os.getenv(var, None)
49 self.assertIsNotNone(built_root,
50 "Environment variable `%s' not set" % var)
51 executable = "%s/vapi_test/vapi_cpp_test" % built_root
53 [executable, "vapi client", self.shm_prefix], self.logger)
57 self.logger.info("Worker result is `%s'" % worker.result)
59 if worker.result is None:
63 "Timeout! Worker did not finish in %ss" % timeout)
64 os.killpg(os.getpgid(worker.process.pid), signal.SIGTERM)
67 raise Exception("Couldn't kill worker-spawned process")
70 "Timeout! Worker did not finish in %ss" % timeout)
71 self.assert_equal(worker.result, 0, "Binary test return code")
74 if __name__ == '__main__':
75 unittest.main(testRunner=VppTestRunner)