[Lldb-commits] [lldb] [lldb][test] Fix cleanup in test_save_linux_minidump_one_region (PR #231809)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 01:34:00 PDT 2026


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/231809

On Windows you cannot unlink a file that is open
in something else. So we must delete lldb's target before trying to unlink the minidump file.

Another follow up to #231448. Same thing I did to the other tests but I missed this one.

>From f55729211133ba1e5cb887e8b1dc00d1d67e5d1f Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Wed, 14 Oct 2026 08:27:23 +0000
Subject: [PATCH] [lldb][test] Fix cleanup in
 test_save_linux_minidump_one_region

On Windows you cannot unlink a file that is open
in something else. So we must delete lldb's target
before trying to unlink the minidump file.

Another follow up to #231448. Same thing I did to
the other tests but I missed this one.
---
 .../TestProcessSaveCoreMinidump.py                         | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
index 34de0f7ad1e38..431e4db9e9b70 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -406,6 +406,8 @@ def test_save_linux_minidump_one_region(self):
         self.build()
         exe = self.getBuildArtifact("a.out")
         one_region_file = self.getBuildArtifact("core.one_region.dmp")
+        target = None
+        core_target = None
         try:
             target = self.dbg.CreateTarget(exe)
             process = target.LaunchSimple(
@@ -452,7 +454,10 @@ def test_save_linux_minidump_one_region(self):
             self.assertTrue(err.Fail(), "Should fail to read memory")
 
         finally:
-            self.assertTrue(self.dbg.DeleteTarget(target))
+            if target:
+                self.assertTrue(self.dbg.DeleteTarget(target))
+            if core_target:
+                self.assertTrue(self.dbg.DeleteTarget(core_target))
             if os.path.isfile(one_region_file):
                 os.unlink(one_region_file)
 



More information about the lldb-commits mailing list