@@ -522,3 +522,46 @@ def minidump_deleted_on_save_failure(self):
522
522
523
523
finally :
524
524
self .assertTrue (self .dbg .DeleteTarget (target ))
525
+
526
+ def minidump_deterministic_difference (self ):
527
+ """Test that verifies that two minidumps produced are identical."""
528
+
529
+ self .build ()
530
+ exe = self .getBuildArtifact ("a.out" )
531
+ try :
532
+ target = self .dbg .CreateTarget (exe )
533
+ process = target .LaunchSimple (
534
+ None , None , self .get_process_working_directory ()
535
+ )
536
+ self .assertState (process .GetState (), lldb .eStateStopped )
537
+
538
+ core_styles = [
539
+ lldb .eSaveCoreStackOnly ,
540
+ lldb .eSaveCoreDirtyOnly ,
541
+ lldb .eSaveCoreFull ,
542
+ ]
543
+ for style in core_styles :
544
+ spec_one = lldb .SBFileSpec (self .getBuildArtifact ("core.one.dmp" ))
545
+ spec_two = lldb .SBFileSpec (self .getBuildArtifact ("core.two.dmp" ))
546
+ options = lldb .SBSaveCoreOptions ()
547
+ options .SetOutputFile (spec_one )
548
+ options .SetPluginName ("minidump" )
549
+ options .SetStyle (style )
550
+ error = process .SaveCore (options )
551
+ self .assertTrue (error .Success ())
552
+ options .SetOutputFile (spec_two )
553
+ error = process .SaveCore (options )
554
+ self .assertTrue (error .Success ())
555
+
556
+ file_one = None
557
+ file_two = None
558
+ with open (spec_one .GetFileName (), mode = "rb" ) as file :
559
+ file_one = file .read ()
560
+ with open (spec_two .GetFileName (), mode = "rb" ) as file :
561
+ file_two = file .read ()
562
+ self .assertEqual (file_one , file_two )
563
+ self .assertTrue (os .unlink (spec_one .GetFileName ()))
564
+ self .assertTrue (os .unlink (spec_two .GetFileName ()))
565
+
566
+ finally :
567
+ self .assertTrue (self .dbg .DeleteTarget (target ))
0 commit comments