================ @@ -70,3 +73,26 @@ def test_stats_api(self): True, 'Make sure the "failures" key in in "frameVariable" dictionary"', ) + + def test_command_stats_api(self): + """ + Test GetCommandInterpreter::GetStatistics() API. + """ + self.build() + exe = self.getBuildArtifact("a.out") + lldbutil.run_to_name_breakpoint(self, "main") + + interp = self.dbg.GetCommandInterpreter() + result = lldb.SBCommandReturnObject() + interp.HandleCommand("bt", result) + + stream = lldb.SBStream() + res = interp.GetStatistics().GetAsJSON(stream) + command_stats = json.loads(stream.GetData()) + + # Verify bt command is correctly parsed into final form. + self.assertEqual(command_stats["thread backtrace"], 1) + # Verify original raw command is not duplicatedly captured. + self.assertNotIn("bt", command_stats) + # Verify bt's regex command is not duplicatedly captured. + self.assertNotIn("_regexp-bt", command_stats) ---------------- clayborg wrote:
Same worry here as the above inline comment in the previous test if a fresh lldb process isn't used for each test. Might need to do FileCheck test? https://github.com/llvm/llvm-project/pull/80375 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits