blob: 2949d66750dcd33f5984fdfcfbc81ee946a22f19 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Dave Barach8b5dc4f2018-07-23 18:00:54 -04002
3import unittest
4
Dave Barachd498c9e2020-03-10 16:59:39 -04005from framework import VppTestCase, VppTestRunner, running_gcov_tests
Dave Barach8b5dc4f2018-07-23 18:00:54 -04006from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
7
8
juraj.linkes8e26f6d2018-09-19 14:59:43 +02009class TestBihash(VppTestCase):
Dave Barach8b5dc4f2018-07-23 18:00:54 -040010 """ Bihash Test Cases """
11
12 @classmethod
13 def setUpClass(cls):
Dave Barachb60620b2021-02-10 07:40:05 -050014 # increase vapi timeout, to avoid spurious "test bihash ..."
15 # failures reported on aarch64 w/ test-debug
16 cls.vapi_response_timeout = 20
juraj.linkes8e26f6d2018-09-19 14:59:43 +020017 super(TestBihash, cls).setUpClass()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040018
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070019 @classmethod
20 def tearDownClass(cls):
21 super(TestBihash, cls).tearDownClass()
22
Dave Barach8b5dc4f2018-07-23 18:00:54 -040023 def setUp(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020024 super(TestBihash, self).setUp()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040025
26 def tearDown(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020027 super(TestBihash, self).tearDown()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040028
29 def test_bihash_unittest(self):
30 """ Bihash Add/Del Test """
Dave Barach749a89c2019-05-07 10:30:18 -040031 error = self.vapi.cli("test bihash careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040032
33 if error:
34 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080035 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040036
37 def test_bihash_thread(self):
38 """ Bihash Thread Test """
39
Dave Barach749a89c2019-05-07 10:30:18 -040040 error = self.vapi.cli("test bihash threads 2 nbuckets" +
41 " 64000 careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040042
43 if error:
44 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080045 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040046
Dave Barach749a89c2019-05-07 10:30:18 -040047 def test_bihash_vec64(self):
48 """ Bihash vec64 Test """
49
50 error = self.vapi.cli("test bihash vec64")
51
52 if error:
53 self.logger.critical(error)
54 self.assertNotIn('failed', error)
55
Dave Barachd498c9e2020-03-10 16:59:39 -040056 @unittest.skipUnless(running_gcov_tests, "part of code coverage tests")
Dave Barach749a89c2019-05-07 10:30:18 -040057 def test_bihash_coverage(self):
58 """ Improve Code Coverage """
59
60 error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
61 "search 2 careful 1 verbose 2 non-random-keys")
62
63 if error:
64 self.logger.critical(error)
65 self.assertNotIn('failed', error)
66
Dave Barach37b44542020-04-27 18:38:36 -040067 error = self.vapi.cli("test bihash nitems 10 nbuckets 1 ncycles 3" +
68 "search 2 careful 1 verbose 2 non-random-keys")
69 if error:
70 self.logger.critical(error)
71 self.assertNotIn('failed', error)
72
Dave Barach8b5dc4f2018-07-23 18:00:54 -040073if __name__ == '__main__':
74 unittest.main(testRunner=VppTestRunner)