Skip to content

Commit 9db38b0

Browse files
committed
[tests] Run the Java.Interop unit tests
We'd like to run the Java.Interop unit tests as part of the xamarin-android `make run-all-tests` target, for two rasons: 1. An extra layer of sanity checking, and 2. Some of the Java.Interop tests require an Android SDK. In particular, the `ParameterFixupTests.XmlDeclaration_FixedUpFromDocumentation()` test from `Xamarin.Android.Tools.Bytecode-Tests.dll` attempts to read Android documentation from `$ANDROID_SDK_PATH` to test parameter name fixups. However, Java.Interop doesn't install -- and thus can't readily require -- an Android SDK, meaning this test is never executed as part of the Java.Interop Jenkins process. That test *can* be readily executed in xamarin-android, as it *does* install an Android SDK, and thus its presence can be assumed. Add a new `make run-ji-tests` target which runs the Java.Interop unit tests, copying their test output into the same directory that the other `TestResult-*.xml` files are placed, so that Jenkins can pick them up for display. Within the `make run-ji-tests` target, export the `ANDROID_SDK_PATH` environment variable so that *all* the `Xamarin.Android.Tools.Bytecode-Tests.dll` tests can execute. Which introduces one problem: the `Xamarin.Android.Tools.Bytecode-Tests.dll` tests require that `$ANDROID_SDK_PATH` contain documentation...which we're not currently installing. Result: the `ParameterFixupTest` tests fail. :-( Fix this conundrum by instaslling `docs-24_r01.zip` within `$(AndroidSdkDirectory)`, allowing the tests to execute as intended.
1 parent 4ae27d4 commit 9db38b0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ linux-prepare-$(LINUX_DISTRO)::
136136
linux-prepare-$(LINUX_DISTRO)-$(LINUX_DISTRO_RELEASE)::
137137
endif
138138

139-
run-all-tests: run-nunit-tests run-apk-tests
139+
run-all-tests: run-nunit-tests run-ji-tests run-apk-tests
140140

141141
clean:
142142
$(MSBUILD) $(MSBUILD_FLAGS) /t:Clean Xamarin.Android.sln
@@ -165,6 +165,11 @@ endef
165165
run-nunit-tests: $(NUNIT_TESTS)
166166
$(foreach t,$(NUNIT_TESTS), $(call RUN_NUNIT_TEST,$(t),1))
167167

168+
run-ji-tests:
169+
$(MAKE) -C "$(call GetPath,JavaInterop)" CONFIGURATION=$(CONFIGURATION) all
170+
ANDROID_SDK_PATH="$(call GetPath,AndroidSdk)" $(MAKE) -C "$(call GetPath,JavaInterop)" CONFIGURATION=$(CONFIGURATION) run-all-tests
171+
cp "$(call GetPath,JavaInterop)"/TestResult-*.xml .
172+
168173
# .apk files to test on-device need to:
169174
# (1) Have their .csproj files listed here
170175
# (2) Add a `@(UnitTestApk)` entry to `tests/RunApkTests.targets`

build-tools/android-toolchain/android-toolchain.projitems

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090
<HostOS></HostOS>
9191
<DestDir>extras\android\m2repository</DestDir>
9292
</AndroidSdkItem>
93+
<AndroidSdkItem Include="docs-24_r01.zip">
94+
<HostOS></HostOS>
95+
<DestDir>docs</DestDir>
96+
</AndroidSdkItem>
9397
<AndroidSdkItem Include="sysimg_x86-21_r03.zip">
9498
<HostOS></HostOS>
9599
<RelUrl>sys-img/android/</RelUrl>

0 commit comments

Comments
 (0)