summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py6
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbutil.py4
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py29
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py2
-rw-r--r--lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py4
7 files changed, 23 insertions, 28 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
index 481ec6d7c05..b915b541fb4 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/attach_denied/TestAttachDenied.py
+++ b/lldb/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
@@ -28,7 +29,7 @@ class AttachDeniedTestCase(TestBase):
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/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
index ad63bf2f58f..8496ce6c04d 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
@@ -13,6 +13,7 @@ from lldbsuite.test import lldbutil
class ChangeProcessGroupTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
# Call super's setUp().
@@ -29,7 +30,7 @@ class ChangeProcessGroupTestCase(TestBase):
exe = self.getBuildArtifact("a.out")
# 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/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index b0bd866e8f4..613b42f5c83 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -369,8 +369,8 @@ class _RemoteProcess(_BaseProcess):
def launch(self, executable, args):
if self._install_remote:
src_path = executable
- dst_path = lldbutil.append_to_process_working_directory(
- os.path.basename(executable))
+ dst_path = lldbutil.join_remote_paths(
+ lldb.remote_platform.GetWorkingDirectory(), os.path.basename(executable))
dst_file_spec = lldb.SBFileSpec(dst_path, False)
err = lldb.remote_platform.Install(
@@ -1987,7 +1987,7 @@ class TestBase(Base):
if lldb.remote_platform:
# We must set the remote install location if we want the shared library
# to get uploaded to the remote target
- remote_shlib_path = lldbutil.append_to_process_working_directory(
+ remote_shlib_path = lldbutil.append_to_process_working_directory(self,
os.path.basename(local_shlib_path))
shlib_module.SetRemoteInstallFileSpec(
lldb.SBFileSpec(remote_shlib_path, False))
diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 5cb1cc48a02..047a98b5dae 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -1249,11 +1249,11 @@ def join_remote_paths(*paths):
return os.path.join(*paths).replace(os.path.sep, '/')
-def append_to_process_working_directory(*paths):
+def append_to_process_working_directory(test, *paths):
remote = lldb.remote_platform
if remote:
return join_remote_paths(remote.GetWorkingDirectory(), *paths)
- return os.path.join(os.getcwd(), *paths)
+ return os.path.join(test.getBuildDir(), *paths)
# ==================================================
# Utility functions to get the correct signal number
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py b/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
index fb8a448b033..0675bec1736 100644
--- a/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
+++ b/lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
@@ -61,12 +61,6 @@ class TargetAPITestCase(TestBase):
self.get_description()
@add_test_categories(['pyapi'])
- def test_launch_new_process_and_redirect_stdout(self):
- """Exercise SBTarget.Launch() API."""
- self.build()
- self.launch_new_process_and_redirect_stdout()
-
- @add_test_categories(['pyapi'])
def test_resolve_symbol_context_with_address(self):
"""Exercise SBTarget.ResolveSymbolContextForAddress() API."""
self.build()
@@ -268,8 +262,11 @@ class TargetAPITestCase(TestBase):
substrs=['a.out', 'Target', 'Module', 'Breakpoint'])
@not_remote_testsuite_ready
- def launch_new_process_and_redirect_stdout(self):
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
+ def test_launch_new_process_and_redirect_stdout(self):
"""Exercise SBTaget.Launch() API with redirected stdout."""
+ self.build()
exe = self.getBuildArtifact("a.out")
# Create a target by the debugger.
@@ -285,9 +282,12 @@ class TargetAPITestCase(TestBase):
# Now launch the process, do not stop at entry point, and redirect stdout to "stdout.txt" file.
# The inferior should run to completion after "process.Continue()"
# call.
- local_path = "stdout.txt"
+ local_path = self.getBuildArtifact("stdout.txt")
+ if os.path.exists(local_path):
+ os.remove(local_path)
+
if lldb.remote_platform:
- stdout_path = lldbutil.append_to_process_working_directory(
+ stdout_path = lldbutil.append_to_process_working_directory(self,
"lldb-stdout-redirect.txt")
else:
stdout_path = local_path
@@ -313,20 +313,13 @@ class TargetAPITestCase(TestBase):
# The 'stdout.txt' file should now exist.
self.assertTrue(
- os.path.isfile("stdout.txt"),
+ os.path.isfile(local_path),
"'stdout.txt' exists due to redirected stdout via SBTarget.Launch() API.")
# Read the output file produced by running the program.
- with open('stdout.txt', 'r') as f:
+ with open(local_path, 'r') as f:
output = f.read()
- # Let's delete the 'stdout.txt' file as a cleanup step.
- try:
- os.remove("stdout.txt")
- pass
- except OSError:
- pass
-
self.expect(output, exe=False,
substrs=["a(1)", "b(2)", "a(3)"])
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py
index cab8a9cedfa..41205302f3b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py
@@ -20,7 +20,7 @@ class TestGdbRemoteModuleInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
self.test_sequence.add_log_lines([
'read packet: $jModulesInfo:[{"file":"%s","triple":"%s"}]]#00' % (
- lldbutil.append_to_process_working_directory("a.out"),
+ lldbutil.append_to_process_working_directory(self, "a.out"),
info["triple"].decode('hex')),
{"direction": "send",
"regex": r'^\$\[{(.*)}\]\]#[0-9A-Fa-f]{2}',
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index c20dbe3230f..6a56b23b064 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -549,7 +549,7 @@ class GdbRemoteTestCaseBase(TestBase):
inferior_exe_path = self.getBuildArtifact("a.out")
if lldb.remote_platform:
- remote_path = lldbutil.append_to_process_working_directory(
+ remote_path = lldbutil.append_to_process_working_directory(self,
os.path.basename(inferior_exe_path))
remote_file_spec = lldb.SBFileSpec(remote_path, False)
err = lldb.remote_platform.Install(lldb.SBFileSpec(
@@ -1610,7 +1610,7 @@ class GdbRemoteTestCaseBase(TestBase):
exe_path = self.getBuildArtifact("a.out")
if not lldb.remote_platform:
return [exe_path]
- remote_path = lldbutil.append_to_process_working_directory(
+ remote_path = lldbutil.append_to_process_working_directory(self,
os.path.basename(exe_path))
remote_file_spec = lldb.SBFileSpec(remote_path, False)
err = lldb.remote_platform.Install(lldb.SBFileSpec(exe_path, True),
OpenPOWER on IntegriCloud