From 321590b7254469effb33433533931cb3f52b2899 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Tue, 11 Apr 2023 14:29:53 -0500 Subject: [PATCH] Port 'JcwGen-Tests' to .NET. --- build-tools/automation/azure-pipelines.yaml | 19 +++ .../BindingTests.cs | 6 + .../Properties/AssemblyInfo.cs | 28 ---- .../Transforms/metadata.xml | 17 ++ .../Xamarin.Android.JcwGen-Tests.csproj | 150 +++++++----------- .../Xamarin.Android.JcwGen-Tests.projitems | 29 ---- .../Xamarin.Android.JcwGen-Tests.targets | 22 --- 7 files changed, 96 insertions(+), 175 deletions(-) delete mode 100644 tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Properties/AssemblyInfo.cs create mode 100644 tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Transforms/metadata.xml delete mode 100644 tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.projitems delete mode 100644 tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.targets diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 9f6fb2286c5..5ba262febd9 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -204,7 +204,26 @@ stages: extraBuildArgs: -p:TestsFlavor=AotLlvm -p:EnableLLVM=true -p:AndroidEnableProfiledAot=false artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab artifactFolder: $(DotNetTargetFramework)-AotLlvm + + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Android.JcwGen_Tests + project: tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj + testResultsFiles: TestResult-Xamarin.Android.JcwGen_Tests-$(XA.Build.Configuration).xml + artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.JcwGen_Tests-Signed.apk + artifactFolder: $(DotNetTargetFramework)-Default + - template: yaml-templates/apk-instrumentation.yaml + parameters: + configuration: $(XA.Build.Configuration) + testName: Xamarin.Android.JcwGen_Tests_FastDev + project: tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj + testResultsFiles: TestResult-Xamarin.Android.JcwGen_Tests-$(XA.Build.Configuration).xml + artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.JcwGen_Tests-Signed.apk + artifactFolder: $(DotNetTargetFramework)-FastDev_Assemblies_Dexes + extraBuildArgs: /p:AndroidFastDeploymentType=Assemblies:Dexes + - template: yaml-templates/run-nunit-tests.yaml parameters: testRunTitle: Xamarin.Android.Tools.Aidl-Tests - macOS diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/BindingTests.cs b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/BindingTests.cs index 797191a9429..781402896a0 100644 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/BindingTests.cs +++ b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/BindingTests.cs @@ -20,6 +20,7 @@ public void TestTimingCreateTimingIsCorrectType () Assert.IsTrue (t is Com.Xamarin.Android.Timing); } +#if TODO_7794 [Test] public void TestResourceId () { @@ -37,6 +38,7 @@ public void TestNativeLibDllImportInEmbeddedArchive () { Assert.AreEqual (TestNativeLib.Binding.SampleFunction2 (), 0xf200); } +#endif // TODO_7794 [Test] public void NamespaceTransforms () @@ -178,6 +180,9 @@ public void VirtualMethodBinding () } } +#if TODO_7794 + // This test requires that https://github.com/xamarin/xamarin-android/issues/7794 + // be completed first, as it depends on Xamarin.Android.FixJavaAbstractMethod* projects. [Test] public void JavaAbstractMethodTest () { @@ -202,6 +207,7 @@ public void JavaAbstractMethodTest () if (mi != null && mi.GetMethodBody ().LocalVariables.Count == 0) throw new Exception ("FixAbstractMethodStep broken, MethodWithRT added, while it should not be"); } +#endif // TODO_7794 // Context https://bugzilla.xamarin.com/show_bug.cgi?id=36036 [Test] diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Properties/AssemblyInfo.cs b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 2c8c274cd2b..00000000000 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using Android.App; - -// Information about this assembly is defined by the following attributes. -// Change them to the values specific to your project. - -[assembly: AssemblyTitle("Xamarin.Android.Generation-Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("jon")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". -// The form "{Major}.{Minor}.*" will automatically update the build and revision, -// and "{Major}.{Minor}.{Build}.*" will update just the revision. - -[assembly: AssemblyVersion("1.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/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Transforms/metadata.xml b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Transforms/metadata.xml new file mode 100644 index 00000000000..1a113412fcb --- /dev/null +++ b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Transforms/metadata.xml @@ -0,0 +1,17 @@ + + + Android.Graphics.Color + Android.Graphics.Color + + + fromNode + fromChannel + payloadType + payload + \ No newline at end of file diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj index fd978a0bca4..cb323b8d52d 100644 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj +++ b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj @@ -1,117 +1,75 @@ - - + + - Debug - AnyCPU - 10.0.0 - 2.0 - {9479B71F-19FE-48F9-AB3F-AE764D76038A} - {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Library + $(DotNetAndroidTargetFramework) + 24 + Exe + enable + enable + Xamarin.Android.JcwGen_Tests + 1 + 1.0 Xamarin.Android.JcwGenTests - True - Resources\Resource.designer.cs - Resource - Resources - Assets - Xamarin.Android.JcwGen-Tests - Properties\AndroidManifest.xml - armeabi-v7a;x86 + + - $(AndroidFrameworkVersion) + ..\..\..\bin\Test$(Configuration) - - true - false - ..\..\..\bin\TestDebug - DEBUG; - prompt - 4 - None - false - true - - - true - ..\..\..\bin\TestRelease - prompt - 4 - false - true - - - - - - - - + - - - - - - - - - - + + + + + + - + + - - - + + - + + - - + - - BuildNativeLibs; - $(BuildDependsOn) - + <_PackageName>$(ApplicationId) - - - - - - - - - $(CleanDependsOn); - CleanLocal; - + + + True + - - Jars\Cursor.jar - + + $(ApplicationId) + $(MSBuildThisFileDirectory)..\..\..\build-tools\scripts\TimingDefinitions.txt + $(MSBuildThisFileDirectory)..\..\..\TestResult-Xamarin.Android.JcwGen_Tests-times.csv + + - - {7B9D9F32-973F-49CF-A8F8-05BDFC75556C} - Xamarin.Android.FixJavaAbstractMethod-APIv2Binding - - - {B7476528-C166-40BF-931F-EAEB02247879} - Xamarin.Android.FixJavaAbstractMethod-Library - - - {9553ED9D-92EA-411B-ADFF-21C5608CCD16} - Xamarin.Android.LibraryProjectZip-LibBinding - - - {EF798EB3-D639-4E09-9DB0-233E67F727B0} - Xamarin.Android.McwGen-Tests - + + $(ApplicationId) + $(OutputPath)TestResult-Xamarin.Android.JcwGen_Tests.xml + + + + $(ApplicationId) + + + + $(ApplicationId) + - + + + + \ No newline at end of file diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.projitems b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.projitems deleted file mode 100644 index cdc23f9f212..00000000000 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.projitems +++ /dev/null @@ -1,29 +0,0 @@ - - - - <_PackageName>Xamarin.Android.JcwGen_Tests - - - - - Xamarin.Android.JcwGen_Tests - $(MSBuildThisFileDirectory)..\..\..\build-tools\scripts\TimingDefinitions.txt - $(MSBuildThisFileDirectory)..\..\..\TestResult-Xamarin.Android.JcwGen_Tests-times.csv - - - - - - Xamarin.Android.JcwGen_Tests - $(OutputPath)TestResult-Xamarin.Android.JcwGen_Tests.xml - - - - Xamarin.Android.JcwGen_Tests - - - - Xamarin.Android.JcwGen_Tests - - - diff --git a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.targets b/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.targets deleted file mode 100644 index 958d357096b..00000000000 --- a/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.targets +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - -