diff options
| author | Vince Harron <vharron@google.com> | 2015-02-10 21:09:04 +0000 |
|---|---|---|
| committer | Vince Harron <vharron@google.com> | 2015-02-10 21:09:04 +0000 |
| commit | df3f00f30a83ba0e526ad13097dd4f841f6045a6 (patch) | |
| tree | 2df9dea155ccb0d88a601587dfe7037e10b1b344 /lldb/test/python_api | |
| parent | c008539736dea40fc1982a6d6cdd4c8c81129222 (diff) | |
| download | bcm5719-llvm-df3f00f30a83ba0e526ad13097dd4f841f6045a6.tar.gz bcm5719-llvm-df3f00f30a83ba0e526ad13097dd4f841f6045a6.zip | |
Fix 'process launch -i' for remote processes
We want to forward stdin when stdio is not disabled and when we're not
redirecting stdin from a file.
renamed m_stdio_disable to m_stdin_forward and inverted value because
that's what we want to remember.
There was previously a bug that if you redirected stdin from a file,
stdout and stderr would also be redirected to /dev/null
Adds support for remote target to TestProcessIO.py
Fixes ProcessIOTestCase.test_stdin_redirection_with_dwarf for remote
Linux targets
llvm-svn: 228744
Diffstat (limited to 'lldb/test/python_api')
| -rw-r--r-- | lldb/test/python_api/process/io/TestProcessIO.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lldb/test/python_api/process/io/TestProcessIO.py b/lldb/test/python_api/process/io/TestProcessIO.py index a7c38b3852c..2b188af5935 100644 --- a/lldb/test/python_api/process/io/TestProcessIO.py +++ b/lldb/test/python_api/process/io/TestProcessIO.py @@ -95,9 +95,13 @@ class ProcessIOTestCase(TestBase): TestBase.setUp(self) # Get the full path to our executable to be debugged. self.exe = os.path.join(os.getcwd(), "process_io") - self.input_file = os.path.join(os.getcwd(), "input.txt") - self.output_file = os.path.join(os.getcwd(), "output.txt") - self.error_file = os.path.join(os.getcwd(), "error.txt") + self.local_input_file = os.path.join(os.getcwd(), "input.txt") + self.local_output_file = os.path.join(os.getcwd(), "output.txt") + self.local_error_file = os.path.join(os.getcwd(), "error.txt") + + self.input_file = os.path.join(self.get_process_working_directory(), "input.txt") + self.output_file = os.path.join(self.get_process_working_directory(), "output.txt") + self.error_file = os.path.join(self.get_process_working_directory(), "error.txt") self.lines = ["Line 1", "Line 2", "Line 3"] def read_output_file_and_delete (self): @@ -128,15 +132,24 @@ class ProcessIOTestCase(TestBase): Make the input.txt file to use when redirecting STDIN, setup a cleanup action to delete the input.txt at the end of the test in case exceptions are thrown, and redirect STDIN in the launch info.''' - f = open(self.input_file, 'w') + f = open(self.local_input_file, 'w') for line in self.lines: f.write(line + "\n") f.close() + + if lldb.remote_platform: + self.runCmd('platform put-file "{local}" "{remote}"'.format( + local=self.local_input_file, remote=self.input_file)) + # This is the function to remove the custom formats in order to have a # clean slate for the next test case. def cleanup(): - os.unlink(self.input_file) - + os.unlink(self.local_input_file) + # if lldb.remote_platform: + # TODO: add delete file command + # self.runCmd('platform delete-file "{local}" "{remote}"'.format( + # local=self.local_input_file, remote=self.input_file))''' + # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) self.launch_info.AddOpenFileAction(0, self.input_file, True, False); |

