Skip to content

[tests] Remove redundant assembly-store device test - #13708

Merged
jonathanpeppers merged 7 commits into
mainfrom
simonrozsival-assembly-store-dlopen-flake
Nov 23, 2026
Merged

jonathanpeppers merged 7 commits into
mainfrom
simonrozsival-assembly-store-dlopen-flake

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Context: #12962

AssemblyStoreDlopenResolvesOriginalPayload was added as a review follow-up when #12962 replaced the LLVM assembly-store ELF generation pipeline with a managed writer. It checked the new writer at the Android loader boundary: dlopen and dlsym had to resolve a payload whose SHA-256 matched the original build-generated store, for both extracted and APK-embedded libraries. The change preserved the underlying assembly-store format and loading contract.

The format and loader contract are now established, and the test has intermittently failed in CI before passing on retry, with both extractNativeLibs settings. Recent failures lacked the success marker; their cause remains unknown because the original device logcats were not retained. The narrow additional assurance of a full-store hash on a device no longer justifies the flakiness and CI cost, so remove the entire test rather than extend its timeout and add diagnostics.

Release CoreCLR startup already uses dlopen and dlsym to find the assembly store, and DebuggingTest.ApplicationRunsWithoutDebugger exercises startup with both extractNativeLibs settings. The host-side DlopenAssemblyStoreGeneratorTests.DataOnlyStoreExportsPayloadStart and NativeToolsCanExtractPayloadBySymbol use Android NDK tools to check the ELF layout, symbol and payload bytes. Removing the device test does lose the full mapped-store hash comparison against the original build output; the remaining tests do not make that exact assertion. No product behavior changes.

Validation

  • ./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj -c Debug --no-restore -v:q -nologo -m:4 -nr:false — passed with 21 SourceLink warnings.
  • ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --list-tests — passed; the removed test is absent and UnknownSystemLibraryLoadsWithoutMainThreadDispatch remains discoverable.
  • No device tests were run after the deletion; the change removes a test and does not change product behavior.

simonrozsival and others added 4 commits November 21, 2026 16:49
AssemblyStoreDlopenResolvesOriginalPayload(True,False) timed out waiting for its success marker in builds 1693060 and 1693463, then passed after automatic retry. The failed TRX results and their logcat attachments are removed before publishing, so the remaining generic assertion cannot distinguish a digest mismatch from startup failure or a native crash. The actual CI root cause remains unknown.

Log and rethrow managed probe exceptions, and surface their original message in the host assertion immediately. Record whether the probe starts and print up to 200 relevant logcat lines on timeout, preserving pre-marker startup/native failure evidence in task standard output. Keep the original payload length, digest, ABI checks, dlopen flags and 150-second timeout unchanged.

Validation:
  * dotnet test src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/Microsoft.Android.Build.Tasks.Tests.csproj --filter "FullyQualifiedName~AssemblyStoreElfWriterTests|FullyQualifiedName~DlopenAssemblyStoreGeneratorTests" -v quiet -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false -nr:false: passed 80 tests.
  * ./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj -c Debug -v quiet -p:EnableSourceLink=false -p:EnableSourceControlManagerQueries=false: passed.
  * ADB_TARGET="-s emulator-5560" TEST_ANDROID_JDK_PATH=/Users/simon/android-toolchain/jdk-25 ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --filter "Name~AssemblyStoreDlopenResolvesOriginalPayload": five runs passed on API 35 ARM64 (10 passed, 10 unsupported 32-bit cases skipped).
  * Temporary incorrect-digest and pre-marker native abort probes both produced the expected explicit failure evidence; removed all injections, rebuilt and reran successfully. The CI x86_64 flake was not reproduced.

Co-authored-by: Copilot App <[email protected]>
The extractNativeLibs=false variant failed 3 of ~48 first attempts on the
CI x86_64 API 29 emulator without a payload or crash signal: the success
marker simply did not arrive within ActivityStartTimeoutInSeconds (150s).
Passing CI runs of that variant took 8-88s (mostly 38-69s) from launch to
marker, versus 4-10s for extractNativeLibs=true, so the failures are the
tail of a slow startup rather than a loader bug.

Wait up to 300s, log launch-to-probe and launch-to-result times so CI
records the latency, and lowercase the package name so DeviceTearDown
uninstalls the real package instead of a non-existent mixed-case one.

Co-authored-by: Copilot App <[email protected]>
Correct the rationale in a8d751a: the longer timeout is a mitigation
for a hypothesis, not a confirmed root cause.

The (True,False) first-attempt failures in builds 1693060, 1693153 and
1693463 recorded only that the success marker did not arrive within
150s. Their device logcats were not retained, the successful retries
rebuilt different payloads, and the CI x86_64 emulator was not
reproduced locally (local arm64 API 29: 90/90 passed). Passing CI
launches of 38-88s make a slow-startup tail plausible, but they do not
rule out an early crash, missing log output, payload corruption or a
loader failure in the failed attempts.

The new timing lines and timeout logcat dump in the task log are meant
to tell these cases apart if the failure recurs.

Co-authored-by: Copilot App <[email protected]>
The logcat monitor reports whether it observed a result, not why a marker
was missing. Describe a missing result without assuming a timeout, and
label the elapsed values as host observations rather than device timings.

The CI output is buffered, so timestamp gaps cannot establish a launch
duration. Slow startup remains only a hypothesis for the missing marker.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 21, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Managed failures can skip diagnostic output and retain only the first exception line, losing the remaining stack trace if a successful retry removes the failed TRX entry.

1 open issue
What changed in this PR

Improves diagnostics for intermittent assembly-store payload test failures without claiming to resolve the unknown root cause.

Changes:

  • Increases the result timeout to 300 seconds as a possible slow-startup mitigation.
  • Adds probe and managed-failure markers, host-observed timing, and bounded logcat output while preserving payload integrity checks.
  • Lowercases the tracked package name so teardown can uninstall the app correctly.
File Description
tests/​MSBuildDeviceIntegration/​Tests/​NativeLibraryLoadTests.cs Adds payload-test diagnostics, extends the timeout, and corrects package-name tracking.

Review effort: Balanced

Comment on lines +157 to +159
if (!payloadCheckCompleted) {
// Successful auto-retry removes failed TRX results; keep startup/crash evidence in the task log.
var diagnostics = File.ReadLines (logcatFile)
simonrozsival and others added 2 commits November 21, 2026 22:25
The first 200 matching logcat lines can be filled by unrelated emulator
errors before the app starts, hiding later crash and tombstone output.

Keep every package and probe line, and separately include the last 200
other error and fatal lines without duplicating the package diagnostics.

Validation: ./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj -v:q -nologo passed (21 SourceLink repository warnings, no errors).

Co-authored-by: Copilot App <[email protected]>
A managed payload failure stops the logcat monitor at the first exception line. The diagnostic excerpt was only printed on timeout, so retries could discard the failed result without preserving the rest of the exception in the task log.

Print the same bounded diagnostics for payload failures and append a fresh logcat snapshot after the matched line, retaining the monitored output if the marker has rolled out or the snapshot fails. Report snapshot failures explicitly.

Validation:
  * `./dotnet-local.sh build tests/MSBuildDeviceIntegration/MSBuildDeviceIntegration.csproj -c Debug --no-restore -v:q -nologo -m:4 -nr:false`: passed, with 21 SourceLink warnings.
  * `ADB_TARGET='-s emulator-5554' ANDROID_SERIAL='emulator-5554' AdbTarget='-s emulator-5554' ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --filter 'FullyQualifiedName~NativeLibraryLoadTests.AssemblyStoreDlopenResolvesOriginalPayload' --logger 'trx;LogFileName=final-variants.trx' --results-directory "$OUT"`: two passed and two 32-bit cases skipped on API 29 arm64.
  * Temporary fault injections reproduced the missing stack frame before the change, then verified the fresh dump, the dump-error fallback, and the unchanged timeout diagnostics.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival
simonrozsival marked this pull request as draft November 23, 2026 06:53
CoreCLR startup already resolves the assembly store through dlopen and dlsym, and existing device tests exercise startup with both native-library extraction modes. Host-side ELF writer tests also check the payload bytes and layout. The extra whole-payload device hash provides limited additional coverage while this test intermittently fails in CI for an unknown reason.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival simonrozsival changed the title [tests] Diagnose assembly-store payload test failures [tests] Remove redundant assembly-store device test Nov 23, 2026
@simonrozsival
simonrozsival marked this pull request as ready for review November 23, 2026 07:53
@simonrozsival simonrozsival added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Nov 23, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #13708

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review: no actionable findings. 0 errors, 0 warnings, 0 suggestions.

Reviewed the complete changed file and checked the remaining coverage against the runtime implementation. Release CoreCLR startup resolves the store through dlopen/dlsym; DebuggingTest.ApplicationRunsWithoutDebugger retains both extraction modes, and the host-side ELF tests verify the exported symbol, file-backed read-only segment, and payload bytes. The deletion intentionally gives up the whole mapped-store hash comparison, as the description acknowledges. No product behavior changes or dangling references to the removed test were found.

CI: All 38 GitHub check runs report success, including the aggregate dotnet-android check for Azure build 1694577. Direct Azure build/timeline verification was blocked by CLI initialization/authentication errors, so I cannot independently confirm the Azure result or inspect non-gating test failures.

No inline comments: this is a deletion-only diff, with no added or modified lines eligible under the review constraints. No local builds or device tests were run for this review.

Generated by Android PR Reviewer for #13708 · copilot · gpt61 · 26.7 AIC · ⌖ 7.94 AIC · ⊞ 20.3K
Comment /review to run again

@jonathanpeppers
jonathanpeppers merged commit baf2968 into main Nov 23, 2026
38 checks passed
@jonathanpeppers
jonathanpeppers deleted the simonrozsival-assembly-store-dlopen-flake branch November 23, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flaky-tests ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants