From 44c88a84542108200dc532df16766f24876eac4a Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Tue, 24 Apr 2018 14:57:45 -0400 Subject: [PATCH] [tests] Report errors last in `RunApkTests` (Take 2!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/2963/testReport/ A build for PR #1489 ran 1110 tests; it *should* have run over 35,000. Where are the missing tests? What's missing are the `.apk` on-device tests; BCL tests make up *most* of our expected test count. Analysis of the build log shows that the on-device tests *are* running, with test results being downloaded: …/android-toolchain/sdk/platform-tools/adb -s emulator-5570 pull "/data/data/Xamarin.Android.Bcl_Tests/files/.__override__/TestResults.xUnit.xml" "…/xamarin-android/tests/../bin/TestDebug/TestResult-Xamarin.Android.Bcl_Tests.xunit.xml" ... /data/data/Xamarin.Android.Bcl_Tests/files/.__override__/TestResults.xUnit.xml: 1 file pulled. 53.5 MB/s (3273412 bytes in 0.058s) but those results don't appear on the `testReport` URL. The problem is that the `RenameApkTestCases` target is never being executed, and the `RenameApkTestCases` is responsible for copying the `TestResult*` files where Jenkins looks for them: Done building target "ReleaseAndroidTarget" in project "RunApkTests.targets" -- FAILED.: The `RenameApkTestCases` target executes *after* `ReleaseAndroidTarget`, but because `ReleaseAndroidTarget` failed, the `RenameApkTestCases` target isn't executed. Meanwhile, `ReleaseAndroidTarget` reports an error to ensure that errors aren't overlooked; see commit 3b893cd4. Allow the `RenameApkTestCases` target to execute by adding a new `ReportComponentFailures` target. The `ReleaseAndroidTarget` will no longer report errors, allowing the `RenameApkTestCases` target to execute, while if any tests *do* fail, the `ReportComponentFailures` target will generate an appropriate error. Furthermore, update all the `` invocations within `RunTests.targets` and add `ContinueOnError="ErrorAndContinue"` to all of them, to help ensure that we run all the tests we have, even if previous tests fail. --- build-tools/scripts/RunTests.targets | 15 +++++++++++++-- build-tools/scripts/TestApks.targets | 2 ++ tests/RunApkTests.targets | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/build-tools/scripts/RunTests.targets b/build-tools/scripts/RunTests.targets index a19827b8585..cf03ca3dba2 100644 --- a/build-tools/scripts/RunTests.targets +++ b/build-tools/scripts/RunTests.targets @@ -38,19 +38,25 @@ <_RenamedTestCases>@(_RenameNUnitTestCasesGlob) - + @@ -61,6 +67,7 @@ <_RenamedTestCases>@(_RenameJITestCasesGlob) - + + +