[libraries][iOS][tvOS] Skip RoundtripEmptyArray on older tvOS iOS ver… (#56583)
authorMitchell Hwang <16830051+mdh1418@users.noreply.github.com>
Fri, 30 Jul 2021 20:16:35 +0000 (16:16 -0400)
committerGitHub <noreply@github.com>
Fri, 30 Jul 2021 20:16:35 +0000 (16:16 -0400)
* [libraries][iOS][tvOS] Skip RoundtripEmptyArray on older tvOS iOS versions

* Address feedback

* Use OperatingSystem API directly

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.cs

index 80fbbac..85fb5c7 100644 (file)
@@ -2,6 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using Test.Cryptography;
+using Microsoft.DotNet.XUnitExtensions;
 using Xunit;
 
 namespace System.Security.Cryptography.Rsa.Tests
@@ -336,11 +337,19 @@ namespace System.Security.Cryptography.Rsa.Tests
             Assert.Equal(TestData.HelloBytes, output);
         }
 
-        [Fact]
+        [ConditionalFact]
         [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
-        [ActiveIssue("https://github.com/dotnet/runtime/issues/52199", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
         public void RoundtripEmptyArray()
         {
+            if (OperatingSystem.IsIOS() && !OperatingSystem.IsIOSVersionAtLeast(13, 6))
+            {
+                throw new SkipTestException("iOS prior to 13.6 does not reliably support RSA encryption of empty data.");
+            }
+            if (OperatingSystem.IsTvOS() && !OperatingSystem.IsTvOSVersionAtLeast(14, 0))
+            {
+                throw new SkipTestException("tvOS prior to 14.0 does not reliably support RSA encryption of empty data.");
+            }
+
             using (RSA rsa = RSAFactory.Create(TestData.RSA2048Params))
             {
                 void RoundtripEmpty(RSAEncryptionPadding paddingMode)