From a177aa488859b3ae0712afd07e577217f1891d4a Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 27 Aug 2018 20:03:05 +0200 Subject: [PATCH] Promote tests to netstandard (dotnet/corefx#31966) * Promote tests to netstandard * Disable uap test run * Uncomment constant define, file condition positive * Disable failing uap tests Commit migrated from https://github.com/dotnet/corefx/commit/559d5401e6bb8a487ff499f4beff5bf5d83961a3 --- .../src/System.IO.FileSystem.AccessControl.csproj | 6 +---- .../tests/Configurations.props | 3 +-- .../tests/DirectoryObjectSecurityTests.cs | 1 + ...System.IO.FileSystem.AccessControl.Tests.csproj | 2 +- .../System.IO.Pipelines/tests/Configurations.props | 3 +-- .../tests/System.IO.Pipelines.Tests.csproj | 15 +++++-------- src/libraries/System.Json/src/System.Json.csproj | 1 - .../System.Json/tests/Configurations.props | 2 +- .../System.Json/tests/System.Json.Tests.csproj | 2 +- .../tests/Configurations.props | 2 +- .../tests/System.Numerics.Vectors.Tests.csproj | 8 ++----- .../tests/Configurations.props | 3 +++ .../Decoding/CustomAttributeDecoderTests.cs | 1 + .../Metadata/Decoding/SignatureDecoderTests.cs | 26 ++++++++++++++++------ .../tests/System.Reflection.Metadata.Tests.csproj | 5 +++-- .../tests/Configurations.props | 1 + .../tests/SignedCms/SignedCmsTests.cs | 2 ++ .../tests/SignedCms/SignerInfoTests.cs | 5 ++++- .../System.Security.Cryptography.Pkcs.Tests.csproj | 2 -- .../src/System.Threading.Tasks.Extensions.csproj | 6 +++-- .../tests/Configurations.props | 2 +- .../System.Threading.Tasks.Extensions.Tests.csproj | 5 +---- 22 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj index 24099a7..58a5568 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj @@ -1,14 +1,10 @@ - Windows_NT - net461-Windows_NT-Debug;net461-Windows_NT-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release - - - System.IO.FileSystem.AccessControl {D77FBA6C-1AA6-45A4-93E2-97A370672C53} true true SR.PlatformNotSupported_AccessControl + net461-Windows_NT-Debug;net461-Windows_NT-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/Configurations.props b/src/libraries/System.IO.FileSystem.AccessControl/tests/Configurations.props index ff3e1ce..249c8c1 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/Configurations.props +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/Configurations.props @@ -2,8 +2,7 @@ - netfx-Windows_NT; - netcoreapp-Windows_NT; + netstandard-Windows_NT; \ No newline at end of file diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/DirectoryObjectSecurityTests.cs b/src/libraries/System.IO.FileSystem.AccessControl/tests/DirectoryObjectSecurityTests.cs index 28b6bdc..ae38f85 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/DirectoryObjectSecurityTests.cs +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/DirectoryObjectSecurityTests.cs @@ -45,6 +45,7 @@ namespace System.Security.AccessControl [Fact] [ActiveIssue(24903, TargetFrameworkMonikers.NetFramework)] + [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "System.DirectoryServices is not supported on this platform.")] public void GetAccessRules_InvalidTargetType() { var activeDirectorySecurity = new ActiveDirectorySecurity(); diff --git a/src/libraries/System.IO.FileSystem.AccessControl/tests/System.IO.FileSystem.AccessControl.Tests.csproj b/src/libraries/System.IO.FileSystem.AccessControl/tests/System.IO.FileSystem.AccessControl.Tests.csproj index 4a9f61c..47266fb 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/tests/System.IO.FileSystem.AccessControl.Tests.csproj +++ b/src/libraries/System.IO.FileSystem.AccessControl/tests/System.IO.FileSystem.AccessControl.Tests.csproj @@ -1,7 +1,7 @@ {5915DD11-5D57-45A9-BFB0-56FEB7741E1F} - netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release + netstandard-Windows_NT-Debug;netstandard-Windows_NT-Release diff --git a/src/libraries/System.IO.Pipelines/tests/Configurations.props b/src/libraries/System.IO.Pipelines/tests/Configurations.props index 91e5be2..b63c2c5 100644 --- a/src/libraries/System.IO.Pipelines/tests/Configurations.props +++ b/src/libraries/System.IO.Pipelines/tests/Configurations.props @@ -3,8 +3,7 @@ netcoreapp; - netfx-Windows_NT; - uap-Windows_NT; + netstandard; diff --git a/src/libraries/System.IO.Pipelines/tests/System.IO.Pipelines.Tests.csproj b/src/libraries/System.IO.Pipelines/tests/System.IO.Pipelines.Tests.csproj index e7fb14d..694f43e 100644 --- a/src/libraries/System.IO.Pipelines/tests/System.IO.Pipelines.Tests.csproj +++ b/src/libraries/System.IO.Pipelines/tests/System.IO.Pipelines.Tests.csproj @@ -2,9 +2,14 @@ {9E984EB2-827E-4029-9647-FB5F8B67C553} true - netcoreapp-Debug;netcoreapp-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release + netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release + + + + + @@ -23,12 +28,4 @@ - - - - - - - - \ No newline at end of file diff --git a/src/libraries/System.Json/src/System.Json.csproj b/src/libraries/System.Json/src/System.Json.csproj index ae958e9..8e30796 100644 --- a/src/libraries/System.Json/src/System.Json.csproj +++ b/src/libraries/System.Json/src/System.Json.csproj @@ -7,7 +7,6 @@ SilverlightExtension netstandard-Debug;netstandard-Release;netstandard1.0-Debug;netstandard1.0-Release - diff --git a/src/libraries/System.Json/tests/Configurations.props b/src/libraries/System.Json/tests/Configurations.props index 2845c11..c398e42 100644 --- a/src/libraries/System.Json/tests/Configurations.props +++ b/src/libraries/System.Json/tests/Configurations.props @@ -2,7 +2,7 @@ - netcoreapp; + netstandard; \ No newline at end of file diff --git a/src/libraries/System.Json/tests/System.Json.Tests.csproj b/src/libraries/System.Json/tests/System.Json.Tests.csproj index 4aa9b67..0a35ca1 100644 --- a/src/libraries/System.Json/tests/System.Json.Tests.csproj +++ b/src/libraries/System.Json/tests/System.Json.Tests.csproj @@ -2,7 +2,7 @@ {DC683D60-34EC-4D85-B6E0-E97FDB37A583} true - netcoreapp-Debug;netcoreapp-Release + netstandard-Debug;netstandard-Release diff --git a/src/libraries/System.Numerics.Vectors/tests/Configurations.props b/src/libraries/System.Numerics.Vectors/tests/Configurations.props index 192309f..64aed1a 100644 --- a/src/libraries/System.Numerics.Vectors/tests/Configurations.props +++ b/src/libraries/System.Numerics.Vectors/tests/Configurations.props @@ -3,7 +3,7 @@ netcoreapp; - netfx; + netstandard; uap; diff --git a/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj b/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj index f6a44b1..b04c2a4 100644 --- a/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj +++ b/src/libraries/System.Numerics.Vectors/tests/System.Numerics.Vectors.Tests.csproj @@ -2,7 +2,7 @@ {99E1E564-0EF4-4E33-BECE-8ABE64771349} true - netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;uap-Debug;uap-Release + netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;uap-Debug;uap-Release @@ -24,7 +24,7 @@ - + System\MathF.netstandard.cs @@ -49,10 +49,6 @@ GenericVectorTests.cs - - - - TextTemplatingFileGenerator diff --git a/src/libraries/System.Reflection.Metadata/tests/Configurations.props b/src/libraries/System.Reflection.Metadata/tests/Configurations.props index 2845c11..dd9ac06 100644 --- a/src/libraries/System.Reflection.Metadata/tests/Configurations.props +++ b/src/libraries/System.Reflection.Metadata/tests/Configurations.props @@ -1,8 +1,11 @@  + netcoreapp; + netfx; + \ No newline at end of file diff --git a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs index 6ebf9fb..a7bf89e 100644 --- a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/CustomAttributeDecoderTests.cs @@ -13,6 +13,7 @@ namespace System.Reflection.Metadata.Decoding.Tests public class CustomAttributeDecoderTests { [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Type assembly name is different on full framework.")] public void TestCustomAttributeDecoder() { using (FileStream stream = File.OpenRead(typeof(HasAttributes).GetTypeInfo().Assembly.Location)) diff --git a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs index 92d5442..62602fb 100644 --- a/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs @@ -15,6 +15,19 @@ namespace System.Reflection.Metadata.Decoding.Tests { public partial class SignatureDecoderTests { + private static readonly string RuntimeAssemblyName = +#if netstandard + "netstandard"; +#else + PlatformDetection.IsFullFramework ? "mscorlib" : "System.Runtime"; +#endif + private static readonly string CollectionsAssemblyName = +#if netstandard + "netstandard"; +#else + PlatformDetection.IsFullFramework ? "mscorlib" : "System.Collections"; +#endif + [Fact] public unsafe void VerifyMultipleOptionalModifiers() { @@ -136,7 +149,6 @@ namespace System.Reflection.Metadata.Decoding.Tests using (FileStream stream = File.OpenRead(typeof(SignaturesToDecode<>).GetTypeInfo().Assembly.Location)) using (var peReader = new PEReader(stream)) { - MetadataReader reader = peReader.GetMetadataReader(); var provider = new DisassemblingTypeProvider(); TypeDefinitionHandle typeHandle = TestMetadataResolver.FindTestType(reader, typeof(SignaturesToDecode<>)); @@ -207,7 +219,7 @@ namespace System.Reflection.Metadata.Decoding.Tests Assert.Equal(expected, provider.GetTypeFromHandle(reader, genericTypeContext, @event.Type)); } - Assert.Equal("[System.Collections]System.Collections.Generic.List`1", provider.GetTypeFromHandle(reader, genericTypeContext, handle: type.BaseType)); + Assert.Equal($"[{CollectionsAssemblyName}]System.Collections.Generic.List`1", provider.GetTypeFromHandle(reader, genericTypeContext, handle: type.BaseType)); } } @@ -322,12 +334,12 @@ namespace System.Reflection.Metadata.Decoding.Tests { "UIntPtr", "native uint" }, { "Boolean", "bool" }, { "Char", "char" }, - { "ModifiedType", "int32 modreq([System.Runtime]System.Runtime.CompilerServices.IsVolatile)" }, + { "ModifiedType", $"int32 modreq([{RuntimeAssemblyName}]System.Runtime.CompilerServices.IsVolatile)" }, { "Pointer", "int32*" }, { "SZArray", "int32[]" }, { "Array", "int32[0...,0...]" }, { "GenericTypeParameter", "!T" }, - { "GenericInstantiation", "[System.Collections]System.Collections.Generic.List`1" }, + { "GenericInstantiation", $"[{CollectionsAssemblyName}]System.Collections.Generic.List`1" }, }; } @@ -340,8 +352,8 @@ namespace System.Reflection.Metadata.Decoding.Tests { "GenericMethodParameter", "method !!U *()" }, { ".ctor", "method void *()" }, { "get_Property", "method System.Reflection.Metadata.Decoding.Tests.SignatureDecoderTests/SignaturesToDecode`1/Nested *()" }, - { "add_Event", "method void *([System.Runtime]System.EventHandler`1<[System.Runtime]System.EventArgs>)" }, - { "remove_Event", "method void *([System.Runtime]System.EventHandler`1<[System.Runtime]System.EventArgs>)" }, + { "add_Event", $"method void *([{RuntimeAssemblyName}]System.EventHandler`1<[{RuntimeAssemblyName}]System.EventArgs>)" }, + { "remove_Event", $"method void *([{RuntimeAssemblyName}]System.EventHandler`1<[{RuntimeAssemblyName}]System.EventArgs>)" }, }; } @@ -359,7 +371,7 @@ namespace System.Reflection.Metadata.Decoding.Tests // event name -> signature return new Dictionary() { - { "Event", "[System.Runtime]System.EventHandler`1<[System.Runtime]System.EventArgs>" }, + { "Event", $"[{RuntimeAssemblyName}]System.EventHandler`1<[{RuntimeAssemblyName}]System.EventArgs>" }, }; } diff --git a/src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj b/src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj index 594abb9..c0e3e99dc 100644 --- a/src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj +++ b/src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj @@ -3,8 +3,9 @@ {7061832A-E8CF-4AB6-A8DC-44D2F5A43A13} true false - System.Reflection.Metadata.Tests - netcoreapp-Debug;netcoreapp-Release + + $(DefineConstants);netstandard + netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/Configurations.props b/src/libraries/System.Security.Cryptography.Pkcs/tests/Configurations.props index bd00aa7..654bd4d 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/Configurations.props +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/Configurations.props @@ -5,6 +5,7 @@ netcoreapp-Windows_NT; netcoreapp; netfx-Windows_NT; + netstandard; diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs index 7877670..7f21700 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs @@ -462,6 +462,7 @@ namespace System.Security.Cryptography.Pkcs.Tests [Theory] [InlineData(SubjectIdentifierType.IssuerAndSerialNumber, false)] [InlineData(SubjectIdentifierType.IssuerAndSerialNumber, true)] + [ActiveIssue(31977, TargetFrameworkMonikers.Uap)] public static void AddFirstSigner_DSA(SubjectIdentifierType identifierType, bool detached) { ContentInfo contentInfo = new ContentInfo(new byte[] { 9, 8, 7, 6, 5 }); @@ -721,6 +722,7 @@ namespace System.Security.Cryptography.Pkcs.Tests [Theory] [InlineData(false)] [InlineData(true)] + [ActiveIssue(31977, TargetFrameworkMonikers.Uap)] public static void EnsureExtraCertsAdded(bool newDocument) { SignedCms cms; diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs index 22ef5e5..8d876fa 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs @@ -344,9 +344,10 @@ namespace System.Security.Cryptography.Pkcs.Tests } [Theory] - [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetFx bug")] [InlineData(0)] [InlineData(1)] + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "NetFx bug")] + [ActiveIssue(31977, TargetFrameworkMonikers.Uap)] public static void RemoveCounterSignature_EncodedInSingleAttribute(int indexToRemove) { SignedCms cms = new SignedCms(); @@ -600,6 +601,7 @@ namespace System.Security.Cryptography.Pkcs.Tests } [Fact] + [ActiveIssue(31977, TargetFrameworkMonikers.Uap)] public static void AddCounterSigner_DSA() { SignedCms cms = new SignedCms(); @@ -730,6 +732,7 @@ namespace System.Security.Cryptography.Pkcs.Tests } [Fact] + [ActiveIssue(31977, TargetFrameworkMonikers.Uap)] public static void EnsureExtraCertsAdded() { SignedCms cms = new SignedCms(); diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj b/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj index b27d222..02dd975 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/System.Security.Cryptography.Pkcs.Tests.csproj @@ -6,8 +6,6 @@ $(DefineConstants);netfx netcoreapp-Debug;netcoreapp-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release - CommonTest\System\Security\Cryptography\ByteUtils.cs diff --git a/src/libraries/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj b/src/libraries/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj index 6fc4779..c77c39a 100644 --- a/src/libraries/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj +++ b/src/libraries/System.Threading.Tasks.Extensions/src/System.Threading.Tasks.Extensions.csproj @@ -3,9 +3,9 @@ {DE90AD0B-649D-4062-B8D9-9658DE140532} $(OutputPath)$(MSBuildProjectName).xml netstandard1.0;portable-net45+win8+wp8+wpa81 - true + true $(DefineConstants);netstandard - true + true netcoreapp-Unix-Debug;netcoreapp-Unix-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;netstandard-Debug;netstandard-Release;netstandard1.0-Debug;netstandard1.0-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release @@ -34,6 +34,8 @@ Common\CoreLib\System\Threading\Tasks\Sources\IValueTaskSource.cs + + diff --git a/src/libraries/System.Threading.Tasks.Extensions/tests/Configurations.props b/src/libraries/System.Threading.Tasks.Extensions/tests/Configurations.props index 7de0087..64aed1a 100644 --- a/src/libraries/System.Threading.Tasks.Extensions/tests/Configurations.props +++ b/src/libraries/System.Threading.Tasks.Extensions/tests/Configurations.props @@ -3,8 +3,8 @@ netcoreapp; + netstandard; uap; - netfx; \ No newline at end of file diff --git a/src/libraries/System.Threading.Tasks.Extensions/tests/System.Threading.Tasks.Extensions.Tests.csproj b/src/libraries/System.Threading.Tasks.Extensions/tests/System.Threading.Tasks.Extensions.Tests.csproj index 06ee2cb..819d5f6 100644 --- a/src/libraries/System.Threading.Tasks.Extensions/tests/System.Threading.Tasks.Extensions.Tests.csproj +++ b/src/libraries/System.Threading.Tasks.Extensions/tests/System.Threading.Tasks.Extensions.Tests.csproj @@ -1,7 +1,7 @@ {275B161B-D525-48A0-B1DE-344273AB9A99} - netcoreapp-Debug;netcoreapp-Release;netfx-Debug;netfx-Release;uap-Debug;uap-Release + netcoreapp-Debug;netcoreapp-Release;netstandard-Debug;netstandard-Release;uap-Debug;uap-Release @@ -15,7 +15,4 @@ Common\System\Threading\Tasks\Sources\ManualResetValueTaskSourceFactory.cs - - - \ No newline at end of file -- 2.7.4