blob: 019929a0a72680290a7804b749e65caba0a791ca [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):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020014 super(TestBihash, cls).setUpClass()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040015
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070016 @classmethod
17 def tearDownClass(cls):
18 super(TestBihash, cls).tearDownClass()
19
Dave Barach8b5dc4f2018-07-23 18:00:54 -040020 def setUp(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020021 super(TestBihash, self).setUp()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040022
23 def tearDown(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020024 super(TestBihash, self).tearDown()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040025
26 def test_bihash_unittest(self):
27 """ Bihash Add/Del Test """
Dave Barach749a89c2019-05-07 10:30:18 -040028 error = self.vapi.cli("test bihash careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040029
30 if error:
31 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080032 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040033
34 def test_bihash_thread(self):
35 """ Bihash Thread Test """
36
Dave Barach749a89c2019-05-07 10:30:18 -040037 error = self.vapi.cli("test bihash threads 2 nbuckets" +
38 " 64000 careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040039
40 if error:
41 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080042 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040043
Dave Barach749a89c2019-05-07 10:30:18 -040044 def test_bihash_vec64(self):
45 """ Bihash vec64 Test """
46
47 error = self.vapi.cli("test bihash vec64")
48
49 if error:
50 self.logger.critical(error)
51 self.assertNotIn('failed', error)
52
Dave Barachd498c9e2020-03-10 16:59:39 -040053 @unittest.skipUnless(running_gcov_tests, "part of code coverage tests")
Dave Barach749a89c2019-05-07 10:30:18 -040054 def test_bihash_coverage(self):
55 """ Improve Code Coverage """
56
57 error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
58 "search 2 careful 1 verbose 2 non-random-keys")
59
60 if error:
61 self.logger.critical(error)
62 self.assertNotIn('failed', error)
63
Dave Barach37b44542020-04-27 18:38:36 -040064 error = self.vapi.cli("test bihash nitems 10 nbuckets 1 ncycles 3" +
65 "search 2 careful 1 verbose 2 non-random-keys")
66 if error:
67 self.logger.critical(error)
68 self.assertNotIn('failed', error)
69
Dave Barach8b5dc4f2018-07-23 18:00:54 -040070if __name__ == '__main__':
71 unittest.main(testRunner=VppTestRunner)