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("test bihash threads 2 nbuckets" +
42 " 64000 careful 0 verbose 0")
45 self.logger.critical(error)
46 self.assertNotIn('failed', error)
48 def test_bihash_vec64(self):
49 """ Bihash vec64 Test """
51 error = self.vapi.cli("test bihash vec64")
54 self.logger.critical(error)
55 self.assertNotIn('failed', error)
57 @unittest.skipUnless(config.gcov, "part of code coverage tests")
58 def test_bihash_coverage(self):
59 """ Improve Code Coverage """
61 error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
62 "search 2 careful 1 verbose 2 non-random-keys")
65 self.logger.critical(error)
66 self.assertNotIn('failed', error)
68 error = self.vapi.cli("test bihash nitems 10 nbuckets 1 ncycles 3" +
69 "search 2 careful 1 verbose 2 non-random-keys")
71 self.logger.critical(error)
72 self.assertNotIn('failed', error)
74 if __name__ == '__main__':
75 unittest.main(testRunner=VppTestRunner)