diff --git a/.github/workflows/ci-aot.yml b/.github/workflows/ci-aot.yml index d661ca1b270..1be900f89ca 100644 --- a/.github/workflows/ci-aot.yml +++ b/.github/workflows/ci-aot.yml @@ -24,6 +24,6 @@ jobs: with: fetch-depth: 0 # fetching all - - name: Read publish AOT testApp output and assert warning count + - name: publish AOT testApp, assert static analysis warning count, and run the app shell: pwsh - run: .\build\assert-publish-aot-testApp-warning-count.ps1 + run: .\build\test-aot-compatibility.ps1 ${{ matrix.version }} diff --git a/OpenTelemetry.sln b/OpenTelemetry.sln index a67d7d06094..12c17122b4e 100644 --- a/OpenTelemetry.sln +++ b/OpenTelemetry.sln @@ -26,7 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E-03FA-4FFF-89A5-C51F107623FD}" ProjectSection(SolutionItems) = preProject - build\assert-publish-aot-testApp-warning-count.ps1 = build\assert-publish-aot-testApp-warning-count.ps1 build\Common.nonprod.props = build\Common.nonprod.props build\Common.prod.props = build\Common.prod.props build\Common.props = build\Common.props @@ -46,6 +45,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E build\RELEASING.md = build\RELEASING.md build\stylecop.json = build\stylecop.json build\xunit.runner.json = build\xunit.runner.json + build\test-aot-compatibility.ps1 = build\test-aot-compatibility.ps1 EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Zipkin", "src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj", "{7EDAE7FA-B44E-42CA-80FA-7DF2FAA2C5DD}" diff --git a/build/assert-publish-aot-testApp-warning-count.ps1 b/build/test-aot-compatibility.ps1 similarity index 54% rename from build/assert-publish-aot-testApp-warning-count.ps1 rename to build/test-aot-compatibility.ps1 index 9fa9126e679..62f2f5770b6 100644 --- a/build/assert-publish-aot-testApp-warning-count.ps1 +++ b/build/test-aot-compatibility.ps1 @@ -1,25 +1,40 @@ -$rootDirectory = Split-Path $PSScriptRoot -Parent -$publishOutput = dotnet publish $rootDirectory\test\OpenTelemetry.AotCompatibility.TestApp\OpenTelemetry.AotCompatibility.TestApp.csproj -nodeReuse:false /p:UseSharedCompilation=false - -$actualWarningCount = 0 - -foreach ($line in $($publishOutput -split "`r`n")) -{ - if ($line -like "*analysis warning IL*") - { - Write-Host $line - $actualWarningCount += 1 - } -} - -Write-Host "Actual warning count is:", $actualWarningCount -$expectedWarningCount = 28 - -$testPassed = 0 -if ($actualWarningCount -ne $expectedWarningCount) -{ - $testPassed = 1 - Write-Host "Actual warning count:", actualWarningCount, "is not as expected. Expected warning count is:", $expectedWarningCount -} - -Exit $testPassed +param([string]$targetNetFramework) + +$rootDirectory = Split-Path $PSScriptRoot -Parent +$publishOutput = dotnet publish $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj -nodeReuse:false /p:UseSharedCompilation=false + +$actualWarningCount = 0 + +foreach ($line in $($publishOutput -split "`r`n")) +{ + if ($line -like "*analysis warning IL*") + { + Write-Host $line + $actualWarningCount += 1 + } +} + +pushd $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/bin/Debug/$targetNetFramework/linux-x64 + +Write-Host "Executing test App..." +./OpenTelemetry.AotCompatibility.TestApp +Write-Host "Finished executing test App" + +if ($LastExitCode -ne 0) +{ + Write-Host "There was an error while executing AotCompatibility Test App. LastExitCode is:", $LastExitCode +} + +popd + +Write-Host "Actual warning count is:", $actualWarningCount +$expectedWarningCount = 28 + +$testPassed = 0 +if ($actualWarningCount -ne $expectedWarningCount) +{ + $testPassed = 1 + Write-Host "Actual warning count:", actualWarningCount, "is not as expected. Expected warning count is:", $expectedWarningCount +} + +Exit $testPassed