blob: 32eb4ff3a2170fe3d90c6d3ff6714d0dfbed6556 [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
Klement Sekerab23ffd72021-05-31 16:08:53 +02005from config import config
6from framework import VppTestCase, VppTestRunner
Dave Barach8b5dc4f2018-07-23 18:00:54 -04007from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
8
9
juraj.linkes8e26f6d2018-09-19 14:59:43 +020010class TestBihash(VppTestCase):
Dave Barach8b5dc4f2018-07-23 18:00:54 -040011 """ Bihash Test Cases """
12
13 @classmethod
14 def setUpClass(cls):
Dave Barachb60620b2021-02-10 07:40:05 -050015 # increase vapi timeout, to avoid spurious "test bihash ..."
16 # failures reported on aarch64 w/ test-debug
17 cls.vapi_response_timeout = 20
juraj.linkes8e26f6d2018-09-19 14:59:43 +020018 super(TestBihash, cls).setUpClass()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040019
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070020 @classmethod
21 def tearDownClass(cls):
22 super(TestBihash, cls).tearDownClass()
23
Dave Barach8b5dc4f2018-07-23 18:00:54 -040024 def setUp(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020025 super(TestBihash, self).setUp()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040026
27 def tearDown(self):
juraj.linkes8e26f6d2018-09-19 14:59:43 +020028 super(TestBihash, self).tearDown()
Dave Barach8b5dc4f2018-07-23 18:00:54 -040029
30 def test_bihash_unittest(self):
31 """ Bihash Add/Del Test """
Dave Barach749a89c2019-05-07 10:30:18 -040032 error = self.vapi.cli("test bihash careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040033
34 if error:
35 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080036 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040037
38 def test_bihash_thread(self):
39 """ Bihash Thread Test """
40
Dave Barach749a89c2019-05-07 10:30:18 -040041 error = self.vapi.cli("test bihash threads 2 nbuckets" +
42 " 64000 careful 0 verbose 0")
Dave Barach8b5dc4f2018-07-23 18:00:54 -040043
44 if error:
45 self.logger.critical(error)
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080046 self.assertNotIn('failed', error)
Dave Barach8b5dc4f2018-07-23 18:00:54 -040047
Dave Barach749a89c2019-05-07 10:30:18 -040048 def test_bihash_vec64(self):
49 """ Bihash vec64 Test """
50
51 error = self.vapi.cli("test bihash vec64")
52
53 if error:
54 self.logger.critical(error)
55 self.assertNotIn('failed', error)
56
Klement Sekerab23ffd72021-05-31 16:08:53 +020057 @unittest.skipUnless(config.gcov, "part of code coverage tests")
Dave Barach749a89c2019-05-07 10:30:18 -040058 def test_bihash_coverage(self):
59 """ Improve Code Coverage """
60
61 error = self.vapi.cli("test bihash nitems 10 ncycles 3" +
62 "search 2 careful 1 verbose 2 non-random-keys")
63
64 if error:
65 self.logger.critical(error)
66 self.assertNotIn('failed', error)
67
Dave Barach37b44542020-04-27 18:38:36 -040068 error = self.vapi.cli("test bihash nitems 10 nbuckets 1 ncycles 3" +
69 "search 2 careful 1 verbose 2 non-random-keys")
70 if error:
71 self.logger.critical(error)
72 self.assertNotIn('failed', error)
73
Dave Barach8b5dc4f2018-07-23 18:00:54 -040074if __name__ == '__main__':
75 unittest.main(testRunner=VppTestRunner)