summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/target
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-02-21 15:33:53 +0000
committerPavel Labath <labath@google.com>2018-02-21 15:33:53 +0000
commitf3a9ab07aa0e1a12bb523d795d18ca4dac2c438b (patch)
tree5bd01b05ee9cb8e9c2f7efb3d0051b7c4a8768ff /lldb/packages/Python/lldbsuite/test/python_api/target
parentcdd0675ddc8acf2b690bca4b81cd9268af91b87d (diff)
downloadbcm5719-llvm-f3a9ab07aa0e1a12bb523d795d18ca4dac2c438b.tar.gz
bcm5719-llvm-f3a9ab07aa0e1a12bb523d795d18ca4dac2c438b.zip
Fix a couple of more tests to not create files in the source tree
Summary: These were not being flaky, but they're still making the tree dirty. These tests were using lldbutil.append_to_process_working_directory to derive the file path so I fix them by modifying the function to return the build directory for local tests. Technically, now the path returned by this function does not point to the process working directory for local tests, but I think it makes sense to keep the function name, as I think we should move towards launching the process in the build directory (and I intend to change this for the handful of inferiors that actually care about their PWD, for example because they need to create files there). Reviewers: davide, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D43506 llvm-svn: 325690
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/target')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py29
1 files changed, 11 insertions, 18 deletions
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)"])
OpenPOWER on IntegriCloud