aboutsummaryrefslogtreecommitdiff
path: root/tests/test_ftrace.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ftrace.py')
-rw-r--r--tests/test_ftrace.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_ftrace.py b/tests/test_ftrace.py
index 7d7874a..e6f6319 100644
--- a/tests/test_ftrace.py
+++ b/tests/test_ftrace.py
@@ -230,6 +230,31 @@ class TestFTrace(BaseTestThermal):
# Make sure there are no NaNs in the middle of the array
self.assertTrue(allfreqs[0][1]["A57_freq_in"].notnull().all())
+ def test_apply_callbacks(self):
+ """Test apply_callbacks()"""
+
+ counts = {
+ "cpu_in_power": 0,
+ "cpu_out_power": 0
+ }
+
+ def cpu_in_power_fn(data):
+ counts["cpu_in_power"] += 1
+
+ def cpu_out_power_fn(data):
+ counts["cpu_out_power"] += 1
+
+ fn_map = {
+ "cpu_in_power": cpu_in_power_fn,
+ "cpu_out_power": cpu_out_power_fn
+ }
+ trace = trappy.FTrace()
+
+ trace.apply_callbacks(fn_map)
+
+ self.assertEqual(counts["cpu_in_power"], 134)
+ self.assertEqual(counts["cpu_out_power"], 134)
+
def test_plot_freq_hists(self):
"""Test that plot_freq_hists() doesn't bomb"""