aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thornburgh <dthorn@google.com>2023-09-20 14:30:24 -0700
committerDaniel Thornburgh <dthorn@google.com>2023-09-20 14:30:24 -0700
commit7f3467412ed52d6749b7c53f7934c4374c6d2a00 (patch)
tree5ebc945f0a1ed2f8e01f1d2329ded63fd149d5c4
parent56b148aa8d6fcc61f0619d74cf5edcabbbb4d842 (diff)
downloadllvm-7f3467412ed52d6749b7c53f7934c4374c6d2a00.zip
llvm-7f3467412ed52d6749b7c53f7934c4374c6d2a00.tar.gz
llvm-7f3467412ed52d6749b7c53f7934c4374c6d2a00.tar.bz2
Revert "Remove some raciness from the TestProcessAttach.test_run_then_attach_wait_interrupt"
This reverts commit df93c4ffdf220630ecceba5c9a7822c0aca7deaa. This change is breaking the LLDB CI builders, e.g. https://lab.llvm.org/buildbot/#/builders/68/builds/60350
-rw-r--r--lldb/test/API/commands/process/attach/TestProcessAttach.py83
1 files changed, 0 insertions, 83 deletions
diff --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py b/lldb/test/API/commands/process/attach/TestProcessAttach.py
index 1f535997..0e916d2 100644
--- a/lldb/test/API/commands/process/attach/TestProcessAttach.py
+++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py
@@ -4,8 +4,6 @@ Test process attach.
import os
-import threading
-import time
import lldb
import shutil
from lldbsuite.test.decorators import *
@@ -130,84 +128,3 @@ class ProcessAttachTestCase(TestBase):
# Call super's tearDown().
TestBase.tearDown(self)
-
- def test_run_then_attach_wait_interrupt(self):
- # Test that having run one process doesn't cause us to be unable
- # to interrupt a subsequent attach attempt.
- self.build()
- exe = self.getBuildArtifact(exe_name)
-
- target = lldbutil.run_to_breakpoint_make_target(self, exe_name, True)
- launch_info = target.GetLaunchInfo()
- launch_info.SetArguments(["q"], True)
- error = lldb.SBError()
- target.Launch(launch_info, error)
- self.assertSuccess(error, "Launched a process")
- self.assertState(target.process.state, lldb.eStateExited, "and it exited.")
-
- # Okay now we've run a process, try to attach/wait to something
- # and make sure that we can interrupt that.
-
- options = lldb.SBCommandInterpreterRunOptions()
- options.SetPrintResults(True)
- options.SetEchoCommands(False)
-
- self.stdin_path = self.getBuildArtifact("stdin.txt")
-
- with open(self.stdin_path, "w") as input_handle:
- input_handle.write("process attach -w -n noone_would_use_this_name\nquit")
-
- # Python will close the file descriptor if all references
- # to the filehandle object lapse, so we need to keep one
- # around.
- self.filehandle = open(self.stdin_path, "r")
- self.dbg.SetInputFileHandle(self.filehandle, False)
-
- # No need to track the output
- self.stdout_path = self.getBuildArtifact("stdout.txt")
- self.out_filehandle = open(self.stdout_path, "w")
- self.dbg.SetOutputFileHandle(self.out_filehandle, False)
- self.dbg.SetErrorFileHandle(self.out_filehandle, False)
-
- n_errors, quit_req, crashed = self.dbg.RunCommandInterpreter(
- True, True, options, 0, False, False)
-
- while 1:
- time.sleep(1)
- if target.process.state == lldb.eStateAttaching:
- break
-
- self.dbg.DispatchInputInterrupt()
- self.dbg.DispatchInputInterrupt()
-
- # cycle waiting for the process state to change before trying
- # to read the command output. I don't want to spin forever.
- counter = 0
- got_exit = False
- while counter < 20:
- if target.process.state == lldb.eStateExited:
- got_exit = True
- break
- counter += 1
- time.sleep(1)
-
- self.assertTrue(got_exit, "The process never switched to eStateExited")
- # Even if the state has flipped, we still need to wait for the
- # command to complete to see the result. We don't have a way to
- # synchronize on "command completed" right now, but sleeping just
- # a bit should be enough, all that's left is passing this error
- # result to the command, and printing it to the debugger output.
- time.sleep(1)
-
- self.out_filehandle.flush()
- reader = open(self.stdout_path, "r")
- results = reader.readlines()
- found_result = False
- for line in results:
- if "Cancelled async attach" in line:
- found_result = True
- break
- if not found_result:
- print(f"Results: {results}")
-
- self.assertTrue(found_result, "Found async error in results")