[Lldb-commits] [lldb] [lldb] Fix API test for file redirection to existing files (PR #114119)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 29 13:07:19 PDT 2024


================
@@ -99,31 +99,45 @@ def test_stdout_stderr_redirection(self):
     @expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
     @skipIfDarwinEmbedded  # debugserver can't create/write files on the device
     def test_stdout_stderr_redirection_to_existing_files(self):
-        """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR without redirecting STDIN to output files already exist."""
+        """Exercise SBLaunchInfo::AddOpenFileAction() for STDOUT and STDERR redirect to output files already exist."""
         self.setup_test()
         self.build()
         self.create_target()
-        self.write_file_with_placeholder(self.output_file)
-        self.write_file_with_placeholder(self.error_file)
-        self.redirect_stdout()
-        self.redirect_stderr()
-        self.run_process(True)
-        output = self.read_output_file_and_delete()
-        error = self.read_error_file_and_delete()
-        self.check_process_output(output, error)
 
-    def write_file_with_placeholder(self, target_file):
+        # Create the output and error files with placeholder
         placeholder = "This content should be overwritten."
         if lldb.remote_platform:
+            f = open(self.local_output_file, "w")
----------------
Jlalond wrote:

If we are going to make local files the [Save core tests put them in the build directory](https://github.com/llvm/llvm-project/blob/8a0cb9ac869334fd6c6bd6aad8408623a7ccd7f6/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py#L414) as an example.

https://github.com/llvm/llvm-project/pull/114119


More information about the lldb-commits mailing list