@@ -172,7 +172,7 @@ public void InitializeWithDumpForHangShouldCaptureADumpOnTimeout()
172172 this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
173173 this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
174174 this . mockProcessDumpUtility . Setup ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) ) ;
175- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Returns ( new [ ] { dumpFile } ) ;
175+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Returns ( new [ ] { dumpFile } ) ;
176176 this . mockDataCollectionSink . Setup ( x => x . SendFileAsync ( It . IsAny < FileTransferInformation > ( ) ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) ;
177177
178178 this . blameDataCollector . Initialize (
@@ -184,7 +184,7 @@ public void InitializeWithDumpForHangShouldCaptureADumpOnTimeout()
184184
185185 hangBasedDumpcollected . Wait ( 1000 ) ;
186186 this . mockProcessDumpUtility . Verify ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) , Times . Once ) ;
187- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
187+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( true ) , Times . Once ) ;
188188 this . mockDataCollectionSink . Verify ( x => x . SendFileAsync ( It . Is < FileTransferInformation > ( y => y . Path == dumpFile ) ) , Times . Once ) ;
189189 }
190190
@@ -206,7 +206,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfGet
206206 this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
207207 this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
208208 this . mockProcessDumpUtility . Setup ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) ) ;
209- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) . Throws ( new Exception ( "Some exception" ) ) ;
209+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) . Throws ( new Exception ( "Some exception" ) ) ;
210210
211211 this . blameDataCollector . Initialize (
212212 this . GetDumpConfigurationElement ( false , false , true , 0 ) ,
@@ -217,7 +217,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfGet
217217
218218 hangBasedDumpcollected . Wait ( 1000 ) ;
219219 this . mockProcessDumpUtility . Verify ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) , Times . Once ) ;
220- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
220+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( true ) , Times . Once ) ;
221221 }
222222
223223 /// <summary>
@@ -239,7 +239,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfAtt
239239 this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
240240 this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
241241 this . mockProcessDumpUtility . Setup ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) ) ;
242- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Returns ( new [ ] { dumpFile } ) ;
242+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Returns ( new [ ] { dumpFile } ) ;
243243 this . mockDataCollectionSink . Setup ( x => x . SendFileAsync ( It . IsAny < FileTransferInformation > ( ) ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) . Throws ( new Exception ( "Some other exception" ) ) ;
244244
245245 this . blameDataCollector . Initialize (
@@ -251,7 +251,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfAtt
251251
252252 hangBasedDumpcollected . Wait ( 1000 ) ;
253253 this . mockProcessDumpUtility . Verify ( x => x . StartHangBasedProcessDump ( It . IsAny < int > ( ) , It . IsAny < string > ( ) , It . IsAny < bool > ( ) , It . IsAny < string > ( ) , It . IsAny < Action < string > > ( ) ) , Times . Once ) ;
254- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
254+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( true ) , Times . Once ) ;
255255 this . mockDataCollectionSink . Verify ( x => x . SendFileAsync ( It . Is < FileTransferInformation > ( y => y . Path == dumpFile ) ) , Times . Once ) ;
256256 }
257257
@@ -366,7 +366,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfProcDumpEnabled()
366366 this . context ) ;
367367
368368 // Setup
369- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Returns ( new [ ] { this . filepath } ) ;
369+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( It . IsAny < bool > ( ) ) ) . Returns ( new [ ] { this . filepath } ) ;
370370 this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
371371 . Returns ( this . filepath ) ;
372372
@@ -376,7 +376,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfProcDumpEnabled()
376376 this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
377377
378378 // Verify GetDumpFiles Call
379- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
379+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( It . IsAny < bool > ( ) ) , Times . Once ) ;
380380 }
381381
382382 /// <summary>
@@ -418,7 +418,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
418418 this . context ) ;
419419
420420 // Setup
421- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Returns ( new [ ] { this . filepath } ) ;
421+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Returns ( new [ ] { this . filepath } ) ;
422422 this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
423423 . Returns ( this . filepath ) ;
424424
@@ -427,7 +427,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
427427 this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
428428
429429 // Verify GetDumpFiles Call
430- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
430+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( true ) , Times . Once ) ;
431431 }
432432
433433 /// <summary>
@@ -437,8 +437,10 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
437437 public void TriggerSessionEndedHandlerShouldLogWarningIfGetDumpFileThrowsFileNotFound ( )
438438 {
439439 // Initializing Blame Data Collector
440+ // force it to collect dump on exit, which won't happen and we should see a warning
441+ // but we should not see warning if we tell it to create dump and there is no crash
440442 this . blameDataCollector . Initialize (
441- this . GetDumpConfigurationElement ( ) ,
443+ this . GetDumpConfigurationElement ( false , collectDumpOnExit : true ) ,
442444 this . mockDataColectionEvents . Object ,
443445 this . mockDataCollectionSink . Object ,
444446 this . mockLogger . Object ,
@@ -447,7 +449,7 @@ public void TriggerSessionEndedHandlerShouldLogWarningIfGetDumpFileThrowsFileNot
447449 // Setup and raise events
448450 this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
449451 . Returns ( this . filepath ) ;
450- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Throws ( new FileNotFoundException ( ) ) ;
452+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Throws ( new FileNotFoundException ( ) ) ;
451453 this . mockDataColectionEvents . Raise ( x => x . TestHostLaunched += null , new TestHostLaunchedEventArgs ( this . dataCollectionContext , 1234 ) ) ;
452454 this . mockDataColectionEvents . Raise ( x => x . TestCaseStart += null , new TestCaseStartEventArgs ( new TestCase ( ) ) ) ;
453455 this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
@@ -605,6 +607,29 @@ public void TriggerTestHostLaunchedHandlerShouldLogWarningForNonBooleanCollectAl
605607 this . mockLogger . Verify ( x => x . LogWarning ( It . IsAny < DataCollectionContext > ( ) , It . Is < string > ( str => str == string . Format ( CultureInfo . CurrentUICulture , Resources . Resources . BlameParameterValueIncorrect , "DumpType" , BlameDataCollector . Constants . FullConfigurationValue , BlameDataCollector . Constants . MiniConfigurationValue ) ) ) , Times . Once ) ;
606608 }
607609
610+ /// <summary>
611+ /// The trigger test host launched handler should start process dump utility for full dump if full dump was enabled
612+ /// </summary>
613+ [ TestMethod ]
614+ public void TriggerTestHostLaunchedHandlerShouldLogNoWarningWhenDumpTypeIsUsedWithHangDumpBecauseEitherHangDumpTypeOrDumpTypeCanBeSpecified ( )
615+ {
616+ var dumpConfig = this . GetDumpConfigurationElement ( isFullDump : true , false , colectDumpOnHang : true , 1800000 ) ;
617+
618+ // Initializing Blame Data Collector
619+ this . blameDataCollector . Initialize (
620+ dumpConfig ,
621+ this . mockDataColectionEvents . Object ,
622+ this . mockDataCollectionSink . Object ,
623+ this . mockLogger . Object ,
624+ this . context ) ;
625+
626+ // Raise TestHostLaunched
627+ this . mockDataColectionEvents . Raise ( x => x . TestHostLaunched += null , new TestHostLaunchedEventArgs ( this . dataCollectionContext , 1234 ) ) ;
628+
629+ // Verify
630+ this . mockLogger . Verify ( x => x . LogWarning ( It . IsAny < DataCollectionContext > ( ) , It . IsAny < string > ( ) ) , Times . Never ) ;
631+ }
632+
608633 /// <summary>
609634 /// The trigger test host launched handler should not break if start process dump throws TestPlatFormExceptions and log error message
610635 /// </summary>
0 commit comments