File tree Expand file tree Collapse file tree 6 files changed +52
-4
lines changed
build-tools/automation/yaml-templates
tests/Mono.Android-Tests/Mono.Android-Tests
Xamarin.Android.RuntimeTests Expand file tree Collapse file tree 6 files changed +52
-4
lines changed Original file line number Diff line number Diff line change @@ -199,10 +199,20 @@ stages:
199199 testName : Mono.Android.NET_Tests-CoreCLR
200200 project : tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj
201201 testResultsFiles : TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration)CoreCLR.xml
202- extraBuildArgs : -p:TestsFlavor=CoreCLR -p:UseMonoRuntime=false
202+ extraBuildArgs : -p:MonoAndroidTypeMapFlavor=legacy
203203 artifactSource : bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
204204 artifactFolder : $(DotNetTargetFramework)-CoreCLR
205205
206+ - template : /build-tools/automation/yaml-templates/apk-instrumentation.yaml
207+ parameters :
208+ configuration : $(XA.Build.Configuration)
209+ testName : Mono.Android.NET_Tests-CoreCLRTrimmable
210+ project : tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj
211+ testResultsFiles : TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration)CoreCLRTrimmable.xml
212+ extraBuildArgs : -p:MonoAndroidTypeMapFlavor=trimmable
213+ artifactSource : bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
214+ artifactFolder : $(DotNetTargetFramework)-CoreCLRTrimmable
215+
206216 - template : /build-tools/automation/yaml-templates/apk-instrumentation.yaml
207217 parameters :
208218 configuration : $(XA.Build.Configuration)
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ namespace Java.InteropTests {
1515 [ TestFixture ]
1616 public class JavaObjectExtensionsTests {
1717
18- [ Test ]
18+ [ Test , Category ( "TrimmableIgnore" ) ]
1919 public void JavaCast_BaseToGenericWrapper ( )
2020 {
2121 using ( var list = new JavaList ( new [ ] { 1 , 2 , 3 } ) )
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ public void InvokingNullInstanceDoesNotCrashDalvik ()
121121 }
122122 }
123123
124- [ Test ]
124+ [ Test , Category ( "TrimmableIgnore" ) ]
125125 public void NewOpenGenericTypeThrows ( )
126126 {
127127 try {
@@ -301,7 +301,7 @@ public void ActivatedDirectObjectSubclassesShouldBeRegistered ()
301301 }
302302 }
303303
304- [ Test ]
304+ [ Test , Category ( "TrimmableIgnore" ) ]
305305 public void ActivatedDirectThrowableSubclassesShouldBeRegistered ( )
306306 {
307307 if ( Build . VERSION . SdkInt <= BuildVersionCodes . GingerbreadMr1 )
Original file line number Diff line number Diff line change @@ -72,9 +72,11 @@ public void JnienvCreateInstance_RegistersMultipleInstances ()
7272
7373 var intermediate = CreateInstance_OverrideAbsListView_Adapter . Intermediate ;
7474 var registered = Java . Lang . Object . GetObject < CreateInstance_OverrideAbsListView_Adapter > ( adapter . Handle , JniHandleOwnership . DoNotTransfer ) ;
75+ var asBase = Java . Lang . Object . GetObject < AbsListView > ( adapter . Handle , JniHandleOwnership . DoNotTransfer ) ;
7576
7677 Assert . AreNotSame ( adapter , intermediate ) ;
7778 Assert . AreSame ( adapter , registered ) ;
79+ Assert . AreSame ( adapter , asBase ) ;
7880 }
7981 }
8082
Original file line number Diff line number Diff line change 3737 <ExcludeCategories Condition =" '$(EnableLLVM)' == 'true' " >$(ExcludeCategories):InetAccess:NetworkInterfaces</ExcludeCategories >
3838 </PropertyGroup >
3939
40+ <PropertyGroup >
41+ <MonoAndroidTypeMapFlavor Condition =" '$(MonoAndroidTypeMapFlavor)' == '' " ></MonoAndroidTypeMapFlavor >
42+ <UseMonoRuntime Condition =" '$(MonoAndroidTypeMapFlavor)' != '' and '$(UseMonoRuntime)' == '' and '$(PublishAot)' != 'true' " >false</UseMonoRuntime >
43+ <_AndroidTypeMapImplementation Condition =" '$(MonoAndroidTypeMapFlavor)' == 'legacy' and '$(_AndroidTypeMapImplementation)' == '' " >llvm-ir</_AndroidTypeMapImplementation >
44+ <_AndroidTypeMapImplementation Condition =" '$(MonoAndroidTypeMapFlavor)' == 'trimmable' and '$(_AndroidTypeMapImplementation)' == '' " >trimmable</_AndroidTypeMapImplementation >
45+ <TestsFlavor Condition =" '$(TestsFlavor)' == '' and '$(MonoAndroidTypeMapFlavor)' == 'legacy' " >CoreCLR</TestsFlavor >
46+ <TestsFlavor Condition =" '$(TestsFlavor)' == '' and '$(MonoAndroidTypeMapFlavor)' == 'trimmable' " >CoreCLRTrimmable</TestsFlavor >
47+ <ExcludeCategories Condition =" '$(MonoAndroidTypeMapFlavor)' == 'trimmable' " >$(ExcludeCategories):NativeTypeMap:TrimmableIgnore:SSL</ExcludeCategories >
48+ </PropertyGroup >
49+
4050 <ItemGroup >
4151 <PackageReference Include =" Mono.Linq.Expressions" Version =" 2.0.0" />
4252 </ItemGroup >
260270 </TestAab >
261271 </ItemGroup >
262272
273+ <Target Name =" _ValidateMonoAndroidTypeMapFlavor"
274+ BeforeTargets =" Build" >
275+ <Error Condition =" '$(MonoAndroidTypeMapFlavor)' != '' and '$(MonoAndroidTypeMapFlavor)' != 'legacy' and '$(MonoAndroidTypeMapFlavor)' != 'trimmable' "
276+ Text =" Invalid value for MonoAndroidTypeMapFlavor: '$(MonoAndroidTypeMapFlavor)'. Valid values are: legacy, trimmable." />
277+ <Error Condition =" '$(MonoAndroidTypeMapFlavor)' != '' and '$(PublishAot)' == 'true' "
278+ Text =" MonoAndroidTypeMapFlavor only supports the Mono.Android.NET-Tests CoreCLR configurations." />
279+ <Error Condition =" '$(MonoAndroidTypeMapFlavor)' != '' and '$(UseMonoRuntime)' == 'true' "
280+ Text =" MonoAndroidTypeMapFlavor requires CoreCLR. Remove UseMonoRuntime=true." />
281+ <Error Condition =" '$(MonoAndroidTypeMapFlavor)' == 'trimmable' and '$(_AndroidTypeMapImplementation)' != 'trimmable' "
282+ Text =" MonoAndroidTypeMapFlavor=trimmable requires _AndroidTypeMapImplementation=trimmable." />
283+ </Target >
284+
263285 <Import Project =" $(XamarinAndroidSourcePath)build-tools\scripts\TestApks.targets" />
264286
265287</Project >
Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ protected override string LogTag
2525 protected NUnitInstrumentation ( IntPtr handle , JniHandleOwnership transfer )
2626 : base ( handle , transfer )
2727 {
28+ if ( Microsoft . Android . Runtime . RuntimeFeature . TrimmableTypeMap ) {
29+ // Java.Interop-Tests fixtures that use JavaObject types (not Java.Lang.Object)
30+ // don't have JCW Java classes in the trimmable APK, and method remapping
31+ // tests require Java-side support not present in the trimmable path.
32+ // Exclude these entire fixtures to prevent ClassNotFoundException crashes.
33+ ExcludedTestNames = new [ ] {
34+ "Java.InteropTests.JavaObjectTest" ,
35+ "Java.InteropTests.InvokeVirtualFromConstructorTests" ,
36+ "Java.InteropTests.JniPeerMembersTests" ,
37+ "Java.InteropTests.JniTypeManagerTests" ,
38+ "Java.InteropTests.JniValueMarshaler_object_ContractTests" ,
39+ "Java.InteropTests.JavaExceptionTests.InnerExceptionIsNotAProxy" ,
40+ } ;
41+ }
2842 }
2943
3044 protected override IList < TestAssemblyInfo > GetTestAssemblies ( )
You can’t perform that action at this time.
0 commit comments