@@ -522,3 +522,42 @@ 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 = [lldb .eSaveCoreStackOnly , lldb .eSaveCoreDirtyOnly , lldb .eSaveCoreFull ]
539
+ for style in core_styles :
540
+ spec_one = lldb .SBFileSpec (self .getBuildArtifact ("core.one.dmp" ))
541
+ spec_two = lldb .SBFileSpec (self .getBuildArtifact ("core.two.dmp" ))
542
+ options = lldb .SBSaveCoreOptions ()
543
+ options .SetOutputFile (spec_one )
544
+ options .SetPluginName ("minidump" )
545
+ options .SetStyle (style )
546
+ error = process .SaveCore (options )
547
+ self .assertTrue (error .Success ())
548
+ options .SetOutputFile (spec_two )
549
+ error = process .SaveCore (options )
550
+ self .assertTrue (error .Success ())
551
+
552
+ file_one = None
553
+ file_two = None
554
+ with open (spec_one .GetFileName (), mode = 'rb' ) as file : # b is important -> binary
555
+ file_one = file .read ()
556
+ with open (spec_two .GetFileName (), mode = 'rb' ) as file :
557
+ file_two = file .read ()
558
+ self .assertEqual (file_one , file_two )
559
+ self .assertTrue (os .unlink (spec_one .GetFileName ()))
560
+ self .assertTrue (os .unlink (spec_two .GetFileName ()))
561
+
562
+ finally :
563
+ self .assertTrue (self .dbg .DeleteTarget (target ))
0 commit comments