Skip to content

Commit

Permalink
Run host tests with dotnet test and enable crash/hang dumps (#69340)
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung authored May 19, 2022
1 parent 11f8308 commit 55090e6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/installer/jobs/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ jobs:
name: ${{ coalesce(parameters.name, parameters.platform) }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
skipTests: $(SkipTests)
skipTests: ${{ variables.SkipTests }}
isOfficialBuild: ${{ eq(parameters.isOfficialBuild, true) }}
pgoType: ${{ parameters.pgoType }}

Expand Down
36 changes: 34 additions & 2 deletions eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,46 @@ steps:
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFormat: 'xUnit'
testResultsFiles: '*.xml'
testResultsFormat: 'VSTest'
testResultsFiles: '*.trx'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
mergeTestResults: true
testRunTitle: Installer-${{ parameters.runtimeFlavor }}-${{ parameters.name }}-$(_BuildConfig)
continueOnError: true
condition: eq(variables.SkipTests, false)

# Upload binaries and symbols on failure to allow debugging issues
- ${{ if eq(parameters.skipTests, false) }}:
- task: CopyFiles@2
displayName: Prepare binaries to publish
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts/bin'
Contents: |
*/corehost/**
*/corehost_test/**
TargetFolder: '$(Build.StagingDirectory)/Binaries'
continueOnError: true
condition: failed()

- task: ArchiveFiles@2
displayName: Zip binaries
inputs:
rootFolderOrFile: '$(Build.StagingDirectory)/Binaries'
archiveFile: '$(Build.StagingDirectory)/corehost-bin-${{ parameters.name }}-$(_BuildConfig)$(archiveExtension)'
archiveType: $(archiveType)
tarCompression: $(tarCompression)
includeRootFolder: false
continueOnError: true
condition: failed()

- task: PublishBuildArtifacts@1
displayName: Publish binaries
inputs:
pathtoPublish: '$(Build.StagingDirectory)/corehost-bin-${{ parameters.name }}-$(_BuildConfig)$(archiveExtension)'
artifactName: Installer-Binaries-${{parameters.pgoType }}${{ parameters.runtimeFlavor }}-${{ parameters.runtimeVariant }}-${{ parameters.name }}-$(_BuildConfig)
continueOnError: true
condition: failed()

- task: CopyFiles@2
displayName: Prepare BuildLogs staging directory
inputs:
Expand Down
6 changes: 5 additions & 1 deletion src/installer/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<InternalNupkgCacheDir>$(ArtifactsObjDir)ExtraNupkgsForTestRestore\</InternalNupkgCacheDir>
<TestArchitectures>$(TargetArchitecture)</TestArchitectures>
<TestInfraTargetFramework>$(NetCoreAppToolCurrent)</TestInfraTargetFramework>
<TestRunnerAdditionalArguments>-notrait category=failing -verbose</TestRunnerAdditionalArguments>
<TestRunnerAdditionalArguments>--filter category!=failing -v detailed</TestRunnerAdditionalArguments>
<!-- Enable crash and hang dumps -->
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame-crash-dump-type full</TestRunnerAdditionalArguments>
<TestRunnerAdditionalArguments>$(TestRunnerAdditionalArguments) --blame-hang-timeout 5m --blame-hang-dump-type full</TestRunnerAdditionalArguments>
<UseVSTestRunner>true</UseVSTestRunner>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void RunApp_UnhandledException()
};

sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot)
.Execute()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.InitializeContextForApp(project.AppDll)
.And.ExecuteApplicationWithException(sharedState.NativeHostPath, project.AppDll);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public void CallDelegateOnApplicationContext_UnhandledException()
};

sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot)
.Execute()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.InitializeContextForApp(appProject.AppDll)
.And.ExecuteFunctionPointerWithException(entryPoint, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void CallDelegateOnComponentContext_UnhandledException()
};

sharedState.CreateNativeHostCommand(args, sharedState.DotNetRoot)
.Execute()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.InitializeContextForConfig(componentProject.RuntimeConfigJson)
.And.ExecuteComponentEntryPointWithException(entryPoint, 1);
Expand Down
7 changes: 7 additions & 0 deletions src/installer/tests/TestUtils/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@ public CommandResult WaitForExit(bool fExpectedToFail, int timeoutMilliseconds =

public CommandResult Execute(bool fExpectedToFail)
{
// Clear out any enabling of dump creation if failure is expected
if (fExpectedToFail)
{
EnvironmentVariable("COMPlus_DbgEnableMiniDump", null);
EnvironmentVariable("DOTNET_DbgEnableMiniDump", null);
}

Start();
return WaitForExit(fExpectedToFail);
}
Expand Down

0 comments on commit 55090e6

Please sign in to comment.