Skip to content

Commit

Permalink
[AOT] added AotCompatibility test app exit code assertion (#4743)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting authored Aug 8, 2023
1 parent 9e91904 commit eb9c30a
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-aot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eb9c30a

Please sign in to comment.