[PATCH 2/2] trace-cruncher: Add more histogram tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Testing the handling of couple of error cases.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@xxxxxxxxx>
---
 .../tests/1_unit/test_01_ftracepy_unit.py      | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py b/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
index 7b344e2..7e5b20e 100644
--- a/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
+++ b/tracecruncher/tests/1_unit/test_01_ftracepy_unit.py
@@ -582,5 +582,23 @@ class HistTestCase(unittest.TestCase):
         self.assertTrue('Available triggers:' in h_buff)
         f.close()
 
+    def test_hist_err(self):
+        inst = ft.create_instance(instance_name)
+        hist = ft.hist(system='kmem', event='kmalloc',
+                       axes={'call_site': 'sym',
+                             'bytes_alloc': 'n'})
+        err = 'Failed read data from histogram'
+        with self.assertRaises(Exception) as context:
+            hist.read(inst)
+        self.assertTrue(err in str(context.exception))
+
+        hist.start(inst)
+        err = 'Failed to start filling the histogram'
+        with self.assertRaises(Exception) as context:
+            hist.start(inst)
+        self.assertTrue(err in str(context.exception))
+        hist.close(inst)
+
+
 if __name__ == '__main__':
     unittest.main()
-- 
2.32.0




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux