[Xamarin.Android.Bcl-Tests] Run in Release configuration

The [Jenkins `xamarin-android` build][xae9] for commit e9daf5ea was
unexpectedly UNSTABLE, because an error was encountered:

[xae9]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/662/

	Tool …/adb execution started with arguments: -s emulator-5570  install "…/xamarin-android/tests/../bin/TestRelease/Xamarin.Android.Bcl_Tests-Signed.apk"
	adb: error: cannot stat '…/xamarin-android/tests/../bin/TestRelease/Xamarin.Android.Bcl_Tests-Signed.apk':
	No such file or directory

The error was encountered because `tests/Xamarin.Android.Bcl-Tests`
wasn't built for the Release configuration, because it wasn't part of
`$(TEST_APK_PROJECTS_RELEASE)` within `Makefile`.

This raises an interesting question: what is the best solution?

 1. Make `Xamarin.Android.Bcl-Tests` a Debug-only unit test.
 2. Build and run `Xamarin.Android.Bcl-Tests` in both Debug & Release.

...quickly followed by a *second* question:

Why are some tests Debug-only and some aren't?

I don't have a good handle on this second question, other than that it
would "duplicate" unit test execution, thus lengthening build times.

However, I'm not convinced that's a good rationale, either: the
Release runtime has optimizations (`-O0 -fno-omit-frame-pointer` Debug
vs. `-O2` Release), which could theoretically break a great many
things.  The Release runtime is also what is used in our commercial
products; the Debug runtime is largely only useful for #runtime
debugging.

We thus should want as many tests as possible to run in Release, not
as few as possible

This allows us to tentatively answer the first question: we should add
`Xamarin.Android.Bcl-Tests` to `$(TEST_APK_PROJECTS_RELEASE)` so that
it's run in *both* Debug *and* Release configurations. This in turn
will ensure that the failing `adb install` command succeeds, which
*should* allow the build to PASS, as desired.
This commit is contained in:
Jonathan Pryor 2017-10-03 22:00:16 -04:00
Родитель e9daf5ea35
Коммит d1d9820ac0
2 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -161,6 +161,7 @@ TEST_APK_PROJECTS = \
TEST_APK_PROJECTS_RELEASE = \
src/Mono.Android/Test/Mono.Android-Tests.csproj \
tests/Xamarin.Android.Bcl-Tests/Xamarin.Android.Bcl-Tests.csproj \
tests/Xamarin.Forms-Performance-Integration/Droid/Xamarin.Forms.Performance.Integration.Droid.csproj
# Syntax: $(call BUILD_TEST_APK,path/to/project.csproj,additional_msbuild_flags)

Просмотреть файл

@ -12,6 +12,11 @@
Note that the `.csproj` for each `@(TestApk)` entry *must* be added to
`$(TEST_APK_PROJECTS)` and/or `$(TEST_APK_PROJECTS_RELEASE)`
in the toplevel Makefile so that the `.apk` is built.
The `<Import/>` should have `Condition=" '$(Configuration)' == 'Debug' "`
if the test should only be run in the Debug configuration. If it will be
built in Release configuration, *also* update
`$(TEST_APK_PROJECTS_RELEASE)` within the toplevel `Makefile`.
-->
<Import Project="..\src\Mono.Android\Test\Mono.Android-Tests.projitems" />
<Import Project="..\tests\Xamarin.Android.Bcl-Tests\Xamarin.Android.Bcl-Tests.projitems" />