[Lldb-commits] [lldb] c117222 - [LLDB][Minidump] Add Multiplatform test to ensure determinism (#108602)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 26 14:33:15 PDT 2024
Author: Jacob Lalonde
Date: 2024-09-26T14:33:12-07:00
New Revision: c11722223bacf604e60414542743d021a9f13aee
URL: https://github.com/llvm/llvm-project/commit/c11722223bacf604e60414542743d021a9f13aee
DIFF: https://github.com/llvm/llvm-project/commit/c11722223bacf604e60414542743d021a9f13aee.diff
LOG: [LLDB][Minidump] Add Multiplatform test to ensure determinism (#108602)
Adds a test that ensures two minidumps produced from the same target are
the same bytes. Covers the three primary core flavors.
Added:
Modified:
lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
Removed:
################################################################################
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 ccdb6653cf16f8..03cc415924e0bb 100644
--- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
@@ -522,3 +522,46 @@ def minidump_deleted_on_save_failure(self):
finally:
self.assertTrue(self.dbg.DeleteTarget(target))
+
+ def minidump_deterministic_
diff erence(self):
+ """Test that verifies that two minidumps produced are identical."""
+
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+ try:
+ target = self.dbg.CreateTarget(exe)
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory()
+ )
+ self.assertState(process.GetState(), lldb.eStateStopped)
+
+ core_styles = [
+ lldb.eSaveCoreStackOnly,
+ lldb.eSaveCoreDirtyOnly,
+ lldb.eSaveCoreFull,
+ ]
+ for style in core_styles:
+ spec_one = lldb.SBFileSpec(self.getBuildArtifact("core.one.dmp"))
+ spec_two = lldb.SBFileSpec(self.getBuildArtifact("core.two.dmp"))
+ options = lldb.SBSaveCoreOptions()
+ options.SetOutputFile(spec_one)
+ options.SetPluginName("minidump")
+ options.SetStyle(style)
+ error = process.SaveCore(options)
+ self.assertTrue(error.Success())
+ options.SetOutputFile(spec_two)
+ error = process.SaveCore(options)
+ self.assertTrue(error.Success())
+
+ file_one = None
+ file_two = None
+ with open(spec_one.GetFileName(), mode="rb") as file:
+ file_one = file.read()
+ with open(spec_two.GetFileName(), mode="rb") as file:
+ file_two = file.read()
+ self.assertEqual(file_one, file_two)
+ self.assertTrue(os.unlink(spec_one.GetFileName()))
+ self.assertTrue(os.unlink(spec_two.GetFileName()))
+
+ finally:
+ self.assertTrue(self.dbg.DeleteTarget(target))
More information about the lldb-commits
mailing list