Skip to content

[lldb-dap] Speed up TestDAP_Progress #134048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lldb/test/API/tools/lldb-dap/progress/Progress_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def __call__(self, debugger, command, exe_ctx, result):
progress = lldb.SBProgress(
"Progress tester", "Initial Detail", total, debugger
)
# Check to see if total is set to None to indicate an indeterminate progress
# then default to 10 steps.
# Check to see if total is set to None to indicate an indeterminate
# progress then default to 3 steps.
with progress:
if total is None:
total = 10
total = 3

for i in range(1, total):
if cmd_options.no_details:
Expand Down
53 changes: 7 additions & 46 deletions lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def verify_progress_events(
expected_not_in_message=None,
only_verify_first_update=False,
):
self.dap_server.wait_for_event("progressEnd", 15)
self.assertTrue(len(self.dap_server.progress_events) > 0)
start_found = False
update_found = False
Expand All @@ -45,20 +44,18 @@ def verify_progress_events(
self.assertTrue(start_found)
self.assertTrue(update_found)
self.assertTrue(end_found)
self.dap_server.progress_events.clear()

@skipIfWindows
def test_output(self):
def test(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
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"
)

# Test details.
self.dap_server.request_evaluate(
"`test-progress --total 3 --seconds 1", context="repl"
)
Expand All @@ -68,19 +65,7 @@ def test_output(self):
expected_not_in_message="Progress tester",
)

@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")
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"
)
# Test no details.
self.dap_server.request_evaluate(
"`test-progress --total 3 --seconds 1 --no-details", context="repl"
)
Expand All @@ -90,19 +75,7 @@ def test_output_nodetails(self):
expected_message="Initial Detail",
)

@skipIfWindows
def test_output_indeterminate(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
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"
)
# Test details indeterminate.
self.dap_server.request_evaluate("`test-progress --seconds 1", context="repl")

self.verify_progress_events(
Expand All @@ -111,19 +84,7 @@ def test_output_indeterminate(self):
only_verify_first_update=True,
)

@skipIfWindows
def test_output_nodetails_indeterminate(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program)
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
source = "main.cpp"
breakpoint_ids = self.set_source_breakpoints(
source, [line_number(source, "// break here")]
)
self.dap_server.request_evaluate(
f"`command script import {progress_emitter}", context="repl"
)

# Test no details indeterminate.
self.dap_server.request_evaluate(
"`test-progress --seconds 1 --no-details", context="repl"
)
Expand Down