Fail Android runs when pulled test results report failed tests - #1665
Conversation
Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
Co-authored-by: vitek-karas <10670590+vitek-karas@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 628dfcba-913b-421e-b2c8-202a7459abd6
|
I checked a recent Across all seven Android test runs, two used All other XML failures in that build already produced |
| <XHarnessX86TestApkUrl>$(AssetsBaseUri)/android/test-apk/x86/$(TestPackageName)-x86.zip</XHarnessX86TestApkUrl> | ||
| <TestAppDestinationDir>$(ArtifactsTmpDir)test-app\android\x86</TestAppDestinationDir> | ||
| <TestArchitecture>x86_64</TestArchitecture> | ||
| <XHarnessTestApkUrl>$(AssetsBaseUri)/android/test-apk/$(TestArchitecture)/$(TestPackageName)-$(TestArchitecture).apk</XHarnessTestApkUrl> |
There was a problem hiding this comment.
Fyi. This will take the app from test-apk/x86_64 but the code before used test-apk/x86. It looks like the test is passing now so it appears that the other APK was probably stale and should be removed from the storage.
There was a problem hiding this comment.
I uploaded a new rebuilt version there - but yes, eventually we need to clean it up. Unfortunately I don't have access to list all the blobs which are there... :-)
I'll talk to the person who does.
The Android manual commands E2E leg reported success while the app's tests failed:
System.Numerics.Vectors.Tests-x86ran 1194 tests with 3 failures, yet the instrumentation, the XHarness command and the Helix work item all exited 0.Root cause
InstrumentationRunnerderives its exit code exclusively from the instrumentation'sreturn-codebundle value. ThetestResults.xmlthat XHarness pulls off the device (viatest-results-path) is only uploaded, never inspected. The prebuilt APK asset used by this scenario reportsreturn-code=0regardless of failures (MonoRunner.javaforwards the managed entry point's return value), so nothing in the chain — XHarness, theresult |= $?custom-commands script, the work item — ever saw a failure. The leg also does not publishtestResults.xmlto Azure DevOps, so there was no second safety net.Not a regression:
return-code-only detection dates to #121 (2020) and survived theInstrumentationRunnerextraction in #874; the other Android legs useSystem.Buffers.Tests, which passes, so the gap was never visible.Changes
TestResultsAnalyzer(new) — returns the failed-test count from a results file for the formats the XHarness test runners emit: xUnit v2 (default), NUnit v2, NUnit v3. Missing, malformed or unrecognized files returnnulland are ignored, so no new failure modes are introduced.InstrumentationRunner— when a run would otherwise beSUCCESSand--expected-exit-codeis 0, the pulled results files are checked and the run is reported asTESTS_FAILEDif any of them report failures:The reason is logged explicitly (
Instrumentation reported a successful exit code but 'testResults.xml' contains 3 failed test(s)).Why this approach
This mirrors what the Apple side already does (the orchestrator evaluates the parsed test report, not just the app's exit code), and fixes every consumer of
android run/android testrather than just this repo's E2E leg.return-codestays authoritative for non-zero/expected-exit-code scenarios — the XML check can only turn a green run red. No change to the prebuilt APK assets (which this repo does not own) or shell-side XML grepping is needed.Publishing
testResults.xmlto Azure DevOps from the E2E scenario is a worthwhile complement for reporting, but it would only fix this repo's leg and leave XHarness itself reporting the wrong exit code; it is left for a separate change.Verification
The intended proof is the CI on this PR: the Android - Manual Commands leg should now go red with
TESTS_FAILEDbecause of exactly the threeConstructorWithUnsupportedTypes_*failures. Kept as a draft until that run confirms it.