5 from config import config
6 from framework import VppTestCase, VppTestRunner
7 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
10 class TestBihash(VppTestCase):
11 """Bihash Test Cases"""
15 # increase vapi timeout, to avoid spurious "test bihash ..."
16 # failures reported on aarch64 w/ test-debug
17 cls.vapi_response_timeout = 20
18 super(TestBihash, cls).setUpClass()
21 def tearDownClass(cls):
22 super(TestBihash, cls).tearDownClass()
25 super(TestBihash, self).setUp()
28 super(TestBihash, self).tearDown()
30 def test_bihash_unittest(self):
31 """Bihash Add/Del Test"""
32 error = self.vapi.cli("test bihash careful 0 verbose 0")
35 self.logger.critical(error)
36 self.assertNotIn("failed", error)
38 def test_bihash_thread(self):
39 """Bihash Thread Test"""
41 error = self.vapi.cli(
42 "test bihash threads 2 nbuckets" + " 64000 careful 0 verbose 0"
46 self.logger.critical(error)
47 self.assertNotIn("failed", error)
49 def test_bihash_vec64(self):
50 """Bihash vec64 Test"""
52 error = self.vapi.cli("test bihash vec64")
55 self.logger.critical(error)
56 self.assertNotIn("failed", error)
58 @unittest.skipUnless(config.gcov, "part of code coverage tests")
59 def test_bihash_coverage(self):
60 """Improve Code Coverage"""
62 error = self.vapi.cli(
63 "test bihash nitems 10 ncycles 3"
64 + "search 2 careful 1 verbose 2 non-random-keys"
68 self.logger.critical(error)
69 self.assertNotIn("failed", error)
71 error = self.vapi.cli(
72 "test bihash nitems 10 nbuckets 1 ncycles 3"
73 + "search 2 careful 1 verbose 2 non-random-keys"
76 self.logger.critical(error)
77 self.assertNotIn("failed", error)
80 if __name__ == "__main__":
81 unittest.main(testRunner=VppTestRunner)