Renato Botelho do Couto | ead1e53 | 2019-10-31 13:31:07 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 2 | |
| 3 | import unittest |
| 4 | |
Dave Barach | d498c9e | 2020-03-10 16:59:39 -0400 | [diff] [blame] | 5 | from framework import VppTestCase, VppTestRunner, running_gcov_tests |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 6 | from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath |
| 7 | |
| 8 | |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 9 | class TestBihash(VppTestCase): |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 10 | """ Bihash Test Cases """ |
| 11 | |
| 12 | @classmethod |
| 13 | def setUpClass(cls): |
Dave Barach | b60620b | 2021-02-10 07:40:05 -0500 | [diff] [blame^] | 14 | # increase vapi timeout, to avoid spurious "test bihash ..." |
| 15 | # failures reported on aarch64 w/ test-debug |
| 16 | cls.vapi_response_timeout = 20 |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 17 | super(TestBihash, cls).setUpClass() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 18 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 19 | @classmethod |
| 20 | def tearDownClass(cls): |
| 21 | super(TestBihash, cls).tearDownClass() |
| 22 | |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 23 | def setUp(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 24 | super(TestBihash, self).setUp() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 25 | |
| 26 | def tearDown(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 27 | super(TestBihash, self).tearDown() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 28 | |
| 29 | def test_bihash_unittest(self): |
| 30 | """ Bihash Add/Del Test """ |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 31 | error = self.vapi.cli("test bihash careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 32 | |
| 33 | if error: |
| 34 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 35 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 36 | |
| 37 | def test_bihash_thread(self): |
| 38 | """ Bihash Thread Test """ |
| 39 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 40 | error = self.vapi.cli("test bihash threads 2 nbuckets" + |
| 41 | " 64000 careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 42 | |
| 43 | if error: |
| 44 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 45 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 46 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 47 | 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 Barach | d498c9e | 2020-03-10 16:59:39 -0400 | [diff] [blame] | 56 | @unittest.skipUnless(running_gcov_tests, "part of code coverage tests") |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 57 | 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 Barach | 37b4454 | 2020-04-27 18:38:36 -0400 | [diff] [blame] | 67 | 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 Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 73 | if __name__ == '__main__': |
| 74 | unittest.main(testRunner=VppTestRunner) |