diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 31544ce4dce..8599cd6859c 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -588,6 +588,27 @@ stages: artifactName: com.companyname.vsandroidapp-Signed.apk artifactFolder: Default + - task: MSBuild@1 + displayName: run Mono.Android.NET_Tests + inputs: + solution: tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj + configuration: $(ApkTestConfiguration) + msbuildArguments: /t:RunDotNetInstrumentation + continueOnError: true + + - script: > + mkdir -p $(Build.ArtifactStagingDirectory)/OneDotNet && + cp "$(System.DefaultWorkingDirectory)/bin/Test$(ApkTestConfiguration)/net5.0-android/Mono.Android.NET_Tests-Signed.apk" "$(Build.ArtifactStagingDirectory)/OneDotNet" + displayName: copy apk/aab + continueOnError: true + + - task: PublishTestResults@2 + displayName: publish Mono.Android.NET_Tests results + inputs: + testResultsFormat: NUnit + testResultsFiles: TestResult-Mono.Android.NET_Tests-$(ApkTestConfiguration).xml + testRunTitle: Mono.Android.NET_Tests + - task: MSBuild@1 displayName: shut down emulator inputs: diff --git a/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Required.cs b/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Required.cs index 67c2ae1d618..c00c9b39aca 100644 --- a/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Required.cs +++ b/build-tools/xaprepare/xaprepare/Scenarios/Scenario_Required.cs @@ -21,7 +21,6 @@ protected override void AddSteps (Context context) // Install essential tools, should they be missing context.SetCondition (KnownConditions.EnsureEssential, true); - Steps.Add (new Step_InstallDotNetPreview ()); Steps.Add (new Step_GenerateFiles (atBuildStart: true, onlyRequired: true)); Steps.Add (new Step_PrepareExternalJavaInterop ()); } diff --git a/src-ThirdParty/NUnitLite/Internal/TestExecutionContext.cs b/src-ThirdParty/NUnitLite/Internal/TestExecutionContext.cs index 7b06fa69aaa..de363d89d01 100644 --- a/src-ThirdParty/NUnitLite/Internal/TestExecutionContext.cs +++ b/src-ThirdParty/NUnitLite/Internal/TestExecutionContext.cs @@ -34,7 +34,7 @@ #endif using NUnit.Framework.Api; -#if !SILVERLIGHT && !NETCF +#if !SILVERLIGHT && !NETCF && !NET using System.Runtime.Remoting.Messaging; #endif @@ -53,7 +53,7 @@ namespace NUnit.Framework.Internal /// object on the top of the stack. /// public class TestExecutionContext -#if !SILVERLIGHT && !NETCF +#if !SILVERLIGHT && !NETCF && !NET : ILogicalThreadAffinative #endif { diff --git a/src/Mono.Android/Properties/AssemblyInfo.cs.in b/src/Mono.Android/Properties/AssemblyInfo.cs.in index 960d373e6fa..3010a83ebfd 100644 --- a/src/Mono.Android/Properties/AssemblyInfo.cs.in +++ b/src/Mono.Android/Properties/AssemblyInfo.cs.in @@ -31,3 +31,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Java.Interop-Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] [assembly: InternalsVisibleTo("Mono.Android-TestsMultiDex, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] [assembly: InternalsVisibleTo("Mono.Android-TestsAppBundle, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +[assembly: InternalsVisibleTo("Mono.Android.NET-Tests, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AndroidLibraries.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AndroidLibraries.targets index cb8a6c3bc59..e8fdcd05fb7 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AndroidLibraries.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.AndroidLibraries.targets @@ -66,6 +66,7 @@ projects. <_CreateAarInputs Include="@(AndroidAsset)" /> <_CreateAarInputs Include="@(_AndroidResourceDest)" /> <_CreateAarInputs Include="@(AndroidEnvironment)" /> + <_CreateAarInputs Include="@(AndroidJavaLibrary)" /> <_CreateAarInputs Include="@(EmbeddedJar)" /> <_CreateAarInputs Include="@(EmbeddedNativeLibrary)" /> diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs index 6db2b443177..718f4df238f 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/CodeBehindTests.cs @@ -155,7 +155,7 @@ static CodeBehindTests () CommonSampleLibraryRootDirectory = Path.GetFullPath (Path.Combine (XABuildPaths.TopDirectory, "tests", "CodeBehind", CommonSampleLibraryName)); TestOutputDir = Path.Combine (XABuildPaths.TestOutputDirectory, "temp", "CodeBehind"); if (Builder.UseDotNet) { - ProjectName += "DotNet"; + ProjectName += ".NET"; } generated_sources = new List { diff --git a/src/Xamarin.Android.NUnitLite/Properties/AssemblyInfo.cs b/src/Xamarin.Android.NUnitLite/Properties/AssemblyInfo.cs deleted file mode 100644 index bdc7ff111e7..00000000000 --- a/src/Xamarin.Android.NUnitLite/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle ("Xamarin.Android.NUnitLite")] -[assembly: AssemblyDescription ("")] -[assembly: AssemblyConfiguration ("")] -[assembly: AssemblyCompany ("")] -[assembly: AssemblyProduct ("")] -[assembly: AssemblyCopyright ("jon")] -[assembly: AssemblyTrademark ("")] -[assembly: AssemblyCulture ("")] -[assembly: AssemblyVersion ("1.0.0.0")] - -// The following attributes are used to specify the signing key for the assembly, -// if desired. See the Mono documentation for more information about signing. - -//[assembly: AssemblyDelaySign(false)] -//[assembly: AssemblyKeyFile("")] - diff --git a/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj new file mode 100644 index 00000000000..907644d6cfa --- /dev/null +++ b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj @@ -0,0 +1,35 @@ + + + + net5.0-android + Library + Xamarin.Android.NUnitLite + true + ..\..\product.snk + false + true + + 1570;1572;1591 + false + + + + + + true + false + ..\..\bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\ + $(DefineConstants);NUNITLITE;CLR_4_0;NET_4_5;__MOBILE__;MONOTOUCH + $(OutputPath)\$(AssemblyName).xml + True + + + + + + + diff --git a/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj index 1ccd1d28f74..627ab800a0f 100644 --- a/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj +++ b/src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.csproj @@ -77,274 +77,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/tests/CodeBehind/BuildTests/CodeBehindBuildTestsDotNet.csproj b/tests/CodeBehind/BuildTests/CodeBehindBuildTests.NET.csproj similarity index 99% rename from tests/CodeBehind/BuildTests/CodeBehindBuildTestsDotNet.csproj rename to tests/CodeBehind/BuildTests/CodeBehindBuildTests.NET.csproj index a36da78a39b..e2cd90323bb 100644 --- a/tests/CodeBehind/BuildTests/CodeBehindBuildTestsDotNet.csproj +++ b/tests/CodeBehind/BuildTests/CodeBehindBuildTests.NET.csproj @@ -60,6 +60,6 @@ - + diff --git a/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibraryDotNet.csproj b/tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.NET.csproj similarity index 100% rename from tests/CodeBehind/CommonSampleLibrary/CommonSampleLibraryDotNet.csproj rename to tests/CodeBehind/CommonSampleLibrary/CommonSampleLibrary.NET.csproj diff --git a/tests/Mono.Android-Tests/.gitignore b/tests/Mono.Android-Tests/.gitignore index a93e887bab1..2cd4b24ba85 100644 --- a/tests/Mono.Android-Tests/.gitignore +++ b/tests/Mono.Android-Tests/.gitignore @@ -1 +1,2 @@ libs +Runtime-Microsoft.Android.Sdk/nuget.config diff --git a/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs b/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs index 0ed7315f60e..4720cf2c6e7 100644 --- a/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs +++ b/tests/Mono.Android-Tests/Android.Runtime/XmlReaderPullParserTest.cs @@ -13,6 +13,7 @@ namespace Android.RuntimeTests { public class XmlReaderPullParserTest { [Test] + [Category ("DotNetIgnore")] // Missing crypto / networking support. public void ToLocalJniHandle () { var p = Application.Context.Resources.GetXml (MyResource.Xml.XmlReaderResourceParser); diff --git a/tests/Mono.Android-Tests/Android.Runtime/XmlReaderResourceParserTest.cs b/tests/Mono.Android-Tests/Android.Runtime/XmlReaderResourceParserTest.cs index 2fc6e740c67..910bc566ef8 100644 --- a/tests/Mono.Android-Tests/Android.Runtime/XmlReaderResourceParserTest.cs +++ b/tests/Mono.Android-Tests/Android.Runtime/XmlReaderResourceParserTest.cs @@ -13,6 +13,7 @@ namespace Android.RuntimeTests { public class XmlReaderResourceParserTest { [Test] + [Category ("DotNetIgnore")] // Missing crypto / networking support. public void ToLocalJniHandle () { var p = Application.Context.Resources.GetXml (MyResource.Xml.XmlReaderResourceParser); diff --git a/tests/Mono.Android-Tests/Directory.Build.targets b/tests/Mono.Android-Tests/Directory.Build.targets index 8b63b11a5a1..6e013fc04aa 100644 --- a/tests/Mono.Android-Tests/Directory.Build.targets +++ b/tests/Mono.Android-Tests/Directory.Build.targets @@ -16,7 +16,7 @@ @@ -33,4 +33,40 @@ DependsOnTargets="_CreateJavaInteropDllConfigs"> + + + $(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\ + $(MSBuildThisFileDirectory)Runtime-Microsoft.Android.Sdk\ + $([MSBuild]::EnsureTrailingSlash($(AndroidNETTestConfigOutputDir))) + + + + + + + + + +]]> + + + + + + + + + <_RuntimeTestArgs Include="-p:Configuration=$(Configuration)" /> + <_RuntimeTestArgs Include="-t:AcquireAndroidTarget,SignAndroidPackage,DeployTestApks,RunTestApks,UndeployTestApks,RenameApkTestCases,ReportComponentFailures" /> + <_RuntimeTestArgs Include="-bl:$(XamarinAndroidSourcePath)bin\Test$(Configuration)\run-Mono.Android.NET-Tests.binlog" /> + + + + diff --git a/tests/Mono.Android-Tests/Java.Interop-Tests/Java.Interop-Tests.NET.csproj b/tests/Mono.Android-Tests/Java.Interop-Tests/Java.Interop-Tests.NET.csproj new file mode 100644 index 00000000000..c876e02b24b --- /dev/null +++ b/tests/Mono.Android-Tests/Java.Interop-Tests/Java.Interop-Tests.NET.csproj @@ -0,0 +1,53 @@ + + + + + + net5.0-android + Java.Interop_Tests + Java.Interop-Tests + Library + Properties + Off + true + true + ..\..\..\product.snk + $(DefineConstants);NO_MARSHAL_MEMBER_BUILDER_SUPPORT + + + + + + + + + + + + + + + + + + + + + + + + BuildTestJarFile; + _CopyTestJarFiles; + $(BuildDependsOn) + + + + + + CleanTestJarFile; + $(CleanDependsOn); + CleanLocal; + + + + diff --git a/tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs b/tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs index 11ac6e04b18..2263538a0b4 100644 --- a/tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs +++ b/tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs @@ -219,6 +219,7 @@ public void SetField_PermitNullValues () } [Test] + [Category ("DotNetIgnore")] // https://github.com/xamarin/xamarin-android/issues/5265 public void CreateTypeWithExportedMethods () { using (var e = new ContainsExportedMethods ()) { @@ -453,7 +454,9 @@ public ContainsExportedMethods () Constructed = true; } +#if !NET // https://github.com/xamarin/xamarin-android/issues/5265 [Export] +#endif public void Exported () { Count++; diff --git a/tests/Mono.Android-Tests/Mono.Android-Test.Library/Mono.Android-Test.Library.NET.csproj b/tests/Mono.Android-Tests/Mono.Android-Test.Library/Mono.Android-Test.Library.NET.csproj new file mode 100644 index 00000000000..a09667a4be9 --- /dev/null +++ b/tests/Mono.Android-Tests/Mono.Android-Test.Library/Mono.Android-Test.Library.NET.csproj @@ -0,0 +1,22 @@ + + + + net5.0-android + Xamarin.Android.RuntimeTests + Library + Properties + Mono.Android_Test.Library + 512 + Off + + + + + Assets\linked_text2.txt + + + Assets\LibAssetSubFolder\folder.png + + + + diff --git a/tests/Mono.Android-Tests/Mono.Android-Test.Shared.projitems b/tests/Mono.Android-Tests/Mono.Android-Test.Shared.projitems index 53c55e115ce..629f598b4d6 100644 --- a/tests/Mono.Android-Tests/Mono.Android-Test.Shared.projitems +++ b/tests/Mono.Android-Tests/Mono.Android-Test.Shared.projitems @@ -127,11 +127,19 @@ - + + + + + + + + + \ No newline at end of file diff --git a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj new file mode 100644 index 00000000000..78994a6deec --- /dev/null +++ b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj @@ -0,0 +1,51 @@ + + + + + + + net5.0-android + Xamarin.Android.RuntimeTests + Exe + true + $(XamarinAndroidSourcePath)product.snk + d8 + <_SkipJniAddNativeMethodRegistrationAttributeScan>True + true + $(XamarinAndroidSourcePath)bin\Test$(Configuration) + false + false + false + false + <_MonoAndroidTestPackage>Mono.Android.NET_Tests + + DotNetIgnore:InetAccess + + + + r8 + + + + + + + + + + + + $(_MonoAndroidTestPackage) + xamarin.android.runtimetests.NUnitInstrumentation + $(XamarinAndroidSourcePath)TestResult-$(_MonoAndroidTestPackage).xml + $(XamarinAndroidSourcePath)build-tools\scripts\TimingDefinitions.txt + $(XamarinAndroidSourcePath)TestResult-$(_MonoAndroidTestPackage)-times.csv + apk-sizes-$(_MonoAndroidTestPackage)-$(Configuration)$(TestsFlavor).txt + $(XamarinAndroidSourcePath)build-tools\scripts\ApkSizesDefinitions.txt + $(XamarinAndroidSourcePath)TestResult-$(_MonoAndroidTestPackage)-values-$(Configuration).csv + + + + + + diff --git a/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Properties/AndroidManifest.xml b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Properties/AndroidManifest.xml new file mode 100644 index 00000000000..7ef0c18d3a7 --- /dev/null +++ b/tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Properties/AndroidManifest.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/Mono.Android-Tests/System.Drawing/TypeConverterTest.cs b/tests/Mono.Android-Tests/System.Drawing/TypeConverterTest.cs index 18c164a3d6d..a7d6a12450f 100644 --- a/tests/Mono.Android-Tests/System.Drawing/TypeConverterTest.cs +++ b/tests/Mono.Android-Tests/System.Drawing/TypeConverterTest.cs @@ -7,6 +7,7 @@ namespace System.Drawing { [TestFixture] + [NUnit.Framework.Category ("DotNetIgnore")] // https://github.com/xamarin/xamarin-android/issues/5275 public class TypeConverterTest { [Test] diff --git a/tests/Mono.Android-Tests/System.Net/NetworkInterfaces.cs b/tests/Mono.Android-Tests/System.Net/NetworkInterfaces.cs index cb0c1eecb49..d850ceae07d 100644 --- a/tests/Mono.Android-Tests/System.Net/NetworkInterfaces.cs +++ b/tests/Mono.Android-Tests/System.Net/NetworkInterfaces.cs @@ -101,6 +101,7 @@ bool HardwareAddressesAreEqual (byte[] one, byte[] two) } [Test, Category("NetworkInterfaces")] + [Category ("DotNetIgnore")] // https://github.com/dotnet/runtime/issues/35836 public void DotNetInterfacesShouldEqualJavaInterfaces () { List dotnetInterfaces = GetInfos (MNetworkInterface.GetAllNetworkInterfaces ()); diff --git a/tests/Mono.Android-Tests/System/AppDomainTest.cs b/tests/Mono.Android-Tests/System/AppDomainTest.cs index 2a58916dab5..362804634d1 100644 --- a/tests/Mono.Android-Tests/System/AppDomainTest.cs +++ b/tests/Mono.Android-Tests/System/AppDomainTest.cs @@ -14,6 +14,7 @@ public class AppDomainTest { [Test] [Category ("HybridAotNotWorking")] // See https://github.com/xamarin/xamarin-android/issues/1536 + [Category ("DotNetIgnore")] // System.PlatformNotSupportedException : Secondary AppDomains are not supported on this platform. public void DateTime_Now_Works () { new Boom().Bang(); diff --git a/tests/Mono.Android-Tests/System/TimeZoneTest.cs b/tests/Mono.Android-Tests/System/TimeZoneTest.cs index 2e9e8b90f49..8a38ef56a99 100644 --- a/tests/Mono.Android-Tests/System/TimeZoneTest.cs +++ b/tests/Mono.Android-Tests/System/TimeZoneTest.cs @@ -12,6 +12,7 @@ namespace Xamarin.Android.RuntimeTests public class TimeZoneTest { [Test] + [Category ("DotNetIgnore")] // https://github.com/dotnet/runtime/issues/44358 public void TestDaylightSavingsTime () { using (var jtz = Java.Util.TimeZone.Default) { diff --git a/tests/TestRunner.Core/TestRunner.Core.NET.csproj b/tests/TestRunner.Core/TestRunner.Core.NET.csproj new file mode 100644 index 00000000000..c5c9925ac76 --- /dev/null +++ b/tests/TestRunner.Core/TestRunner.Core.NET.csproj @@ -0,0 +1,10 @@ + + + + net5.0-android + Library + Xamarin.Android.UnitTests + false + + + diff --git a/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj b/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj new file mode 100644 index 00000000000..e3eff105ef2 --- /dev/null +++ b/tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj @@ -0,0 +1,15 @@ + + + + net5.0-android + Library + Xamarin.Android.UnitTests.NUnit + TestRunner.NUnit.NET + false + + + + + + +