@@ -99,31 +99,38 @@ def test_stdout_stderr_redirection(self):
99
99
@expectedFlakeyLinux (bugnumber = "llvm.org/pr26437" )
100
100
@skipIfDarwinEmbedded # debugserver can't create/write files on the device
101
101
def test_stdout_stderr_redirection_to_existing_files (self ):
102
- """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN to output files already exist."""
102
+ """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR redirect to output files already exist."""
103
103
self .setup_test ()
104
104
self .build ()
105
105
self .create_target ()
106
- self .write_file_with_placeholder (self .output_file )
107
- self .write_file_with_placeholder (self .error_file )
108
- self .redirect_stdout ()
109
- self .redirect_stderr ()
110
- self .run_process (True )
111
- output = self .read_output_file_and_delete ()
112
- error = self .read_error_file_and_delete ()
113
- self .check_process_output (output , error )
114
106
115
- def write_file_with_placeholder ( self , target_file ):
107
+ # Create the output and error files with placeholder
116
108
placeholder = "This content should be overwritten."
109
+ # Local file directory and working directory are the same for local debugging
110
+ f = open (self .local_output_file , "w" )
111
+ f .write (placeholder )
112
+ f .close ()
113
+ f = open (self .local_error_file , "w" )
114
+ f .write (placeholder )
115
+ f .close ()
117
116
if lldb .remote_platform :
118
117
self .runCmd (
119
- 'platform file write "{target}" -d "{data}"' .format (
120
- target = target_file , data = placeholder
118
+ 'platform put-file "{local}" "{remote}"' .format (
119
+ local = self .local_output_file , remote = self .output_file
120
+ )
121
+ )
122
+ self .runCmd (
123
+ 'platform put-file "{local}" "{remote}"' .format (
124
+ local = self .local_error_file , remote = self .error_file
121
125
)
122
126
)
123
- else :
124
- f = open (target_file , "w" )
125
- f .write (placeholder )
126
- f .close ()
127
+
128
+ self .redirect_stdout ()
129
+ self .redirect_stderr ()
130
+ self .run_process (True )
131
+ output = self .read_output_file_and_delete ()
132
+ error = self .read_error_file_and_delete ()
133
+ self .check_process_output (output , error )
127
134
128
135
# target_file - path on local file system or remote file system if running remote
129
136
# local_file - path on local system
0 commit comments