Skip to content

Commit c096099

Browse files
[coreclr] run Mono.Android-Tests (#9916)
Context: #10069 This runs Mono.Android-Tests with `-p:UseMonoRuntime=false`. I temporarily disabled: * The `Java.Interop-Tests.dll` test assembly * `GCBridge` category, related to a missing "GC Bridge" * `SSL` and `NTLM` categories related to some http tests * `RuntimeConfig` category related to `runtimeconfig.json` * Some individual tests I left a `TODO` comment for each ignored test, to investigate in the future.
1 parent 479cb3b commit c096099

File tree

12 files changed

+30
-5
lines changed

12 files changed

+30
-5
lines changed

build-tools/automation/yaml-templates/stage-package-tests.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ stages:
198198
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
199199
artifactFolder: $(DotNetTargetFramework)-AotLlvm
200200

201+
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
202+
parameters:
203+
configuration: $(XA.Build.Configuration)
204+
testName: Mono.Android.NET_Tests-CoreCLR
205+
project: tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj
206+
testResultsFiles: TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration)CoreCLR.xml
207+
extraBuildArgs: -p:TestsFlavor=CoreCLR -p:UseMonoRuntime=false -p:AndroidEnableMarshalMethods=false
208+
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
209+
artifactFolder: $(DotNetTargetFramework)-CoreCLR
210+
201211
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
202212
parameters:
203213
configuration: $(XA.Build.Configuration)

build-tools/scripts/TestApks.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<PropertyGroup>
2020
<!-- APK tests might run on 32-bit emulators -->
21-
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' ">android-arm64;android-x86;android-x64;</RuntimeIdentifiers>
21+
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' and '$(PublishAot)' != 'true' and '$(UseMonoRuntime)' != 'false' ">android-arm64;android-x86;android-x64;</RuntimeIdentifiers>
2222
<TestAvdApiLevel Condition=" '$(TestAvdApiLevel)' == '' ">29</TestAvdApiLevel>
2323
<TestAvdAbi Condition=" '$(TestAvdAbi)' == '' and '$(HostOS)' == 'Darwin' and '$(HostOSArchitecture)' == 'Arm64' ">arm64-v8a</TestAvdAbi>
2424
<TestAvdAbi Condition=" '$(TestAvdAbi)' == '' ">x86_64</TestAvdAbi>

tests/Mono.Android-Tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ public void SetField_PermitNullValues ()
239239
}
240240

241241
[Test]
242+
[Category ("CoreCLRIgnore")] //TODO: https://github.com/dotnet/android/issues/10069
242243
public void CreateTypeWithExportedMethods ()
243244
{
244245
using (var e = new ContainsExportedMethods ()) {
@@ -251,6 +252,7 @@ public void CreateTypeWithExportedMethods ()
251252
}
252253

253254
[Test]
255+
[Category ("CoreCLRIgnore")] //TODO: https://github.com/dotnet/android/issues/10069
254256
public void ActivatedDirectObjectSubclassesShouldBeRegistered ()
255257
{
256258
if (Build.VERSION.SdkInt <= BuildVersionCodes.GingerbreadMr1)
@@ -426,7 +428,7 @@ public void ManagedToJavaTypeMapping ()
426428
Assert.AreEqual (null, m, "`JnienvTest` does *not* subclass Java.Lang.Object, it should *not* be in the typemap!");
427429
}
428430

429-
[Test]
431+
[Test, Category ("GCBridge")]
430432
public void DoNotLeakWeakReferences ()
431433
{
432434
GC.Collect ();

tests/Mono.Android-Tests/Mono.Android-Tests/Java.Lang/ObjectTest.cs

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static MethodInfo MakeGenericMethod (MethodInfo method, Type type) =>
6666
}
6767

6868
[Test]
69+
[Category ("CoreCLRIgnore")] //TODO: https://github.com/dotnet/android/issues/10069
6970
public void JnienvCreateInstance_RegistersMultipleInstances ()
7071
{
7172
using (var adapter = new CreateInstance_OverrideAbsListView_Adapter (Application.Context)) {

tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@
2222
<WarningsAsErrors>IL2037</WarningsAsErrors>
2323
<AndroidUseNegotiateAuthentication>true</AndroidUseNegotiateAuthentication>
2424
<AndroidNdkDirectory></AndroidNdkDirectory>
25+
<DefineConstants Condition=" '$(UseMonoRuntime)' == 'false' ">$(DefineConstants);CORECLR</DefineConstants>
26+
<DefineConstants Condition=" '$(PublishAot)' == 'true' ">$(DefineConstants);NATIVEAOT</DefineConstants>
2527
<!--
2628
TODO: Fix excluded tests
2729
For $(EnableLLVM)
2830
InetAccess excluded: https://github.com/dotnet/runtime/issues/73304
2931
NetworkInterfaces excluded: https://github.com/dotnet/runtime/issues/75155
3032
-->
3133
<ExcludeCategories>DotNetIgnore</ExcludeCategories>
34+
<!-- TODO: https://github.com/dotnet/android/issues/10069 -->
35+
<ExcludeCategories Condition=" '$(UseMonoRuntime)' == 'false' ">$(ExcludeCategories):CoreCLRIgnore:SSL:NTLM:GCBridge:RuntimeConfig</ExcludeCategories>
3236
<!-- FIXME: LLVMIgnore https://github.com/dotnet/runtime/issues/89190 -->
3337
<ExcludeCategories Condition=" '$(EnableLLVM)' == 'true' ">$(ExcludeCategories):LLVMIgnore</ExcludeCategories>
3438
<ExcludeCategories Condition=" '$(EnableLLVM)' == 'true' ">$(ExcludeCategories):InetAccess:NetworkInterfaces</ExcludeCategories>

tests/Mono.Android-Tests/Mono.Android-Tests/System.Net/SslTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
using NUnit.Framework;
1010

1111
namespace System.NetTests {
12-
13-
[TestFixture, Category ("InetAccess")]
12+
// TODO: https://github.com/dotnet/android/issues/10069
13+
[TestFixture, Category ("InetAccess"), Category ("SSL")]
1414
public class SslTest
1515
{
1616
bool ShouldIgnoreException (WebException wex)

tests/Mono.Android-Tests/Mono.Android-Tests/System/AppContextTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace SystemTests
77
{
88
[TestFixture]
9+
[Category ("RuntimeConfig")] //TODO: https://github.com/dotnet/android/issues/10069
910
public class AppContextTests
1011
{
1112
static readonly object [] GetDataSource = new object [] {

tests/Mono.Android-Tests/Mono.Android-Tests/System/ExceptionTest.cs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static Java.Lang.Throwable CreateJavaProxyThrowable (Exception e)
2929
}
3030

3131
[Test]
32+
[Category ("CoreCLRIgnore")] //TODO: https://github.com/dotnet/android/issues/10069
3233
[RequiresUnreferencedCode ("Tests trimming unsafe features")]
3334
public void InnerExceptionIsSet ()
3435
{

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidClientHandlerTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646

4747
namespace Xamarin.Android.NetTests {
4848
[Category("InetAccess")]
49+
[Category ("SSL")] // TODO: https://github.com/dotnet/android/issues/10069
4950
public abstract class HttpClientHandlerTestBase
5051
{
5152
protected abstract HttpMessageHandler CreateHandler ();

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidMessageHandlerNegotiateAuthenticationTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Xamarin.Android.NetTests {
1313
// Important: We expect the Negotiate authentication feature to be enabled in all of these tests because we set $(AndroidUseNegotiateAuthentication)=true
1414
// in the Mono.Android.NET-Tests.csproj file.
1515
[TestFixture]
16-
[Category ("InetAccess")]
16+
[Category ("InetAccess"), Category ("NTLM")] // TODO: https://github.com/dotnet/android/issues/10069
1717
public sealed class AndroidMessageHandlerNegotiateAuthenticationTests
1818
{
1919
// Negotiate authentication is available for Android since .NET 7

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.Net/AndroidMessageHandlerTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace Xamarin.Android.NetTests
1515
{
1616
[TestFixture]
17+
[Category ("SSL")] // TODO: https://github.com/dotnet/android/issues/10069
1718
public class AndroidMessageHandlerTests : AndroidHandlerTestBase
1819
{
1920
protected override HttpMessageHandler CreateHandler ()

tests/Mono.Android-Tests/Mono.Android-Tests/Xamarin.Android.RuntimeTests/NUnitInstrumentation.cs

+4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ protected NUnitInstrumentation(IntPtr handle, JniHandleOwnership transfer)
3030
protected override IList<TestAssemblyInfo> GetTestAssemblies()
3131
{
3232
Assembly asm = Assembly.GetExecutingAssembly();
33+
#if !NATIVEAOT && !CORECLR // TODO: Java.Interop-Tests not passing yet
3334
Assembly ji = typeof (Java.InteropTests.JavaInterop_Tests_Reference).Assembly;
35+
#endif
3436

3537

3638
return new List<TestAssemblyInfo>()
3739
{
3840
new TestAssemblyInfo (asm, asm.Location ?? String.Empty),
41+
#if !NATIVEAOT && !CORECLR
3942
new TestAssemblyInfo (ji, ji.Location ?? String.Empty),
43+
#endif
4044
};
4145
}
4246
}

0 commit comments

Comments
 (0)