@@ -43,11 +43,17 @@ BeforeDiscovery {
4343 # Detect native backend by checking which crash handler binary exists in the packaged build
4444 function Test-NativeBackend {
4545 $appDir = Split-Path $env: SENTRY_UNREAL_TEST_APP_PATH
46- $pluginBinDir = Join-Path $appDir " SentryPlayground/Plugins/sentry/Binaries"
46+ if ($IsMacOS ) {
47+ $pluginBinDir = Join-Path (Split-Path $appDir ) " UE/SentryPlayground/Plugins/sentry/Binaries"
48+ } else {
49+ $pluginBinDir = Join-Path $appDir " SentryPlayground/Plugins/sentry/Binaries"
50+ }
4751 if ($IsWindows ) {
4852 return Test-Path (Join-Path $pluginBinDir " Win64/sentry-crash.exe" )
4953 } elseif ($IsLinux ) {
5054 return Test-Path (Join-Path $pluginBinDir " Linux/sentry-crash" )
55+ } elseif ($IsMacOS ) {
56+ return Test-Path (Join-Path $pluginBinDir " Mac/sentry-crash" )
5157 } else {
5258 return $false
5359 }
@@ -59,7 +65,7 @@ BeforeDiscovery {
5965 $currentPlatform | Should -Not - Be $null
6066 $TestTargets += Get-TestTarget - Platform $currentPlatform - ProviderName $currentPlatform
6167
62- $IsNativeBackend = Test-NativeBackend
68+ $script : IsNativeBackend = Test-NativeBackend
6369
6470 # Define crash types to test
6571 $TestCrashTypes = @ (
@@ -70,8 +76,8 @@ BeforeDiscovery {
7076 @ { Name = ' OutOfMemory' ; Arg = ' -crash-oom' ; Type = ' OutOfMemory' }
7177 )
7278
73- if ($IsLinux ) {
74- # Memory overcommit makes OOM conditions unreliable to trigger in tests on Linux
79+ if ($IsLinux -or ( $IsMacOS -and $IsNativeBackend ) ) {
80+ # Memory overcommit makes OOM conditions unreliable to trigger in tests on Linux and macOS with native backend
7581 $TestCrashTypes = $TestCrashTypes | Where-Object { $_.Name -ne ' OutOfMemory' }
7682 }
7783}
@@ -164,10 +170,11 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
164170 # $crashTypeArg triggers specific crash type scenario in the sample app
165171 $script :CrashResult = Invoke-DeviceApp - ExecutablePath $script :AppPath - Arguments ((@ ($crashTypeArg ) + $appArgs ) -join ' ' )
166172
167- # On macOS, the crash is captured but not uploaded immediately (due to Cocoa's behavior) ,
173+ # On macOS with Cocoa backend , the crash is captured but not uploaded immediately,
168174 # so we need to run the test app again to send it to Sentry.
169- # -init-only allows starting the app to flush captured events and quit right after
170- if ($Platform -eq ' MacOS' ) {
175+ # -init-only allows starting the app to flush captured events and quit right after.
176+ # With native backend, crashes are uploaded out-of-process so no relaunch is needed.
177+ if ($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
171178 Invoke-DeviceApp - ExecutablePath $script :AppPath - Arguments ((@ (' -init-only' ) + $appArgs ) -join ' ' )
172179 }
173180
@@ -211,7 +218,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
211218
212219 It " Should have correct event type and platform" {
213220 $script :CrashEvent.type | Should - Be ' error'
214- if ($Platform -eq ' MacOS' ) {
221+ if ($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
215222 $script :CrashEvent.platform | Should - Be ' cocoa'
216223 }
217224 else {
@@ -242,7 +249,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
242249 ($tags | Where-Object { $_.key -eq ' test.suite' }).value | Should - Be ' integration'
243250 }
244251
245- It " Should have CrashType tag" - Skip:($Name -in @ (' OutOfMemory' , ' MemoryCorruption' ) -or $Platform -eq ' MacOS' ) {
252+ It " Should have CrashType tag" - Skip:($Name -in @ (' OutOfMemory' , ' MemoryCorruption' ) -or ( $Platform -eq ' MacOS' -and -not $IsNativeBackend ) ) {
246253 $tags = $script :CrashEvent.tags
247254 ($tags | Where-Object { $_.key -eq ' CrashType' }).value | Should - Be $Type
248255 }
@@ -331,7 +338,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
331338
332339 It " Should have correct event type and platform" {
333340 $script :EnsureEvent.type | Should - Be ' error'
334- if ($Platform -eq ' MacOS' ) {
341+ if ($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
335342 $script :EnsureEvent.platform | Should - Be ' cocoa'
336343 }
337344 else {
@@ -365,7 +372,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
365372 ($tags | Where-Object { $_.key -eq ' test.suite' }).value | Should - Be ' integration'
366373 }
367374
368- It " Should have CrashType tag" - Skip:($Platform -eq ' MacOS' ) {
375+ It " Should have CrashType tag" - Skip:($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
369376 $tags = $script :EnsureEvent.tags
370377 ($tags | Where-Object { $_.key -eq ' CrashType' }).value | Should - Be ' Ensure'
371378 }
@@ -538,7 +545,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
538545 }
539546
540547 It " Should have correct platform" {
541- if ($Platform -eq ' MacOS' ) {
548+ if ($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
542549 $script :MessageEvent.platform | Should - Be ' cocoa'
543550 }
544551 else {
@@ -551,7 +558,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
551558 $script :MessageEvent.message.formatted | Should -Match ' Integration test message'
552559 }
553560
554- It " Should have overridden release" - Skip:($Platform -eq ' MacOS' ) {
561+ It " Should have overridden release" - Skip:($Platform -eq ' MacOS' -and -not $IsNativeBackend ) {
555562 $script :MessageEvent.release.version | Should - Be ' test-release@1.0.0'
556563 }
557564
@@ -744,8 +751,8 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
744751 }
745752 }
746753
747- # Metrics are not supported on Apple platforms (macOS/iOS)
748- Context " Metrics Capture Tests" - Skip:$IsMacOS {
754+ # Metrics are not supported on macOS with Cocoa backend
755+ Context " Metrics Capture Tests" - Skip:( $IsMacOS -and -not $IsNativeBackend ) {
749756 BeforeAll {
750757 $script :MetricResult = $null
751758 $script :CapturedCounterMetrics = @ ()
0 commit comments