Commit 9547e67
test: add Android emulator test for dotnet signal handling (#1574)
* test: add Android emulator test for dotnet signal handling
Extends the existing dotnet_signal fixture to build as an Android APK
and run on an emulator. The test verifies CHAIN_AT_START signal handling
with Mono:
- Handled managed exception (NRE): no native crash registered
- Unhandled managed exception: Mono aborts, native crash registered
- Native crash (SIGSEGV in libcrash.so): crash envelope produced
The fixture csproj now multi-targets net10.0 and net10.0-android.
Program.cs exposes RunTest() for the Android MainActivity entry point.
Database state is checked directly on-device via adb run-as.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap skipif conditions in bool() to avoid pytest string evaluation
CI sets TEST_X86/ANDROID_API/RUN_ANALYZER to empty strings. Python's
`or` chain returns the last falsy value (empty string ""), which pytest
then tries to compile() as a legacy condition expression, causing
SyntaxError.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: install .NET SDK and Android workload for Android CI jobs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: only target net10.0-android when ANDROID_HOME is set
Desktop CI runners have .NET 10 but no android workload. MSBuild
validates all TFMs even when building for a specific one, causing
NETSDK1147. Conditionally add the android TFM only when ANDROID_HOME
is present.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use ANDROID_API instead of ANDROID_HOME for android TFM condition
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: print logcat output for Android test diagnostics
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use sh -c for run-as commands on Android
run-as can't find the `test` binary on older API levels. Use sh -c
with a single quoted command string so shell builtins are available.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: include stdout/stderr in dotnet run returncode assertions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use am start -W to avoid race in Android test
am start is asynchronous — it returns before the process starts.
The pidof poll could find no process yet and break immediately,
causing assertions to run before sentry_init, and the finally
block's adb uninstall to kill the app mid-startup (deletePackageX).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: exclude Android sources from desktop dotnet build
Microsoft.NET.Sdk (plain) compiles all .cs files regardless of
directory conventions. Exclude Platforms/Android/ when not building
for an Android target framework.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* try arm64-v8a
* try x86_64 on linux
* Test 22-30
* fix: move test logic to OnResume to avoid am start -W hang
OnCreate fires before the activity reports launch completion, so if the
test crashes the app, am start -W blocks indefinitely on older API levels.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: use default emulator target instead of google_apis
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: replace sleeps with retry loops in Android test
Use wait_for() with polling instead of fixed sleeps to handle timing
variations across emulator API levels.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add timeout to am start -W with logcat dump on failure
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: run test directly on UI thread instead of background thread
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use DecorView.Post + worker thread for Android test
Post ensures OnResume returns before the test runs (so am start -W
completes). Worker thread avoids Android's main thread uncaught
exception handler killing the process with SIGKILL.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: simplify Android test app and handle am start -W timeout
Move test back to OnResume with worker thread (no DecorView.Post).
Silently handle am start -W timeout since older API levels may not
report activity launch completion before the app exits.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: emulate MAUI abort behavior for unhandled exceptions on Android
Run the test on the main thread via Handler.Post and catch unhandled
managed exceptions with try-catch + abort(), matching how MAUI handles
them. This ensures sentry-native's signal handler captures the crash
across all Android API levels.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: expect no crash for unhandled managed exceptions on Android
Unhandled managed exceptions on Android go through Mono's exit(1), not
a catchable signal. sentry-dotnet handles these at the managed layer
via UnhandledExceptionRaiser, so sentry-native should not register a
crash. Remove the abort() workaround and align expectations with the
desktop test.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: drop broken Android API 22 job
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: switch Android emulator to google_apis, drop API 27
Switch emulator target from default to google_apis to fix stuck
emulator boots on API 23-25. Drop API 27 which has no google_apis
x86_64 system image.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: skip Android dotnet signal test on API < 26
Pre-tombstoned Android (API < 26) uses debuggerd which kills the
process before sentry-native's signal handler can run when using
CHAIN_AT_START strategy.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Try macos-15-large again, drop others but 26
* test: clean up dotnet signal test assertions and comments
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: switch Android emulator back to default target
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: use double quotes in run-as shell wrapper to preserve inner quotes
The find command uses single-quoted '*.envelope' glob pattern which
broke when wrapped in single-quoted sh -c.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3ad83bb commit 9547e67
File tree
7 files changed
+297
-21
lines changed- .github/workflows
- tests
- fixtures/dotnet_signal
- Platforms/Android
7 files changed
+297
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
198 | 203 | | |
199 | | - | |
| 204 | + | |
200 | 205 | | |
201 | 206 | | |
202 | 207 | | |
| |||
242 | 247 | | |
243 | 248 | | |
244 | 249 | | |
245 | | - | |
| 250 | + | |
246 | 251 | | |
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
250 | | - | |
| 255 | + | |
251 | 256 | | |
252 | 257 | | |
253 | 258 | | |
| |||
278 | 283 | | |
279 | 284 | | |
280 | 285 | | |
281 | | - | |
| 286 | + | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
| |||
357 | 362 | | |
358 | 363 | | |
359 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
360 | 381 | | |
361 | 382 | | |
362 | 383 | | |
| |||
386 | 407 | | |
387 | 408 | | |
388 | 409 | | |
389 | | - | |
| 410 | + | |
390 | 411 | | |
391 | 412 | | |
392 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | | - | |
44 | | - | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | | - | |
| 60 | + | |
55 | 61 | | |
56 | | - | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
67 | 80 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
8 | 23 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
0 commit comments