From: Julius Hardt Date: Sun, 23 Sep 2018 20:32:59 +0000 (+0200) Subject: Disable EncryptDecrypt_Read() test on the Home editions of Windows (dotnet/corefx... X-Git-Tag: submit/tizen/20210909.063632~11031^2~3485 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab0741356349170cfd3198a4614ad8e22068a799;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Disable EncryptDecrypt_Read() test on the Home editions of Windows (dotnet/corefx#32342) * Disable System.IO.Tests.EncryptDecrypt.EncryptDecrypt_Read() on the Home editions of Windows * Add a comment explaining why we skip the test on home editions Commit migrated from https://github.com/dotnet/corefx/commit/4f7690ad97ea1772433fcfeafc4b0c26f0fb80a2 --- diff --git a/src/libraries/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs b/src/libraries/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs index ab4b742..28114ba 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs +++ b/src/libraries/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs @@ -72,6 +72,7 @@ namespace System public static bool IsNotNetNativeRunningAsConsoleApp { get { throw null; } } public static bool IsNotOneCoreUAP { get { throw null; } } public static bool IsNotWindows8x { get { throw null; } } + public static bool IsNotWindowsHomeEdition { get { throw null; } } public static bool IsNotWindowsIoTCore { get { throw null; } } public static bool IsNotWindowsNanoServer { get { throw null; } } public static bool IsNotWindowsServerCore { get { throw null; } } @@ -105,6 +106,7 @@ namespace System public static bool IsWindows7 { get { throw null; } } public static bool IsWindows8x { get { throw null; } } public static bool IsWindowsAndElevated { get { throw null; } } + public static bool IsWindowsHomeEdition { get { throw null; } } public static bool IsWindowsIoTCore { get { throw null; } } public static bool IsWindowsNanoServer { get { throw null; } } public static bool IsWindowsServerCore { get { throw null; } } diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs index a7f8b2a..db8abe1 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs +++ b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs @@ -14,6 +14,7 @@ namespace System public static partial class PlatformDetection { public static bool IsWindowsIoTCore => false; + public static bool IsWindowsHomeEdition => false; public static bool IsWindows => false; public static bool IsWindows7 => false; public static bool IsWindows8x => false; diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs index 1c0f8b6..7d9bcbc 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs +++ b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs @@ -70,6 +70,28 @@ namespace System } } + public static bool IsWindowsHomeEdition + { + get + { + int productType = GetWindowsProductType(); + switch (productType) + { + case PRODUCT_CORE: + case PRODUCT_CORE_COUNTRYSPECIFIC: + case PRODUCT_CORE_N: + case PRODUCT_CORE_SINGLELANGUAGE: + case PRODUCT_HOME_BASIC: + case PRODUCT_HOME_BASIC_N: + case PRODUCT_HOME_PREMIUM: + case PRODUCT_HOME_PREMIUM_N: + return true; + default: + return false; + } + } + } + public static bool IsWindows => true; public static bool IsWindows7 => GetWindowsVersion() == 6 && GetWindowsMinorVersion() == 1; public static bool IsWindows8x => GetWindowsVersion() == 6 && (GetWindowsMinorVersion() == 2 || GetWindowsMinorVersion() == 3); @@ -228,6 +250,14 @@ namespace System private const int PRODUCT_IOTUAP = 0x0000007B; private const int PRODUCT_IOTUAPCOMMERCIAL = 0x00000083; + private const int PRODUCT_CORE = 0x00000065; + private const int PRODUCT_CORE_COUNTRYSPECIFIC = 0x00000063; + private const int PRODUCT_CORE_N = 0x00000062; + private const int PRODUCT_CORE_SINGLELANGUAGE = 0x00000064; + private const int PRODUCT_HOME_BASIC = 0x00000002; + private const int PRODUCT_HOME_BASIC_N = 0x00000005; + private const int PRODUCT_HOME_PREMIUM = 0x00000003; + private const int PRODUCT_HOME_PREMIUM_N = 0x0000001A; [DllImport("kernel32.dll", SetLastError = false)] private static extern bool GetProductInfo( diff --git a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs index 563f1d7..ca04c1c 100644 --- a/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs +++ b/src/libraries/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs @@ -31,6 +31,7 @@ namespace System public static bool IsNotWindowsNanoServer => !IsWindowsNanoServer; public static bool IsNotWindowsServerCore => !IsWindowsServerCore; public static bool IsNotWindowsIoTCore => !IsWindowsIoTCore; + public static bool IsNotWindowsHomeEdition => !IsWindowsHomeEdition; public static bool IsDrawingSupported => (IsNotWindowsNanoServer && IsNotWindowsIoTCore); public static bool IsArmProcess => RuntimeInformation.ProcessArchitecture == Architecture.Arm; public static bool IsNotArmProcess => !IsArmProcess; diff --git a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs index 4e5a5c1..4ce660f 100644 --- a/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs +++ b/src/libraries/System.IO.FileSystem/tests/File/EncryptDecrypt.cs @@ -32,7 +32,9 @@ namespace System.IO.Tests Assert.Throws(() => File.Decrypt(null)); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer))] + // On Windows Nano Server and Home Edition, file encryption with File.Encrypt(string path) throws an IOException + // because EFS (Encrypted File System), its underlying technology, is not available on these operating systems. + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoServer), nameof(PlatformDetection.IsNotWindowsHomeEdition))] [SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "File encryption is not supported on this platform.")] [PlatformSpecific(TestPlatforms.Windows)] public static void EncryptDecrypt_Read()