[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/mbucko closed https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -200,7 +200,10 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console( +timeout_secs=1.0, adrian-prantl wrote: These timeouts look like they're way too small for CI (should be more in the 10s of seconds range and under ASAN they should be multipled by a factor 10). https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/mbucko created https://github.com/llvm/llvm-project/pull/94494 Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py >From 0d1eb164ab12773cb574de6066b717fd4c4c9e31 Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Wed, 5 Jun 2024 09:03:38 -0700 Subject: [PATCH] Fix flaky TestDAP_console test. Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --- lldb/test/API/tools/lldb-dap/console/TestDAP_console.py | 4 1 file changed, 4 insertions(+) diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index e6345818bf087..fad4c31bb7658 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -141,6 +141,10 @@ def test_exit_status_message_sigterm(self): # Get the console output console_output = self.collect_console(1.0) +n_reads = 0 +while n_reads < 10 and "exited with status" not in console_output: +console_output += self.collect_console(1.0) +n_reads += 1 # Verify the exit status message is printed. self.assertIn( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Miro Bucko (mbucko) Changes Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --- Full diff: https://github.com/llvm/llvm-project/pull/94494.diff 1 Files Affected: - (modified) lldb/test/API/tools/lldb-dap/console/TestDAP_console.py (+4) ``diff diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index e6345818bf087..fad4c31bb7658 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -141,6 +141,10 @@ def test_exit_status_message_sigterm(self): # Get the console output console_output = self.collect_console(1.0) +n_reads = 0 +while n_reads < 10 and "exited with status" not in console_output: +console_output += self.collect_console(1.0) +n_reads += 1 # Verify the exit status message is printed. self.assertIn( `` https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/walter-erquinigo approved this pull request. https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
JDevlieghere wrote: Would this affect other calls to `collect_console` too? Do we usually look for a particular string? If so, would it make sense to change the function (rather than this particular call site) or have a little helper? https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
mbucko wrote: > Would this affect other calls to `collect_console` too? Do we usually look > for a particular string? If so, would it make sense to change the function > (rather than this particular call site) or have a little helper? The problem is that the console hasn't had enough time to collect the logs after the process was terminated. This fix will keep collecting the logs until the "exited with status..." log has been collected so that we can check it. The caller could specify 10.0 seconds timeout instead of 1.0 second, but this way the caller can exit earlier rather than forcefully waiting on the timeout. https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
JDevlieghere wrote: > The problem is that the console hasn't had enough time to collect the logs > after the process was terminated. This fix will keep collecting the logs > until the "exited with status..." log has been collected so that we can check > it. The caller could specify 10.0 seconds timeout instead of 1.0 second, but > this way the caller can exit earlier rather than forcefully waiting on the > timeout. I wasn't suggesting to increase the timeout, but instead change the function to do exactly what you did here: have a smaller timeout and repeatedly check for a particular string, assuming that's a common pattern. The motivation being that other places where we do this probably also suffer from this, and it's just a matter of time before we see flakiness there too. https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
walter-erquinigo wrote: Jonas' suggestion is pretty good. Please do that. Probably something like this would work ` def collect_console(timeout_secs=10, check_interval_secs=1): ... ` Then you can just update every caller of this function to just do `collect_console()` https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/94494 >From ea050132f653a908eeefecd647431a0ed65e2cc0 Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Wed, 5 Jun 2024 09:03:38 -0700 Subject: [PATCH] Fix flaky TestDAP_console test. Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 6 -- .../lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py | 4 ++-- lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py | 4 ++-- lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py | 6 +++--- lldb/test/API/tools/lldb-dap/console/TestDAP_console.py | 5 ++--- lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py | 4 ++-- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e2126d67a5fe7..a9eeec1840990 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -171,13 +171,15 @@ def get_output(self, category, timeout=0.0, clear=True): self.output_condition.release() return output -def collect_output(self, category, duration, clear=True): -end_time = time.time() + duration +def collect_output(self, category, timeout_secs, pattern, clear=True): +end_time = time.time() + timeout_secs collected_output = "" while end_time > time.time(): output = self.get_output(category, timeout=0.25, clear=clear) if output: collected_output += output +if pattern is not None and pattern in output: +break return collected_output if collected_output else None def enqueue_recv_packet(self, packet): diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index d56ea5dca14be..e3796edb2291d 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,8 +195,8 @@ def get_stdout(self, timeout=0.0): def get_console(self, timeout=0.0): return self.dap_server.get_output("console", timeout=timeout) -def collect_console(self, duration): -return self.dap_server.collect_output("console", duration=duration) +def collect_console(self, timeout_secs, pattern=None): +return self.dap_server.collect_output("console", timeout_secs=timeout_secs, pattern=pattern) def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index b3ba69749f673..17a54d996cea6 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -200,7 +200,7 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) self.verify_commands("exitCommands", output, exitCommands) self.verify_commands("terminateCommands", output, terminateCommands) @@ -235,5 +235,5 @@ def test_terminate_commands(self): # Once it's disconnected the console should contain the # "terminateCommands" self.dap_server.request_disconnect(terminateDebuggee=True) -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) self.verify_commands("terminateCommands", output, terminateCommands) diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py index 226b9385fe719..313ae3685b91a 100644 --- a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py +++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py @@ -22,7 +22,7 @@ def test_command_directive_quiet_on_success(self): stopCommands=["?" + command_quiet, command_not_quiet], exitCommands=["?" + command_quiet, command_not_quiet], ) -full_output = self.collect_console(duration=1.0) +full_output = self.collect_console(timeout_secs=1.0) self.assertNotIn(command_quiet, full_output) self.assertIn(command_not_quiet, full_output) @@ -47,7 +47,7 @@ def do_test_abort_on_error( postRunCommands=commands if use_post_run_commands else None, expect
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r f26bc5f0c421c7a01a1a611249dd7483b749bab5...ea050132f653a908eeefecd647431a0ed65e2cc0 lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py lldb/test/API/tools/lldb-dap/console/TestDAP_console.py lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py `` View the diff from darker here. ``diff --- packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 2024-06-10 18:17:24.00 + +++ packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 2024-06-10 18:20:19.439593 + @@ -194,11 +194,13 @@ def get_console(self, timeout=0.0): return self.dap_server.get_output("console", timeout=timeout) def collect_console(self, timeout_secs, pattern=None): -return self.dap_server.collect_output("console", timeout_secs=timeout_secs, pattern=pattern) +return self.dap_server.collect_output( +"console", timeout_secs=timeout_secs, pattern=pattern +) def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) # 'value' may have the variable value and summary. # Extract the variable value since summary can have nonnumeric characters. --- test/API/tools/lldb-dap/console/TestDAP_console.py 2024-06-10 18:17:24.00 + +++ test/API/tools/lldb-dap/console/TestDAP_console.py 2024-06-10 18:20:19.569320 + @@ -138,11 +138,13 @@ process = get_subprocess(psutil.Process(os.getpid()), process_name) process.terminate() process.wait() # Get the console output -console_output = self.collect_console(timeout_secs=10.0, pattern="exited with status") +console_output = self.collect_console( +timeout_secs=10.0, pattern="exited with status" +) # Verify the exit status message is printed. self.assertIn( "exited with status = -1 (0x) debugserver died with signal SIGTERM", console_output, @@ -154,11 +156,13 @@ program = self.getBuildArtifact("a.out") self.build_and_launch(program, commandEscapePrefix="") self.continue_to_exit() # Get the console output -console_output = self.collect_console(timeout_secs=10.0, pattern="exited with status") +console_output = self.collect_console( +timeout_secs=10.0, pattern="exited with status" +) # Verify the exit status message is printed. self.assertIn( "exited with status = 0 (0x)", console_output, `` https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/94494 >From 5e92ee56b2b278b3ddad04cfdb1f440d3568389c Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Wed, 5 Jun 2024 09:03:38 -0700 Subject: [PATCH] Fix flaky TestDAP_console test. Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --- .../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 6 -- .../lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py| 6 -- lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py| 4 ++-- .../test/API/tools/lldb-dap/commands/TestDAP_commands.py | 6 +++--- lldb/test/API/tools/lldb-dap/console/TestDAP_console.py | 9 ++--- lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py| 4 ++-- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e2126d67a5fe7..a9eeec1840990 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -171,13 +171,15 @@ def get_output(self, category, timeout=0.0, clear=True): self.output_condition.release() return output -def collect_output(self, category, duration, clear=True): -end_time = time.time() + duration +def collect_output(self, category, timeout_secs, pattern, clear=True): +end_time = time.time() + timeout_secs collected_output = "" while end_time > time.time(): output = self.get_output(category, timeout=0.25, clear=clear) if output: collected_output += output +if pattern is not None and pattern in output: +break return collected_output if collected_output else None def enqueue_recv_packet(self, packet): diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index d56ea5dca14be..600dc2b5fe9bb 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,8 +195,10 @@ def get_stdout(self, timeout=0.0): def get_console(self, timeout=0.0): return self.dap_server.get_output("console", timeout=timeout) -def collect_console(self, duration): -return self.dap_server.collect_output("console", duration=duration) +def collect_console(self, timeout_secs, pattern=None): +return self.dap_server.collect_output( +"console", timeout_secs=timeout_secs, pattern=pattern +) def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index b3ba69749f673..17a54d996cea6 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -200,7 +200,7 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) self.verify_commands("exitCommands", output, exitCommands) self.verify_commands("terminateCommands", output, terminateCommands) @@ -235,5 +235,5 @@ def test_terminate_commands(self): # Once it's disconnected the console should contain the # "terminateCommands" self.dap_server.request_disconnect(terminateDebuggee=True) -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) self.verify_commands("terminateCommands", output, terminateCommands) diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py index 226b9385fe719..313ae3685b91a 100644 --- a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py +++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py @@ -22,7 +22,7 @@ def test_command_directive_quiet_on_success(self): stopCommands=["?" + command_quiet, command_not_quiet], exitCommands=["?" + command_quiet, command_not_quiet], ) -full_output = self.collect_console(duration=1.0) +full_output = self.collect_console(timeout_secs=1.0) self.assertNotIn(command_quiet, full_output) self.assertIn(command_not_quiet, full_output) @@ -47,7 +47,7 @@ def do_test_abort_on_error( postRunCommands=commands if use_post_run_commands else None,
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -467,5 +467,5 @@ def test_terminate_commands(self): # Once it's disconnected the console should contain the # "terminateCommands" self.dap_server.request_disconnect(terminateDebuggee=True) -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `terminateCommands` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -75,6 +75,6 @@ def test_command_directive_abort_on_error_attach_commands(self): attachCommands=["?!" + command_quiet, "!" + command_abort_on_error], expectFailure=True, ) -full_output = self.collect_console(duration=1.0) +full_output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `settings` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -47,7 +47,7 @@ def do_test_abort_on_error( postRunCommands=commands if use_post_run_commands else None, expectFailure=True, ) -full_output = self.collect_console(duration=1.0) +full_output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `settings` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -235,5 +235,5 @@ def test_terminate_commands(self): # Once it's disconnected the console should contain the # "terminateCommands" self.dap_server.request_disconnect(terminateDebuggee=True) -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `terminateCommands` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -200,7 +200,7 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `terminateCommands` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
@@ -337,7 +337,7 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console(timeout_secs=1.0) walter-erquinigo wrote: add `terminateCommands` to the pattern https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/mbucko updated https://github.com/llvm/llvm-project/pull/94494 >From 39c8c9aa1cc45fd4cfd16fe841f65a4d1cb08cf4 Mon Sep 17 00:00:00 2001 From: Miro Bucko Date: Wed, 5 Jun 2024 09:03:38 -0700 Subject: [PATCH] Fix flaky TestDAP_console test. Test Plan: llvm-lit llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --- .../lldbsuite/test/tools/lldb-dap/dap_server.py | 6 -- .../test/tools/lldb-dap/lldbdap_testcase.py | 6 -- .../API/tools/lldb-dap/attach/TestDAP_attach.py | 10 -- .../tools/lldb-dap/commands/TestDAP_commands.py | 15 --- .../API/tools/lldb-dap/console/TestDAP_console.py | 9 ++--- .../API/tools/lldb-dap/launch/TestDAP_launch.py | 10 -- 6 files changed, 42 insertions(+), 14 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e2126d67a5fe7..a9eeec1840990 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -171,13 +171,15 @@ def get_output(self, category, timeout=0.0, clear=True): self.output_condition.release() return output -def collect_output(self, category, duration, clear=True): -end_time = time.time() + duration +def collect_output(self, category, timeout_secs, pattern, clear=True): +end_time = time.time() + timeout_secs collected_output = "" while end_time > time.time(): output = self.get_output(category, timeout=0.25, clear=clear) if output: collected_output += output +if pattern is not None and pattern in output: +break return collected_output if collected_output else None def enqueue_recv_packet(self, packet): diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index d56ea5dca14be..600dc2b5fe9bb 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -195,8 +195,10 @@ def get_stdout(self, timeout=0.0): def get_console(self, timeout=0.0): return self.dap_server.get_output("console", timeout=timeout) -def collect_console(self, duration): -return self.dap_server.collect_output("console", duration=duration) +def collect_console(self, timeout_secs, pattern=None): +return self.dap_server.collect_output( +"console", timeout_secs=timeout_secs, pattern=pattern +) def get_local_as_int(self, name, threadId=None): value = self.dap_server.get_local_variable_value(name, threadId=threadId) diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index b3ba69749f673..1dbe00144f352 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -200,7 +200,10 @@ def test_commands(self): # Get output from the console. This should contain both the # "exitCommands" that were run after the second breakpoint was hit # and the "terminateCommands" due to the debugging session ending -output = self.collect_console(duration=1.0) +output = self.collect_console( +timeout_secs=1.0, +pattern=terminateCommands[0], +) self.verify_commands("exitCommands", output, exitCommands) self.verify_commands("terminateCommands", output, terminateCommands) @@ -235,5 +238,8 @@ def test_terminate_commands(self): # Once it's disconnected the console should contain the # "terminateCommands" self.dap_server.request_disconnect(terminateDebuggee=True) -output = self.collect_console(duration=1.0) +output = self.collect_console( +timeout_secs=1.0, +pattern=terminateCommands[0], +) self.verify_commands("terminateCommands", output, terminateCommands) diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py index 226b9385fe719..e4cf903fc0d11 100644 --- a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py +++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py @@ -22,7 +22,10 @@ def test_command_directive_quiet_on_success(self): stopCommands=["?" + command_quiet, command_not_quiet], exitCommands=["?" + command_quiet, command_not_quiet], ) -full_output = self.collect_console(duration=1.0) +full_output = self.collect_console( +timeout_secs=1.0, +pattern=command_not_quiet, +) self.assertNotIn(command_quiet, full_outp
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
https://github.com/JDevlieghere approved this pull request. Thanks. LGTM! https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
mbucko wrote: > Thanks. LGTM! Would you be able to Merge it in? https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix flaky TestDAP_console test. (PR #94494)
walter-erquinigo wrote: @mbucko , could you request commit access to Chris Latner? ``` We grant commit access to contributors with a track record of submitting high quality patches. If you would like commit access, please send an email to [Chris](mailto:clattner%40llvm.org) with your GitHub username. ``` That would be very helpful in case you break the build bots and want to push a hot fix. https://github.com/llvm/llvm-project/pull/94494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits