From 74ee7adaa77099e80a16b4a0fddfab33ca60de1d Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 9 Mar 2017 21:08:48 -0500 Subject: [PATCH] [tests] Run `adb logcat -d` if any .apk tests fail As noted in commit 3b893cd4, [PR 445][0] was showing up as a successful build, while none of the .apk tests ran. Commit 3b893cd4 "improves" matters by ensuring that we flag this as an error, instead of blithely ignoring it. Unfortunately, knowing that there's an error doesn't help in diagnosing what the error *is*. In the case of segmentation faults, the `INSTRUMENTATION_RESULT` messages will *not* be helpful. What *would* be helpful is `adb logcat` output, which we don't capture. Let's fix that: if an error occurs -- e.g. `RunInstrumentationTests.FailedToRun` is a non-empty string, which is collected in the `@(_FailedComponent)` item group -- then we should run `adb logcat -d` before terminating the emulator. This will cause the build and test log output to contain `adb logcat` output, which may provide *some* additional context regarding .apk failures. [0]: https://github.com/xamarin/xamarin-android/pull/445 --- build-tools/scripts/UnitTestApks.targets | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build-tools/scripts/UnitTestApks.targets b/build-tools/scripts/UnitTestApks.targets index fdeaef1cf73..0f7a1c759c7 100644 --- a/build-tools/scripts/UnitTestApks.targets +++ b/build-tools/scripts/UnitTestApks.targets @@ -57,6 +57,12 @@ +