@@ -172,7 +172,7 @@ public void InitializeWithDumpForHangShouldCaptureADumpOnTimeout()
172
172
this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
173
173
this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
174
174
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 } ) ;
176
176
this . mockDataCollectionSink . Setup ( x => x . SendFileAsync ( It . IsAny < FileTransferInformation > ( ) ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) ;
177
177
178
178
this . blameDataCollector . Initialize (
@@ -184,7 +184,7 @@ public void InitializeWithDumpForHangShouldCaptureADumpOnTimeout()
184
184
185
185
hangBasedDumpcollected . Wait ( 1000 ) ;
186
186
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 ) ;
188
188
this . mockDataCollectionSink . Verify ( x => x . SendFileAsync ( It . Is < FileTransferInformation > ( y => y . Path == dumpFile ) ) , Times . Once ) ;
189
189
}
190
190
@@ -206,7 +206,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfGet
206
206
this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
207
207
this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
208
208
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" ) ) ;
210
210
211
211
this . blameDataCollector . Initialize (
212
212
this . GetDumpConfigurationElement ( false , false , true , 0 ) ,
@@ -217,7 +217,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfGet
217
217
218
218
hangBasedDumpcollected . Wait ( 1000 ) ;
219
219
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 ) ;
221
221
}
222
222
223
223
/// <summary>
@@ -239,7 +239,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfAtt
239
239
this . mockFileHelper . Setup ( x => x . Exists ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( true ) ;
240
240
this . mockFileHelper . Setup ( x => x . GetFullPath ( It . Is < string > ( y => y == "abc_hang.dmp" ) ) ) . Returns ( "abc_hang.dmp" ) ;
241
241
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 } ) ;
243
243
this . mockDataCollectionSink . Setup ( x => x . SendFileAsync ( It . IsAny < FileTransferInformation > ( ) ) ) . Callback ( ( ) => hangBasedDumpcollected . Set ( ) ) . Throws ( new Exception ( "Some other exception" ) ) ;
244
244
245
245
this . blameDataCollector . Initialize (
@@ -251,7 +251,7 @@ public void InitializeWithDumpForHangShouldCaptureKillTestHostOnTimeoutEvenIfAtt
251
251
252
252
hangBasedDumpcollected . Wait ( 1000 ) ;
253
253
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 ) ;
255
255
this . mockDataCollectionSink . Verify ( x => x . SendFileAsync ( It . Is < FileTransferInformation > ( y => y . Path == dumpFile ) ) , Times . Once ) ;
256
256
}
257
257
@@ -366,7 +366,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfProcDumpEnabled()
366
366
this . context ) ;
367
367
368
368
// 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 } ) ;
370
370
this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
371
371
. Returns ( this . filepath ) ;
372
372
@@ -376,7 +376,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfProcDumpEnabled()
376
376
this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
377
377
378
378
// Verify GetDumpFiles Call
379
- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
379
+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( It . IsAny < bool > ( ) ) , Times . Once ) ;
380
380
}
381
381
382
382
/// <summary>
@@ -418,7 +418,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
418
418
this . context ) ;
419
419
420
420
// Setup
421
- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Returns ( new [ ] { this . filepath } ) ;
421
+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Returns ( new [ ] { this . filepath } ) ;
422
422
this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
423
423
. Returns ( this . filepath ) ;
424
424
@@ -427,7 +427,7 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
427
427
this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
428
428
429
429
// Verify GetDumpFiles Call
430
- this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( ) , Times . Once ) ;
430
+ this . mockProcessDumpUtility . Verify ( x => x . GetDumpFiles ( true ) , Times . Once ) ;
431
431
}
432
432
433
433
/// <summary>
@@ -437,8 +437,10 @@ public void TriggerSessionEndedHandlerShouldGetDumpFileIfCollectDumpOnExitIsEnab
437
437
public void TriggerSessionEndedHandlerShouldLogWarningIfGetDumpFileThrowsFileNotFound ( )
438
438
{
439
439
// 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
440
442
this . blameDataCollector . Initialize (
441
- this . GetDumpConfigurationElement ( ) ,
443
+ this . GetDumpConfigurationElement ( false , collectDumpOnExit : true ) ,
442
444
this . mockDataColectionEvents . Object ,
443
445
this . mockDataCollectionSink . Object ,
444
446
this . mockLogger . Object ,
@@ -447,7 +449,7 @@ public void TriggerSessionEndedHandlerShouldLogWarningIfGetDumpFileThrowsFileNot
447
449
// Setup and raise events
448
450
this . mockBlameReaderWriter . Setup ( x => x . WriteTestSequence ( It . IsAny < List < Guid > > ( ) , It . IsAny < Dictionary < Guid , BlameTestObject > > ( ) , It . IsAny < string > ( ) ) )
449
451
. Returns ( this . filepath ) ;
450
- this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( ) ) . Throws ( new FileNotFoundException ( ) ) ;
452
+ this . mockProcessDumpUtility . Setup ( x => x . GetDumpFiles ( true ) ) . Throws ( new FileNotFoundException ( ) ) ;
451
453
this . mockDataColectionEvents . Raise ( x => x . TestHostLaunched += null , new TestHostLaunchedEventArgs ( this . dataCollectionContext , 1234 ) ) ;
452
454
this . mockDataColectionEvents . Raise ( x => x . TestCaseStart += null , new TestCaseStartEventArgs ( new TestCase ( ) ) ) ;
453
455
this . mockDataColectionEvents . Raise ( x => x . SessionEnd += null , new SessionEndEventArgs ( this . dataCollectionContext ) ) ;
@@ -605,6 +607,29 @@ public void TriggerTestHostLaunchedHandlerShouldLogWarningForNonBooleanCollectAl
605
607
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 ) ;
606
608
}
607
609
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
+
608
633
/// <summary>
609
634
/// The trigger test host launched handler should not break if start process dump throws TestPlatFormExceptions and log error message
610
635
/// </summary>
0 commit comments