aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoradrianvillin <avillin@cisco.com>2023-11-07 10:18:24 +0100
committerDave Wallace <dwallacelf@gmail.com>2023-11-08 17:08:34 +0000
commite59761f721f8a667a03e0c505b287bf69c47b532 (patch)
tree7b1990e04a620bff05a8577877c155a79fac8baf /test
parent22b4a9c7320d2510b8debe806f9338c6c65eeecf (diff)
tests: added a simple perfmon plugin test
Type: test Change-Id: Ief0c0e13a2c19a03b48219d9a0d85256fb0c9dbe Signed-off-by: adrianvillin <avillin@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/asf/test_perfmon.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/asf/test_perfmon.py b/test/asf/test_perfmon.py
new file mode 100644
index 00000000000..448a6012c20
--- /dev/null
+++ b/test/asf/test_perfmon.py
@@ -0,0 +1,42 @@
+from asfframework import VppAsfTestCase, VppTestRunner
+import unittest
+
+
+class TestPerfmon(VppAsfTestCase):
+ """Simple perfmon test"""
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestPerfmon, cls).setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super(TestPerfmon, cls).tearDownClass()
+
+ def test_perfmon(self):
+ reply = self.vapi.cli("show perfmon active-bundle")
+ self.assertNotIn("context-switches", reply)
+
+ reply = self.vapi.cli("show perfmon bundle")
+ self.assertIn("context-switches", reply)
+
+ self.vapi.cli("perfmon start bundle context-switches type thread")
+ reply = self.vapi.cli("show perfmon active-bundle")
+ self.assertIn("name: context-switches", reply)
+
+ reply = self.vapi.cli("show perfmon statistics")
+ self.assertIn("per-thread context switches", reply)
+
+ reply = self.vapi.cli("show perfmon source linux verbose")
+ self.assertIn("description: Linux kernel performance counters", reply)
+ self.vapi.cli("perfmon reset")
+
+ reply = self.vapi.cli("show perfmon active-bundle")
+ self.assertNotIn("context-switches", reply)
+
+ self.vapi.cli("perfmon start bundle context-switches type thread")
+ self.vapi.cli("perfmon stop")
+
+
+if __name__ == "__main__":
+ unittest.main(testRunner=VppTestRunner)