Skip to content

Commit 806c0f7

Browse files
committed
Update test to break before dumping statistics
1 parent 17bd069 commit 806c0f7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ def test_stats_api(self):
1616
"""
1717
self.build()
1818
exe = self.getBuildArtifact("a.out")
19-
target = self.dbg.CreateTarget(exe)
19+
# Launch a process and break
20+
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
21+
self, "break here", lldb.SBFileSpec("main.c")
22+
)
2023

2124
# Test enabling/disabling stats
2225
self.assertFalse(target.GetCollectingStats())
@@ -79,16 +82,17 @@ def test_stats_api(self):
7982
stats_options.SetSummaryOnly(True)
8083
stats_summary = target.GetStatistics(stats_options)
8184
stream_summary = lldb.SBStream()
82-
res = stats_summary.GetAsJSON(stream_summary)
85+
stats_summary.GetAsJSON(stream_summary)
8386
debug_stats_summary = json.loads(stream_summary.GetData())
8487
self.assertNotIn("modules", debug_stats_summary)
8588
self.assertNotIn("memory", debug_stats_summary)
8689
self.assertNotIn("commands", debug_stats_summary)
8790

8891
# Summary values should be the same as in full statistics.
92+
# Except the parse time on Mac OS X is not deterministic.
8993
for key, value in debug_stats_summary.items():
9094
self.assertIn(key, debug_stats)
91-
if key != "targets":
95+
if key != "targets" and not key.endswith("Time"):
9296
self.assertEqual(debug_stats[key], value)
9397

9498
def test_command_stats_api(self):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
int main(void) {
2-
return 0;
2+
return 0; // break here
33
}

0 commit comments

Comments
 (0)