Skip to content

Commit

Permalink
Revert "Merge pull request #319 from AArnott/betterTestingLibTemplate"
Browse files Browse the repository at this point in the history
This reverts commit 01eeb1a, reversing
changes made to 0a42cd9.
  • Loading branch information
AArnott committed Dec 18, 2024
1 parent 01eeb1a commit d2f4c5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 35 deletions.
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit" Version="2.9.2" />
Expand Down
35 changes: 4 additions & 31 deletions azure-pipelines/dotnet-test-cloud.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Param(

$RepoRoot = (Resolve-Path "$PSScriptRoot/..").Path
$ArtifactStagingFolder = & "$PSScriptRoot/Get-ArtifactsStagingDirectory.ps1"
$TestLogsPath = "$ArtifactStagingFolder/test_logs"
if (!(Test-Path $TestLogsPath)) { New-Item -ItemType Directory -Path $TestLogsPath | Out-Null }

$dotnet = 'dotnet'
if ($x86) {
Expand All @@ -46,46 +44,21 @@ if ($x86) {
}
}

$dotnetTestArgs = @()
$dotnetTestArgs2 = @()

# The GitHubActions test logger fails when combined with certain switches, but only on mac/linux.
# We avoid those switches in that specific context.
# Failure symptoms when using the wrong switch combinations on mac/linux are (depending on the switches) EITHER:
# - The test runner fails with exit code 1 (and no error message)
# - The test runner succeeds but the GitHubActions logger only adds annotations on Windows agents.
# See https://github.com/Tyrrrz/GitHubActionsTestLogger/discussions/37 for more info.
# Thus, the mess of conditions you see below, in order to get GitHubActions to work
# without undermining other value we have when running in other contexts.
if ($env:GITHUB_WORKFLOW -and ($IsLinux -or $IsMacOS)) {
$dotnetTestArgs += '--collect','Xplat Code Coverage'
$dotnetTestArgs2 += 'DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover'
} else {
$dotnetTestArgs += '--diag','$$TestLogsPath/diag.log;TraceLevel=info'
$dotnetTestArgs += '--collect','Code Coverage;Format=cobertura'
$dotnetTestArgs += '--settings',"$PSScriptRoot/test.runsettings"
}

if ($env:GITHUB_WORKFLOW) {
$dotnetTestArgs += '--logger','GitHubActions'
$dotnetTestArgs2 += 'RunConfiguration.CollectSourceInformation=true'
}

& $dotnet test $RepoRoot `
--no-build `
-c $Configuration `
--filter "TestCategory!=FailsInCloudTest" `
--collect "Code Coverage;Format=cobertura" `
--settings "$PSScriptRoot/test.runsettings" `
--blame-hang-timeout 60s `
--blame-crash `
-bl:"$ArtifactStagingFolder/build_logs/test.binlog" `
--diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" `
--logger trx `
@dotnetTestArgs `
-- `
@dotnetTestArgs2

$unknownCounter = 0
Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% {
Copy-Item $_ -Destination $TestLogsPath/
Copy-Item $_ -Destination $ArtifactStagingFolder/test_logs/

if ($PublishResults) {
$x = [xml](Get-Content -LiteralPath $_)
Expand Down
3 changes: 0 additions & 3 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" IncludeAssets="runtime" />
</ItemGroup>
</Project>

0 comments on commit d2f4c5e

Please sign in to comment.