summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-03-15 13:47:09 +0000
committerPavel Labath <labath@google.com>2018-03-15 13:47:09 +0000
commit107052ff9ded599519445833d755628703027801 (patch)
treeffb1645cdd59e8a980cc33a5908377e4c9bf430d /lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
parentdfc7eb490aab97f2fc93963bd0884ee30ceb257b (diff)
downloadbcm5719-llvm-107052ff9ded599519445833d755628703027801.tar.gz
bcm5719-llvm-107052ff9ded599519445833d755628703027801.zip
Next batch of test-tree-cleaning changes
Summary: The changes here fall into several categories. - some tests were redirecting inferior stdout/err to a file. For these I make sure we use an absolute path for the file. I also create a lldbutil.read_file_on_target helper function to encapsulate the differences between reading a file locally and remotely. - some tests were redirecting the pexpect I/O into a file. For these I use a python StringIO object to avoid creating a file altogether. - the TestSettings inferior was creating a file. Here, I make sure the inferior is launched with pwd=build-dir so that the files end up created there. - lldb-mi --log (used by some tests) creates a log file in PWD without the ability say differently. To make this work I make sure to run lldb-mi with PWD=build_dir. This in turn necessitated a couple of changes in other lldb-mi tests, which were using relative paths to access the source tree. Reviewers: aprantl Subscribers: ki.stfu, mehdi_amini, lldb-commits Differential Revision: https://reviews.llvm.org/D44159 llvm-svn: 327625
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py57
1 files changed, 11 insertions, 46 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
index 6812888989b..8907ac63390 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
@@ -19,6 +19,7 @@ import six
class ProcessLaunchTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
def setUp(self):
# Call super's setUp().
@@ -38,8 +39,8 @@ class ProcessLaunchTestCase(TestBase):
patterns=["Current executable set to .*a.out"])
in_file = "input-file.txt"
- out_file = "output-test.out"
- err_file = "output-test.err"
+ out_file = lldbutil.append_to_process_working_directory(self, "output-test.out")
+ err_file = lldbutil.append_to_process_working_directory(self, "output-test.err")
# Make sure the output files do not exist before launching the process
try:
@@ -52,8 +53,8 @@ class ProcessLaunchTestCase(TestBase):
except OSError:
pass
- launch_command = "process launch -i " + \
- in_file + " -o " + out_file + " -e " + err_file
+ launch_command = "process launch -i '{0}' -o '{1}' -e '{2}' -w '{3}'".format(
+ in_file, out_file, err_file, self.get_process_working_directory())
if lldb.remote_platform:
self.runCmd('platform put-file "{local}" "{remote}"'.format(
@@ -62,55 +63,19 @@ class ProcessLaunchTestCase(TestBase):
self.expect(launch_command,
patterns=["Process .* launched: .*a.out"])
- if lldb.remote_platform:
- self.runCmd('platform get-file "{remote}" "{local}"'.format(
- remote=out_file, local=out_file))
- self.runCmd('platform get-file "{remote}" "{local}"'.format(
- remote=err_file, local=err_file))
-
success = True
err_msg = ""
- # Check to see if the 'stdout' file was created
- try:
- out_f = open(out_file)
- except IOError:
+ out = lldbutil.read_file_on_target(self, out_file)
+ if out != "This should go to stdout.\n":
success = False
- err_msg = err_msg + " ERROR: stdout file was not created.\n"
- else:
- # Check to see if the 'stdout' file contains the right output
- line = out_f.readline()
- if line != "This should go to stdout.\n":
- success = False
- err_msg = err_msg + " ERROR: stdout file does not contain correct output.\n"
- out_f.close()
+ err_msg = err_msg + " ERROR: stdout file does not contain correct output.\n"
- # Try to delete the 'stdout' file
- try:
- os.remove(out_file)
- except OSError:
- pass
- # Check to see if the 'stderr' file was created
- try:
- err_f = open(err_file)
- except IOError:
+ err = lldbutil.read_file_on_target(self, err_file)
+ if err != "This should go to stderr.\n":
success = False
- err_msg = err_msg + " ERROR: stderr file was not created.\n"
- else:
- # Check to see if the 'stderr' file contains the right output
- line = err_f.readline()
- if line != "This should go to stderr.\n":
- success = False
- err_msg = err_msg + " ERROR: stderr file does not contain correct output.\n\
-"
- err_f.close()
-
- # Try to delete the 'stderr' file
- try:
- os.remove(err_file)
- except OSError:
- pass
+ err_msg = err_msg + " ERROR: stderr file does not contain correct output.\n"
if not success:
self.fail(err_msg)
OpenPOWER on IntegriCloud