summaryrefslogtreecommitdiff
path: root/simpleperf/scripts/test/report_html_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'simpleperf/scripts/test/report_html_test.py')
-rw-r--r--simpleperf/scripts/test/report_html_test.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/simpleperf/scripts/test/report_html_test.py b/simpleperf/scripts/test/report_html_test.py
index 7241a5e1..32e58219 100644
--- a/simpleperf/scripts/test/report_html_test.py
+++ b/simpleperf/scripts/test/report_html_test.py
@@ -276,3 +276,18 @@ class TestReportHtml(TestBase):
self.assertEqual(thread_names['AsyncTask.*'], 19)
self.assertNotIn('AsyncTask #3', thread_names)
self.assertNotIn('AsyncTask #4', thread_names)
+
+ def test_sort_call_graph_by_function_name(self):
+ record_data = self.get_record_data(
+ ['-i', TestHelper.testdata_path('perf_display_bitmaps.data'),
+ '--aggregate-threads', '.*'])
+
+ def get_func_name(func_id: int) -> str:
+ return record_data['functionMap'][str(func_id)]['f']
+
+ # Test if the top functions are sorted by function names.
+ thread = record_data['sampleInfo'][0]['processes'][0]['threads'][0]
+ top_functions = [get_func_name(c['f']) for c in thread['g']['c']]
+ self.assertIn('__libc_init', top_functions)
+ self.assertIn('__start_thread', top_functions)
+ self.assertEqual(top_functions, sorted(top_functions))