================ @@ -41,8 +41,136 @@ def test_output(self): for event in self.dap_server.progress_events: event_type = event["event"] if "progressStart" in event_type: + title = event["body"]["title"] + self.assertIn("Progress tester", title) start_found = True if "progressUpdate" in event_type: + message = event["body"]["message"] + print(f"Progress update: {message}") + self.assertNotIn("Progres tester", message) + update_found = True + + self.assertTrue(start_found) + self.assertTrue(update_found) + + @skipIfWindows + def test_output_nodetails(self): + program = self.getBuildArtifact("a.out") + self.build_and_launch(program) + progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py") + print(f"Progress emitter path: {progress_emitter}") + source = "main.cpp" + breakpoint_ids = self.set_source_breakpoints( + source, [line_number(source, "// break here")] + ) + self.continue_to_breakpoints(breakpoint_ids) + self.dap_server.request_evaluate( + f"`command script import {progress_emitter}", context="repl" + ) + self.dap_server.request_evaluate( + "`test-progress --total 3 --seconds 1 --no-details", context="repl" + ) + + self.dap_server.wait_for_event("progressEnd", 15) + # Expect at least a start, an update, and end event + # However because the underlying Progress instance is an RAII object and we can't guaruntee + # it's deterministic destruction in the python API, we verify just start and update + # otherwise this test could be flakey. ---------------- clayborg wrote:
Don't rely on RAII, either send the end event manually or set the progress object to `None` to force it to finish up. Might be worth adding documentation notes in the SBProcess*.i files to let users know how to make sure the finish event will get sent, or document to send it manually. https://github.com/llvm/llvm-project/pull/124648 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits