Skip to content

Commit c87dc2b

Browse files
authored
[lldb-dap] Speed up TestDAP_Progress (#134048)
While trying to make progress on #133782, I noticed that TestDAP_Progress was taking 90 seconds to complete. This patch brings that down to 10 seocnds by making the following changes: 1. Don't call `wait_for_event` with a 15 second timeout. By the time we call this, all progress events have been emitted, which means that we're just sitting there until we hit the timeout. 2. Don't use 10 steps (= 10 seconds) for indeterminate progress. We have two indeterminate progress tests so that's 6 seconds instead of 20. 3. Don't launch the process over and over. Once we have a dap session, we can clear the progress vector and emit new progress events.
1 parent 3bdf9a0 commit c87dc2b

File tree

2 files changed

+10
-49
lines changed

2 files changed

+10
-49
lines changed

lldb/test/API/tools/lldb-dap/progress/Progress_emitter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ def __call__(self, debugger, command, exe_ctx, result):
8888
progress = lldb.SBProgress(
8989
"Progress tester", "Initial Detail", total, debugger
9090
)
91-
# Check to see if total is set to None to indicate an indeterminate progress
92-
# then default to 10 steps.
91+
# Check to see if total is set to None to indicate an indeterminate
92+
# progress then default to 3 steps.
9393
with progress:
9494
if total is None:
95-
total = 10
95+
total = 3
9696

9797
for i in range(1, total):
9898
if cmd_options.no_details:

lldb/test/API/tools/lldb-dap/progress/TestDAP_Progress.py

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def verify_progress_events(
1919
expected_not_in_message=None,
2020
only_verify_first_update=False,
2121
):
22-
self.dap_server.wait_for_event("progressEnd", 15)
2322
self.assertTrue(len(self.dap_server.progress_events) > 0)
2423
start_found = False
2524
update_found = False
@@ -45,20 +44,18 @@ def verify_progress_events(
4544
self.assertTrue(start_found)
4645
self.assertTrue(update_found)
4746
self.assertTrue(end_found)
47+
self.dap_server.progress_events.clear()
4848

4949
@skipIfWindows
50-
def test_output(self):
50+
def test(self):
5151
program = self.getBuildArtifact("a.out")
5252
self.build_and_launch(program)
5353
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
54-
source = "main.cpp"
55-
breakpoint_ids = self.set_source_breakpoints(
56-
source, [line_number(source, "// break here")]
57-
)
58-
self.continue_to_breakpoints(breakpoint_ids)
5954
self.dap_server.request_evaluate(
6055
f"`command script import {progress_emitter}", context="repl"
6156
)
57+
58+
# Test details.
6259
self.dap_server.request_evaluate(
6360
"`test-progress --total 3 --seconds 1", context="repl"
6461
)
@@ -68,19 +65,7 @@ def test_output(self):
6865
expected_not_in_message="Progress tester",
6966
)
7067

71-
@skipIfWindows
72-
def test_output_nodetails(self):
73-
program = self.getBuildArtifact("a.out")
74-
self.build_and_launch(program)
75-
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
76-
source = "main.cpp"
77-
breakpoint_ids = self.set_source_breakpoints(
78-
source, [line_number(source, "// break here")]
79-
)
80-
self.continue_to_breakpoints(breakpoint_ids)
81-
self.dap_server.request_evaluate(
82-
f"`command script import {progress_emitter}", context="repl"
83-
)
68+
# Test no details.
8469
self.dap_server.request_evaluate(
8570
"`test-progress --total 3 --seconds 1 --no-details", context="repl"
8671
)
@@ -90,19 +75,7 @@ def test_output_nodetails(self):
9075
expected_message="Initial Detail",
9176
)
9277

93-
@skipIfWindows
94-
def test_output_indeterminate(self):
95-
program = self.getBuildArtifact("a.out")
96-
self.build_and_launch(program)
97-
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
98-
source = "main.cpp"
99-
breakpoint_ids = self.set_source_breakpoints(
100-
source, [line_number(source, "// break here")]
101-
)
102-
self.continue_to_breakpoints(breakpoint_ids)
103-
self.dap_server.request_evaluate(
104-
f"`command script import {progress_emitter}", context="repl"
105-
)
78+
# Test details indeterminate.
10679
self.dap_server.request_evaluate("`test-progress --seconds 1", context="repl")
10780

10881
self.verify_progress_events(
@@ -111,19 +84,7 @@ def test_output_indeterminate(self):
11184
only_verify_first_update=True,
11285
)
11386

114-
@skipIfWindows
115-
def test_output_nodetails_indeterminate(self):
116-
program = self.getBuildArtifact("a.out")
117-
self.build_and_launch(program)
118-
progress_emitter = os.path.join(os.getcwd(), "Progress_emitter.py")
119-
source = "main.cpp"
120-
breakpoint_ids = self.set_source_breakpoints(
121-
source, [line_number(source, "// break here")]
122-
)
123-
self.dap_server.request_evaluate(
124-
f"`command script import {progress_emitter}", context="repl"
125-
)
126-
87+
# Test no details indeterminate.
12788
self.dap_server.request_evaluate(
12889
"`test-progress --seconds 1 --no-details", context="repl"
12990
)

0 commit comments

Comments
 (0)