Skip to content

Commit ff09abd

Browse files
radekdoulikjonpryor
authored andcommitted
[tests] Run runtime test in Release & Release+AOT (#748)
- besides running in different configurations than default (Debug), we will also use the startup times measurements in the Jenkins plots - also fixes a typo in `RunApkTests.targets`, where supposedly `Condition` was used in place of `Configuration` - modifies logcat timing file names, so that it is based on test results filename instead of just package name. that way we can have multiple timing results for the same test with various configurations
1 parent 51ff41b commit ff09abd

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,24 @@ TEST_APK_PROJECTS = \
146146
tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj \
147147
tests/locales/Xamarin.Android.Locale-Tests/Xamarin.Android.Locale-Tests.csproj
148148

149-
# Syntax: $(call BUILD_TEST_APK,path/to/project.csproj)
149+
TEST_APK_PROJECTS_RELEASE = \
150+
src/Mono.Android/Test/Mono.Android-Tests.csproj
151+
152+
# Syntax: $(call BUILD_TEST_APK,path/to/project.csproj,additional_msbuild_flags)
150153
define BUILD_TEST_APK
151154
# Must use xabuild to ensure correct assemblies are resolved
152-
MSBUILD="$(MSBUILD)" tools/scripts/xabuild $(MSBUILD_FLAGS) /t:SignAndroidPackage $(1)
155+
MSBUILD="$(MSBUILD)" tools/scripts/xabuild $(MSBUILD_FLAGS) /t:SignAndroidPackage $(2) $(1)
153156
endef # BUILD_TEST_APK
154157

158+
# Syntax: $(call RUN_APK_TESTS,projects,additional_msbuild_flags)
159+
define RUN_APK_TESTS
160+
$(foreach p, $(1), $(call BUILD_TEST_APK, $(p),$(2)))
161+
$(MSBUILD) $(MSBUILD_FLAGS) $(2) tests/RunApkTests.targets
162+
endef
163+
155164
run-apk-tests:
156-
$(foreach p, $(TEST_APK_PROJECTS), $(call BUILD_TEST_APK, $(p)))
157-
$(MSBUILD) $(MSBUILD_FLAGS) tests/RunApkTests.targets
165+
$(call RUN_APK_TESTS, $(TEST_APK_PROJECTS), )
166+
ifneq ($(wildcard bin/Release),)
167+
$(call RUN_APK_TESTS, $(TEST_APK_PROJECTS_RELEASE), /p:Configuration=Release)
168+
$(call RUN_APK_TESTS, $(TEST_APK_PROJECTS_RELEASE), /p:Configuration=Release /p:AotAssemblies=true)
169+
endif

build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/ProcessLogcatTiming.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public override bool Execute ()
103103
Log.LogMessage (MessageImportance.Normal, $"Last timing message: {(last - start).TotalMilliseconds}ms");
104104

105105
if (ResultsFilename != null) {
106-
using (var resultsFile = new StreamWriter (Path.Combine (Path.GetDirectoryName (ResultsFilename), $"Test-{ApplicationPackageName}-times.csv"))) {
106+
using (var resultsFile = new StreamWriter (Path.Combine (Path.GetDirectoryName (ResultsFilename), $"{Path.GetFileNameWithoutExtension (ResultsFilename)}-times.csv"))) {
107107
WriteValues (resultsFile, results.Keys);
108108
WriteValues (resultsFile, results.Values);
109109
resultsFile.Close ();

src/Mono.Android/Test/Mono.Android-Tests.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<UnitTestApk Include="$(OutputPath)Mono.Android_Tests-Signed.apk">
55
<Package>Mono.Android_Tests</Package>
66
<InstrumentationType>xamarin.android.runtimetests.TestInstrumentation</InstrumentationType>
7-
<ResultsPath>$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests.xml</ResultsPath>
7+
<ResultsPath>$(MSBuildThisFileDirectory)..\..\..\TestResult-Mono.Android_Tests-$(Configuration)$(_AotName).xml</ResultsPath>
88
</UnitTestApk>
99
</ItemGroup>
1010
</Project>

tests/RunApkTests.targets

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<Project DefaultTargets="RunApkTests" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4-
<Configuration Condition=" '$(Condition)' == '' ">Debug</Configuration>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
55
<OutputPath>$(MSBuildThisFileDirectory)..\bin\Test$(Configuration)\</OutputPath>
66
</PropertyGroup>
77
<Import Project="..\Configuration.props" />
8+
<PropertyGroup>
9+
<_AotName Condition=" '$(AotAssemblies)' == 'true' ">-Aot</_AotName>
10+
</PropertyGroup>
811
<!--
912
Note that the `.csproj` for each `@(UnitTestApk)` entry *must* be added to
1013
`$(TEST_APK_PROJECTS)` in the toplevel Makefile so that the `.apk` is built.
1114
-->
1215
<Import Project="..\src\Mono.Android\Test\Mono.Android-Tests.projitems" />
13-
<Import Project="..\tests\CodeGen-Binding\Xamarin.Android.JcwGen-Tests\Xamarin.Android.JcwGen-Tests.projitems" />
14-
<Import Project="..\tests\locales\Xamarin.Android.Locale-Tests\Xamarin.Android.Locale-Tests.projitems" />
16+
<Import Project="..\tests\CodeGen-Binding\Xamarin.Android.JcwGen-Tests\Xamarin.Android.JcwGen-Tests.projitems" Condition=" '$(Configuration)' == 'Debug' " />
17+
<Import Project="..\tests\locales\Xamarin.Android.Locale-Tests\Xamarin.Android.Locale-Tests.projitems" Condition=" '$(Configuration)' == 'Debug' " />
1518
<Import Project="..\build-tools\scripts\UnitTestApks.targets" />
1619
<PropertyGroup>
1720
<RunApkTestsDependsOn>

0 commit comments

Comments
 (0)