diff --git a/Makefile b/Makefile
index d1e8d3798eb..d632e301f89 100644
--- a/Makefile
+++ b/Makefile
@@ -146,12 +146,24 @@ TEST_APK_PROJECTS = \
tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj \
tests/locales/Xamarin.Android.Locale-Tests/Xamarin.Android.Locale-Tests.csproj
-# Syntax: $(call BUILD_TEST_APK,path/to/project.csproj)
+TEST_APK_PROJECTS_RELEASE = \
+ src/Mono.Android/Test/Mono.Android-Tests.csproj
+
+# Syntax: $(call BUILD_TEST_APK,path/to/project.csproj,additional_msbuild_flags)
define BUILD_TEST_APK
# Must use xabuild to ensure correct assemblies are resolved
- MSBUILD="$(MSBUILD)" tools/scripts/xabuild $(MSBUILD_FLAGS) /t:SignAndroidPackage $(1)
+ MSBUILD="$(MSBUILD)" tools/scripts/xabuild $(MSBUILD_FLAGS) /t:SignAndroidPackage $(2) $(1)
endef # BUILD_TEST_APK
+# Syntax: $(call RUN_APK_TESTS,projects,additional_msbuild_flags)
+define RUN_APK_TESTS
+ $(foreach p, $(1), $(call BUILD_TEST_APK, $(p),$(2)))
+ $(MSBUILD) $(MSBUILD_FLAGS) $(2) tests/RunApkTests.targets
+endef
+
run-apk-tests:
- $(foreach p, $(TEST_APK_PROJECTS), $(call BUILD_TEST_APK, $(p)))
- $(MSBUILD) $(MSBUILD_FLAGS) tests/RunApkTests.targets
+ $(call RUN_APK_TESTS, $(TEST_APK_PROJECTS), )
+ifneq ($(wildcard bin/Release),)
+ $(call RUN_APK_TESTS, $(TEST_APK_PROJECTS_RELEASE), /p:Configuration=Release)
+ $(call RUN_APK_TESTS, $(TEST_APK_PROJECTS_RELEASE), /p:Configuration=Release /p:AotAssemblies=true)
+endif
diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ProcessLogcatTiming.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ProcessLogcatTiming.cs
index 1f1f5e2f036..ab8968de739 100644
--- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ProcessLogcatTiming.cs
+++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ProcessLogcatTiming.cs
@@ -103,7 +103,7 @@ public override bool Execute ()
Log.LogMessage (MessageImportance.Normal, $"Last timing message: {(last - start).TotalMilliseconds}ms");
if (ResultsFilename != null) {
- using (var resultsFile = new StreamWriter (Path.Combine (Path.GetDirectoryName (ResultsFilename), $"Test-{ApplicationPackageName}-times.csv"))) {
+ using (var resultsFile = new StreamWriter (Path.Combine (Path.GetDirectoryName (ResultsFilename), $"{Path.GetFileNameWithoutExtension (ResultsFilename)}-times.csv"))) {
WriteValues (resultsFile, results.Keys);
WriteValues (resultsFile, results.Values);
resultsFile.Close ();
diff --git a/src/Mono.Android/Test/Mono.Android-Tests.projitems b/src/Mono.Android/Test/Mono.Android-Tests.projitems
index e8ca35c8eb5..b4b2369abd5 100644
--- a/src/Mono.Android/Test/Mono.Android-Tests.projitems
+++ b/src/Mono.Android/Test/Mono.Android-Tests.projitems
@@ -4,7 +4,7 @@
Mono.Android_Tests
xamarin.android.runtimetests.TestInstrumentation
- $(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests.xml
+ $(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests-$(Configuration)$(_AotName).xml
diff --git a/tests/RunApkTests.targets b/tests/RunApkTests.targets
index a6cb94898c7..13584cf9b8f 100644
--- a/tests/RunApkTests.targets
+++ b/tests/RunApkTests.targets
@@ -1,17 +1,20 @@
- Debug
+ Debug
$(MSBuildThisFileDirectory)..\bin\Test$(Configuration)\
+
+ <_AotName Condition=" '$(AotAssemblies)' == 'true' ">-Aot
+
-
-
+
+