2 Test denied process attach.
8 from lldbsuite
.test
.decorators
import *
9 from lldbsuite
.test
.lldbtest
import *
10 from lldbsuite
.test
import lldbutil
12 exe_name
= "AttachDenied" # Must match Makefile
15 class AttachDeniedTestCase(TestBase
):
16 NO_DEBUG_INFO_TESTCASE
= True
20 @skipIfDarwinEmbedded # ptrace(ATTACH_REQUEST...) won't work on ios/tvos/etc
21 def test_attach_to_process_by_id_denied(self
):
22 """Test attach by process id denied"""
24 exe
= self
.getBuildArtifact(exe_name
)
26 # Use a file as a synchronization point between test and inferior.
27 pid_file_path
= lldbutil
.append_to_process_working_directory(
28 self
, "pid_file_%d" % (int(time
.time()))
31 lambda: self
.run_platform_command("rm %s" % (pid_file_path
))
35 popen
= self
.spawnSubprocess(exe
, [pid_file_path
])
37 pid
= lldbutil
.wait_for_file_on_target(self
, pid_file_path
)
40 "process attach -p " + pid
, startstr
="error: attach failed:", error
=True