tests: Add platform handling for FreeBSD
[vpp.git] / test / asf / test_string.py
1 #!/usr/bin/env python3
2
3 import unittest
4
5 from asfframework import VppAsfTestCase, VppTestRunner
6
7
8 class TestString(VppAsfTestCase):
9     """String Test Cases"""
10
11     @classmethod
12     def setUpClass(cls):
13         super(TestString, cls).setUpClass()
14
15     @classmethod
16     def tearDownClass(cls):
17         super(TestString, cls).tearDownClass()
18
19     def setUp(self):
20         super(TestString, self).setUp()
21
22     def tearDown(self):
23         super(TestString, self).tearDown()
24
25     def test_string_unittest(self):
26         """String unit tests"""
27         names = [
28             "memcpy_s",
29             "clib_memcmp",
30             "clib_memcpy",
31             "clib_memset",
32             "clib_strcmp",
33             "clib_strncmp",
34             "clib_strncpy",
35             "clib_strnlen",
36             "clib_strtok",
37             "memcmp_s",
38             "memcpy_s",
39             "memset_s ",
40             "strcat_s",
41             "strcmp_s",
42             "strcpy_s",
43             "strncat_s",
44             "strncmp_s",
45             "strncpy_s",
46             "strnlen_s",
47             "strstr_s",
48             "strtok_s",
49         ]
50
51         for name in names:
52             error = self.vapi.cli("test string " + name)
53             if error.find("failed") != -1:
54                 self.logger.critical("FAILURE in the " + name + " test")
55                 self.assertNotIn("failed", error)
56
57
58 if __name__ == "__main__":
59     unittest.main(testRunner=VppTestRunner)