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): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 14 | super(TestBihash, cls).setUpClass() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 15 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 16 | @classmethod |
| 17 | def tearDownClass(cls): |
| 18 | super(TestBihash, cls).tearDownClass() |
| 19 | |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 20 | def setUp(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 21 | super(TestBihash, self).setUp() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 22 | |
| 23 | def tearDown(self): |
juraj.linkes | 8e26f6d | 2018-09-19 14:59:43 +0200 | [diff] [blame] | 24 | super(TestBihash, self).tearDown() |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 25 | |
| 26 | def test_bihash_unittest(self): |
| 27 | """ Bihash Add/Del Test """ |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 28 | error = self.vapi.cli("test bihash careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 29 | |
| 30 | if error: |
| 31 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 32 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 33 | |
| 34 | def test_bihash_thread(self): |
| 35 | """ Bihash Thread Test """ |
| 36 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 37 | error = self.vapi.cli("test bihash threads 2 nbuckets" + |
| 38 | " 64000 careful 0 verbose 0") |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 39 | |
| 40 | if error: |
| 41 | self.logger.critical(error) |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 42 | self.assertNotIn('failed', error) |
Dave Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 43 | |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 44 | 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 Barach | d498c9e | 2020-03-10 16:59:39 -0400 | [diff] [blame] | 53 | @unittest.skipUnless(running_gcov_tests, "part of code coverage tests") |
Dave Barach | 749a89c | 2019-05-07 10:30:18 -0400 | [diff] [blame] | 54 | 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 Barach | 37b4454 | 2020-04-27 18:38:36 -0400 | [diff] [blame] | 64 | 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 Barach | 8b5dc4f | 2018-07-23 18:00:54 -0400 | [diff] [blame] | 70 | if __name__ == '__main__': |
| 71 | unittest.main(testRunner=VppTestRunner) |