summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/process_attach
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 11:09:23 +0000
commitf73363f1dd94996356cefbf24388f561891acf0b (patch)
treee3c31248bdb36eaec5fd833490d4278162dba2a0 /packages/Python/lldbsuite/test/functionalities/process_attach
parent160ee69dd7ae18978f4068116777639ea98dc951 (diff)
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/process_attach')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py14
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile7
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py5
-rw-r--r--packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist8
4 files changed, 25 insertions, 9 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
index c4d372cd3d301..617b4bcfaec35 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
@@ -27,7 +27,7 @@ class ProcessAttachTestCase(TestBase):
def test_attach_to_process_by_id(self):
"""Test attach by process id"""
self.build()
- exe = os.path.join(os.getcwd(), exe_name)
+ exe = self.getBuildArtifact(exe_name)
# Spawn a new process
popen = self.spawnSubprocess(exe)
@@ -43,13 +43,13 @@ class ProcessAttachTestCase(TestBase):
@expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], bugnumber="<rdar://problem/34538611>") # old lldb-server has race condition, launching an inferior and then launching debugserver in quick succession sometimes fails
def test_attach_to_process_from_different_dir_by_id(self):
"""Test attach by process id"""
+ newdir = self.getBuildArtifact("newdir")
try:
- os.mkdir(os.path.join(os.getcwd(),'newdir'))
- except OSError, e:
+ os.mkdir(newdir)
+ except OSError as e:
if e.errno != os.errno.EEXIST:
raise
- testdir = os.getcwd()
- newdir = os.path.join(testdir,'newdir')
+ testdir = self.getBuildDir()
exe = os.path.join(newdir, 'proc_attach')
self.buildProgram('main.cpp', exe)
self.addTearDownHook(lambda: shutil.rmtree(newdir))
@@ -58,7 +58,7 @@ class ProcessAttachTestCase(TestBase):
popen = self.spawnSubprocess(exe)
self.addTearDownHook(self.cleanupSubprocesses)
- os.chdir('newdir')
+ os.chdir(newdir)
self.addTearDownHook(lambda: os.chdir(testdir))
self.runCmd("process attach -p " + str(popen.pid))
@@ -71,7 +71,7 @@ class ProcessAttachTestCase(TestBase):
def test_attach_to_process_by_name(self):
"""Test attach by process name"""
self.build()
- exe = os.path.join(os.getcwd(), exe_name)
+ exe = self.getBuildArtifact(exe_name)
# Spawn a new process
popen = self.spawnSubprocess(exe)
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
index 87600bbccf9d6..3c1f73515eb7c 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/Makefile
@@ -4,4 +4,11 @@ CXX_SOURCES := main.cpp
EXE := AttachDenied
+all: AttachDenied sign
+
include $(LEVEL)/Makefile.rules
+
+sign: entitlements.plist AttachDenied
+ifeq ($(OS),Darwin)
+ codesign -s - -f --entitlements $^
+endif
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
index 5465b7155f501..b915b541fb4be 100644
--- a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
@@ -18,6 +18,7 @@ exe_name = 'AttachDenied' # Must match Makefile
class AttachDeniedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
@skipIfWindows
@skipIfiOSSimulator
@@ -25,10 +26,10 @@ class AttachDeniedTestCase(TestBase):
def test_attach_to_process_by_id_denied(self):
"""Test attach by process id denied"""
self.build()
- exe = os.path.join(os.getcwd(), exe_name)
+ exe = self.getBuildArtifact(exe_name)
# Use a file as a synchronization point between test and inferior.
- pid_file_path = lldbutil.append_to_process_working_directory(
+ pid_file_path = lldbutil.append_to_process_working_directory(self,
"pid_file_%d" % (int(time.time())))
self.addTearDownHook(
lambda: self.run_platform_command(
diff --git a/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
new file mode 100644
index 0000000000000..3d60e8bd0b94d
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/entitlements.plist
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>com.apple.security.cs.debugger</key>
+ <true/>
+</dict>
+</plist>