Skip to content

Commit d33c54a

Browse files
committed
integration-test: dotnet publish -p:SentryNative=true/false
1 parent c379241 commit d33c54a

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

integration-test/runtime.Tests.ps1

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,28 @@ internal class FakeTransport : ITransport
6868
}
6969
}
7070

71+
function publishConsoleApp([bool]$SentryNative = $true)
72+
{
73+
dotnet publish console-app `
74+
-c Release `
75+
--nologo `
76+
--framework $framework `
77+
-p:SentryNative=$($SentryNative.ToString().ToLower()) `
78+
| ForEach-Object { Write-Host $_ }
79+
if ($LASTEXITCODE -ne 0)
80+
{
81+
throw 'Failed to publish the test app project.'
82+
}
83+
}
84+
7185
function runConsoleApp([bool]$IsAOT = $true, [string]$CrashType = 'Managed', [string]$Dsn = 'http://key@127.0.0.1:9999/123')
7286
{
7387
if ($IsAOT)
7488
{
7589
$executable = getConsoleAppPath
7690
If (!(Test-Path $executable))
7791
{
78-
dotnet publish console-app -c Release --nologo --framework $framework | ForEach-Object { Write-Host $_ }
79-
if ($LASTEXITCODE -ne 0)
80-
{
81-
throw 'Failed to publish the test app project.'
82-
}
92+
publishConsoleApp
8393
}
8494
}
8595
else
@@ -90,7 +100,7 @@ internal class FakeTransport : ITransport
90100
Write-Host "::group::Executing $executable"
91101
try
92102
{
93-
Invoke-Expression $executable | ForEach-Object {
103+
Invoke-Expression "$executable 2>&1" | ForEach-Object {
94104
Write-Host " $_"
95105
$_
96106
}
@@ -120,8 +130,11 @@ internal class FakeTransport : ITransport
120130
"console-app$exeExtension", "console-app$debugExtension") | Sort-Object -Unique)
121131
}
122132

123-
It "'dotnet publish' produces an app that's recognized as AOT by Sentry" {
124-
runConsoleApp | Should -AnyElementMatch 'This looks like a Native AOT application build.'
133+
It "'dotnet publish' produces an app that's recognized as AOT by Sentry (SentryNative=<_>)" -ForEach @($false, $true) {
134+
publishConsoleApp $_
135+
$output = runConsoleApp
136+
$output | Should -AnyElementMatch 'This looks like a Native AOT application build.'
137+
$output | Should -Not -AnyElementMatch 'System.DllNotFoundException: Unable to load (shared library|DLL) ''sentry-native'' or one of its dependencies'
125138
}
126139

127140
It "'dotnet run' produces an app that's recognized as JIT by Sentry" {

0 commit comments

Comments
 (0)