@@ -10,33 +10,33 @@ public sealed class CrashDumpTests : AcceptanceTestBase<CrashDumpTests.TestAsset
1010 [ TestMethod ]
1111 public async Task CrashDump_DefaultSetting_CreateDump ( string tfm )
1212 {
13- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
14- {
15- // TODO: Investigate failures on macos
16- return ;
17- }
13+ string globalProperties = DumpWorkaround . GetGlobalPropertiesWorkaround ( ) ;
1814
1915 string resultDirectory = Path . Combine ( AssetFixture . TargetAssetPath , Guid . NewGuid ( ) . ToString ( "N" ) ) ;
20- var testHost = TestInfrastructure . TestHost . LocateFrom ( AssetFixture . TargetAssetPath , "CrashDump" , tfm ) ;
21- TestHostResult testHostResult = await testHost . ExecuteAsync ( $ "--crashdump --results-directory { resultDirectory } ", cancellationToken : TestContext . CancellationToken ) ;
22- testHostResult . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
16+ DotnetMuxerResult result = await DotnetCli . RunAsync (
17+ $ "run -c Release --no-build --project { AssetFixture . TargetAssetPath } -f { tfm } { globalProperties } --crashdump --results-directory { resultDirectory } ",
18+ AcceptanceFixture . NuGetGlobalPackagesFolder . Path ,
19+ failIfReturnValueIsNotZero : false ,
20+ cancellationToken : TestContext . CancellationToken ) ;
21+
22+ result . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
2323 string ? dumpFile = Directory . GetFiles ( resultDirectory , "CrashDump_*.dmp" , SearchOption . AllDirectories ) . SingleOrDefault ( ) ;
24- Assert . IsNotNull ( dumpFile , $ "Dump file not found '{ tfm } '\n { testHostResult } '") ;
24+ Assert . IsNotNull ( dumpFile , $ "Dump file not found '{ tfm } '\n { result } '") ;
2525 }
2626
2727 [ TestMethod ]
2828 public async Task CrashDump_CustomDumpName_CreateDump ( )
2929 {
30- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
31- {
32- // TODO: Investigate failures on macos
33- return ;
34- }
30+ string globalProperties = DumpWorkaround . GetGlobalPropertiesWorkaround ( ) ;
3531
3632 string resultDirectory = Path . Combine ( AssetFixture . TargetAssetPath , Guid . NewGuid ( ) . ToString ( "N" ) ) ;
37- var testHost = TestInfrastructure . TestHost . LocateFrom ( AssetFixture . TargetAssetPath , "CrashDump" , TargetFrameworks . NetCurrent ) ;
38- TestHostResult testHostResult = await testHost . ExecuteAsync ( $ "--crashdump --crashdump-filename customdumpname.dmp --results-directory { resultDirectory } ", cancellationToken : TestContext . CancellationToken ) ;
39- testHostResult . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
33+ DotnetMuxerResult result = await DotnetCli . RunAsync (
34+ $ "run -c Release --no-build --project { AssetFixture . TargetAssetPath } -f { TargetFrameworks . NetCurrent } { globalProperties } --crashdump --crashdump-filename customdumpname.dmp --results-directory { resultDirectory } ",
35+ AcceptanceFixture . NuGetGlobalPackagesFolder . Path ,
36+ failIfReturnValueIsNotZero : false ,
37+ cancellationToken : TestContext . CancellationToken ) ;
38+
39+ result . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
4040 Assert . IsNotNull ( Directory . GetFiles ( resultDirectory , "customdumpname.dmp" , SearchOption . AllDirectories ) . SingleOrDefault ( ) , "Dump file not found" ) ;
4141 }
4242
@@ -47,29 +47,35 @@ public async Task CrashDump_CustomDumpName_CreateDump()
4747 [ TestMethod ]
4848 public async Task CrashDump_Formats_CreateDump ( string format )
4949 {
50- if ( RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) )
51- {
52- // TODO: Investigate failures on macos
53- return ;
54- }
50+ string globalProperties = DumpWorkaround . GetGlobalPropertiesWorkaround ( ) ;
5551
5652 string resultDirectory = Path . Combine ( AssetFixture . TargetAssetPath , Guid . NewGuid ( ) . ToString ( "N" ) ) ;
57- var testHost = TestInfrastructure . TestHost . LocateFrom ( AssetFixture . TargetAssetPath , "CrashDump" , TargetFrameworks . NetCurrent ) ;
58- TestHostResult testHostResult = await testHost . ExecuteAsync ( $ "--crashdump --crashdump-type { format } --results-directory { resultDirectory } ", cancellationToken : TestContext . CancellationToken ) ;
59- testHostResult . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
53+ DotnetMuxerResult result = await DotnetCli . RunAsync (
54+ $ "run -c Release --no-build --project { AssetFixture . TargetAssetPath } -f { TargetFrameworks . NetCurrent } { globalProperties } --crashdump --crashdump-type { format } --results-directory { resultDirectory } ",
55+ AcceptanceFixture . NuGetGlobalPackagesFolder . Path ,
56+ failIfReturnValueIsNotZero : false ,
57+ cancellationToken : TestContext . CancellationToken ) ;
58+
59+ result . AssertExitCodeIs ( ExitCodes . TestHostProcessExitedNonGracefully ) ;
6060 string ? dumpFile = Directory . GetFiles ( resultDirectory , "CrashDump_*.dmp" , SearchOption . AllDirectories ) . SingleOrDefault ( ) ;
61- Assert . IsNotNull ( dumpFile , $ "Dump file not found '{ format } '\n { testHostResult } '") ;
61+ Assert . IsNotNull ( dumpFile , $ "Dump file not found '{ format } '\n { result } '") ;
6262 File . Delete ( dumpFile ) ;
6363 }
6464
6565 [ TestMethod ]
6666 public async Task CrashDump_InvalidFormat_ShouldFail ( )
6767 {
68+ string globalProperties = DumpWorkaround . GetGlobalPropertiesWorkaround ( ) ;
69+
6870 string resultDirectory = Path . Combine ( AssetFixture . TargetAssetPath , Guid . NewGuid ( ) . ToString ( "N" ) ) ;
69- var testHost = TestInfrastructure . TestHost . LocateFrom ( AssetFixture . TargetAssetPath , "CrashDump" , TargetFrameworks . NetCurrent ) ;
70- TestHostResult testHostResult = await testHost . ExecuteAsync ( $ "--crashdump --crashdump-type invalid --results-directory { resultDirectory } ", cancellationToken : TestContext . CancellationToken ) ;
71- testHostResult . AssertExitCodeIs ( ExitCodes . InvalidCommandLine ) ;
72- testHostResult . AssertOutputContains ( "Option '--crashdump-type' has invalid arguments: 'invalid' is not a valid dump type. Valid options are 'Mini', 'Heap', 'Triage' and 'Full'" ) ;
71+ DotnetMuxerResult result = await DotnetCli . RunAsync (
72+ $ "run -c Release --no-build --project { AssetFixture . TargetAssetPath } -f { TargetFrameworks . NetCurrent } { globalProperties } --crashdump --crashdump-type invalid --results-directory { resultDirectory } ",
73+ AcceptanceFixture . NuGetGlobalPackagesFolder . Path ,
74+ failIfReturnValueIsNotZero : false ,
75+ cancellationToken : TestContext . CancellationToken ) ;
76+
77+ result . AssertExitCodeIs ( ExitCodes . InvalidCommandLine ) ;
78+ result . AssertOutputContains ( "Option '--crashdump-type' has invalid arguments: 'invalid' is not a valid dump type. Valid options are 'Mini', 'Heap', 'Triage' and 'Full'" ) ;
7379 }
7480
7581 public sealed class TestAssetFixture ( ) : TestAssetFixtureBase ( AcceptanceFixture . NuGetGlobalPackagesFolder )
0 commit comments