Investigating some of the biggest slow downs during tests, the biggest offender is 'wait_for_stopped' requiring a negative assertion around the 'stopped' event. It currently waits for a negative predicate to fail before continuing. This means it must wait for the full DEFAULT_TIMEOUT (50s) before the test is allowed to continue. To mitigate this, I added a new `collect_events` helper that will wait for the given event to occur with the DEFAULT_TIMEOUT, then wait for a quiet period (0.25s) before returning. This greatly reduces the amount of idle waiting during tests. Additionally, looking a the performance of individual test files, `TestDAP_launch` is the slowest overall test. No individual test is that slow, but the fact it has so many tests in the same file results in the test harness waiting for that one file to finish. To mitigate that, I split `TestDAP_launch` into individual test files that run in parallel, reducing the runtime locally from over 2mins to ~5s.
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""
|
|
Test lldb-dap launch request.
|
|
"""
|
|
|
|
from lldbsuite.test.decorators import expectedFailureWindows
|
|
from lldbsuite.test.lldbtest import line_number
|
|
import lldbdap_testcase
|
|
|
|
|
|
class TestDAP_launch_version(lldbdap_testcase.DAPTestCaseBase):
|
|
"""
|
|
Tests that "initialize" response contains the "version" string the same
|
|
as the one returned by "version" command.
|
|
"""
|
|
|
|
@expectedFailureWindows(
|
|
bugnumber="https://github.com/llvm/llvm-project/issues/137599"
|
|
)
|
|
def test(self):
|
|
program = self.getBuildArtifact("a.out")
|
|
self.build_and_launch(program)
|
|
|
|
source = "main.c"
|
|
breakpoint_line = line_number(source, "// breakpoint 1")
|
|
lines = [breakpoint_line]
|
|
# Set breakpoint in the thread function so we can step the threads
|
|
breakpoint_ids = self.set_source_breakpoints(source, lines)
|
|
self.continue_to_breakpoints(breakpoint_ids)
|
|
|
|
version_eval_response = self.dap_server.request_evaluate(
|
|
"`version", context="repl"
|
|
)
|
|
version_eval_output = version_eval_response["body"]["result"]
|
|
|
|
version_string = self.dap_server.get_capability("$__lldb_version")
|
|
self.assertEqual(
|
|
version_eval_output.splitlines(),
|
|
version_string.splitlines(),
|
|
"version string does not match",
|
|
)
|