-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LLDB][Minidump] Add Multiplatform test to ensure determinism #108602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-lldb Author: Jacob Lalonde (Jlalond) ChangesAdds a test that ensures two minidumps produced from the same target are the same bytes. Covers the three primary core flavors. Full diff: https://github.com/llvm/llvm-project/pull/108602.diff 1 Files Affected:
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..d4eaa40b13f7ee 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,42 @@ def minidump_deleted_on_save_failure(self):
finally:
self.assertTrue(self.dbg.DeleteTarget(target))
+
+ def minidump_deterministic_difference(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: # b is important -> binary
+ 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))
|
✅ With the latest revision this PR passed the Python code formatter. |
60b48f9
to
41bb7f8
Compare
b52d9e4
to
550a26a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
…08602) Adds a test that ensures two minidumps produced from the same target are the same bytes. Covers the three primary core flavors.
Adds a test that ensures two minidumps produced from the same target are the same bytes. Covers the three primary core flavors.