From a957342aff3625a7be8a2c4c69814165d2805a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 29 Apr 2021 16:39:14 +0200 Subject: [PATCH] Enable libraries testing (#900) --- .../runtimelab-post-build-steps.yml | 5 + eng/testing/default.rd.xml | 81 +++ eng/testing/tests.singlefile.targets | 21 +- eng/testing/tests.targets | 8 +- .../Microsoft.NETCore.Native.targets | 8 +- .../TestUtilities/System/PlatformDetection.cs | 4 +- src/libraries/Directory.Build.props | 2 + .../tests/System.Collections.Tests.csproj | 3 + .../System.Collections/tests/default.rd.xml | 154 ++++++ .../tests/Directory/Exists.cs | 1 + .../System.IO.FileSystem/tests/File/Exists.cs | 1 + .../tests/System.Runtime.Tests.csproj | 3 + .../tests/System/Reflection/ModuleTests.cs | 2 + .../System/Reflection/ReflectionCacheTests.cs | 4 +- .../System.Runtime/tests/default.rd.xml | 505 ++++++++++++++++++ src/libraries/externals.csproj | 36 +- src/libraries/tests.proj | 11 +- 17 files changed, 839 insertions(+), 10 deletions(-) create mode 100644 eng/testing/default.rd.xml create mode 100644 src/libraries/System.Collections/tests/default.rd.xml create mode 100644 src/libraries/System.Runtime/tests/default.rd.xml diff --git a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml index c7e98e32bc70..8f7b3ef38071 100644 --- a/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml +++ b/eng/pipelines/runtimelab/runtimelab-post-build-steps.yml @@ -13,6 +13,11 @@ parameters: steps: - ${{ if ne(parameters.archType, 'arm64') }}: + + - ${{ if eq(parameters.buildConfig, 'Release') }}: + - script: $(Build.SourcesDirectory)/build$(scriptExt) libs.tests -c Release -test + displayName: Build and run libraries tests + # Build coreclr native test output - ${{ if eq(parameters.osGroup, 'windows') }}: - script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) nativeaot $(buildConfigUpper) ${{ parameters.archType }} /p:NativeAotMultimodule=true /p:SmokeTestsOnly=${{ parameters.smokeTestsOnly }} diff --git a/eng/testing/default.rd.xml b/eng/testing/default.rd.xml new file mode 100644 index 000000000000..c0aaef61d251 --- /dev/null +++ b/eng/testing/default.rd.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets index 85ee6deb32db..f91516c32056 100644 --- a/eng/testing/tests.singlefile.targets +++ b/eng/testing/tests.singlefile.targets @@ -12,7 +12,7 @@ chmod +rwx $(AssemblyName) && ./$(AssemblyName) - + true true true @@ -20,6 +20,25 @@ $(SingleFileHostSourcePath).exe + + $(TestNativeAotCompilerRootPath) + $(TargetArchitecture) + true + $(NoWarn);IL9700;IL9701;IL1005 + + + + + + + + + + + + + + diff --git a/eng/testing/tests.targets b/eng/testing/tests.targets index 17cee3f712d6..e395ae302a92 100644 --- a/eng/testing/tests.targets +++ b/eng/testing/tests.targets @@ -20,6 +20,10 @@ $(RunScriptHostDir)dotnet + + true + + PrepareForRun @@ -103,10 +107,12 @@ + + IgnoreStandardErrorWarningFormat="true" + EnvironmentVariables="HELIX_WORKITEM_PAYLOAD=;"> diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 85cdcaeeae69..05528855e389 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -338,7 +338,13 @@ The .NET Foundation licenses this file to you under the MIT license. - + + + <_IgnoreLinkerWarnings>false + <_IgnoreLinkerWarnings Condition="'$(TargetOS)' == 'OSX'">true + + + diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 8544a948b181..e51600427fd5 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -103,6 +103,8 @@ public static bool IsDrawingSupported public static bool IsInvokingStaticConstructorsSupported => !IsNativeAot; + public static bool IsMetadataUpdateSupported => !IsNativeAot; + // System.Security.Cryptography.Xml.XmlDsigXsltTransform.GetOutput() relies on XslCompiledTransform which relies // heavily on Reflection.Emit public static bool IsXmlDsigXsltTransformSupported => !PlatformDetection.IsInAppContainer; @@ -269,7 +271,7 @@ private static Version GetICUVersion() int version = 0; try { - Type interopGlobalization = Type.GetType("Interop+Globalization"); + Type interopGlobalization = Type.GetType("Interop+Globalization, System.Private.CoreLib"); if (interopGlobalization != null) { MethodInfo methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static); diff --git a/src/libraries/Directory.Build.props b/src/libraries/Directory.Build.props index 724c8c1fbf89..205272590389 100644 --- a/src/libraries/Directory.Build.props +++ b/src/libraries/Directory.Build.props @@ -147,7 +147,9 @@ $(ArtifactsBinDir)pkg\aspnetcoreapp\lib $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(BuildSettings)')) + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testaotc', '$(BuildSettings)')) $([MSBuild]::NormalizeDirectory('$(TestHostRootPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)')) + $([MSBuild]::NormalizeDirectory('$(TestNativeAotCompilerRootPath)', 'framework')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.ref')) $([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref', '$(NetCoreAppCurrent)')) diff --git a/src/libraries/System.Collections/tests/System.Collections.Tests.csproj b/src/libraries/System.Collections/tests/System.Collections.Tests.csproj index 66f5dee8d5ba..d681aafe746b 100644 --- a/src/libraries/System.Collections/tests/System.Collections.Tests.csproj +++ b/src/libraries/System.Collections/tests/System.Collections.Tests.csproj @@ -4,6 +4,9 @@ true true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs b/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs index 44d07e2c7749..262b15241f5e 100644 --- a/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs +++ b/src/libraries/System.IO.FileSystem/tests/Directory/Exists.cs @@ -300,6 +300,7 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component) Assert.False(Exists(component)); } + [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901" /* NativeAot */)] [Theory, MemberData(nameof(UncPathsWithoutShareName))] public void UncPathWithoutShareNameAsPath_ReturnsFalse(string component) diff --git a/src/libraries/System.IO.FileSystem/tests/File/Exists.cs b/src/libraries/System.IO.FileSystem/tests/File/Exists.cs index 225ed8e04e89..f55f893a06b7 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/Exists.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/Exists.cs @@ -231,6 +231,7 @@ public void PathWithReservedDeviceNameAsPath_ReturnsFalse(string component) Assert.False(Exists(component)); } + [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901" /* NativeAot */)] [Theory, MemberData(nameof(UncPathsWithoutShareName))] public void UncPathWithoutShareNameAsPath_ReturnsFalse(string component) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj index 4d8c8213f274..89bd516a70ad 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests.csproj @@ -7,6 +7,9 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser disable + + + diff --git a/src/libraries/System.Runtime/tests/System/Reflection/ModuleTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/ModuleTests.cs index 49554f51f422..dd34f88e57ab 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/ModuleTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/ModuleTests.cs @@ -270,6 +270,7 @@ public void ResolveTypeFail(int token) public static IEnumerable Methods => typeof(ModuleTests).GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly).Select(m => new object[] { m }); + [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901" /* NativeAot */)] [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsMetadataTokenSupported))] [MemberData(nameof(Methods))] public void ResolveMethod(MethodInfo t) @@ -299,6 +300,7 @@ public void ResolveMethodFail(int token) public static IEnumerable Fields => typeof(ModuleTests).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly).Select(f => new object[] { f }); + [ActiveIssue("https://github.com/dotnet/runtimelab/issues/901" /* NativeAot */)] [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsMetadataTokenSupported))] [MemberData(nameof(Fields))] public void ResolveField(FieldInfo t) diff --git a/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs index 4136b2e1d2d5..8519247b601d 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/ReflectionCacheTests.cs @@ -22,7 +22,7 @@ public void GetMethod_MultipleCalls_SameObjects() } [ActiveIssue("https://github.com/dotnet/runtime/issues/50978", TestRuntimes.Mono)] - [Fact] + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsMetadataUpdateSupported))] public void InvokeBeforeUpdate_NoExceptions() { Action beforeUpdate = GetBeforeUpdateMethod(); @@ -33,7 +33,7 @@ public void InvokeBeforeUpdate_NoExceptions() } [ActiveIssue("https://github.com/dotnet/runtime/issues/50978", TestRuntimes.Mono)] - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsMetadataUpdateSupported))] [InlineData(false)] [InlineData(true)] public void GetMethod_MultipleCalls_ClearCache_DifferentObjects(bool justSpecificType) diff --git a/src/libraries/System.Runtime/tests/default.rd.xml b/src/libraries/System.Runtime/tests/default.rd.xml new file mode 100644 index 000000000000..72b0a4a60950 --- /dev/null +++ b/src/libraries/System.Runtime/tests/default.rd.xml @@ -0,0 +1,505 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/externals.csproj b/src/libraries/externals.csproj index bba05ff545da..ab1e7e4400dc 100644 --- a/src/libraries/externals.csproj +++ b/src/libraries/externals.csproj @@ -2,7 +2,7 @@ $(PackageRID) - true + true $(NetCoreAppCurrent) false @@ -26,7 +26,8 @@ + AfterTargets="AfterResolveReferences" + Condition="'$(ClrNativeAot)' != 'true'"> true @@ -61,7 +62,7 @@ + Condition="'$(RuntimeFlavor)' != 'Mono' and '$(ClrNativeAot)' != 'true'"> @@ -77,6 +78,35 @@ + + + <_CompilerFiles Include="$(CoreCLRILCompilerDir)*" /> + <_AotSdkFiles Include="$(CoreCLRAotSdkDir)*" /> + <_BuildIntegrationFiles Include="$(CoreCLRBuildIntegrationDir)*" /> + <_TaskFiles Include="$(CoreCLRILCompilerDir)netstandard\*" /> + + + + + + + + - + + + + + + + + + +