From: Jeremy Barton Date: Fri, 10 Jul 2020 21:28:58 +0000 (-0700) Subject: Fix precondition on OSX 10.15 mutable store tests X-Git-Tag: submit/tizen/20210909.063632~6782 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22cf375e729de22f6ac69849a400e479cd601275;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix precondition on OSX 10.15 mutable store tests --- diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreMutableTests.OSX.cs b/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreMutableTests.OSX.cs index 227e409..422c71a 100644 --- a/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreMutableTests.OSX.cs +++ b/src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreMutableTests.OSX.cs @@ -21,17 +21,25 @@ namespace System.Security.Cryptography.X509Certificates.Tests { const int errSecWrPerm = -61; const int errSecInteractionNotAllowed = -25308; + const int kPOSIXErrorBase = 100000; - if (e.HResult == errSecInteractionNotAllowed) + switch (e.HResult) { - Console.WriteLine("Run 'security unlock-keychain' to make tests runable."); - return false; + case errSecInteractionNotAllowed: + Console.WriteLine("Run 'security unlock-keychain' to make tests runable."); + return false; + case kPOSIXErrorBase: + // kPOSIXErrorBase is returned for "unknown error from a subsystem", + // which seems to happen on writes from SSH sessions even if the keychain + // was unlocked. + Console.WriteLine("Writing precondition failed with kPOSIXErrorBase, skipping tests."); + return false; + case errSecWrPerm: + Console.WriteLine("Writing precondition failed with permission denied, skipping tests."); + return false; } - if (e.HResult == errSecWrPerm) - { - return false; - } + Console.WriteLine($"Precondition test failed with unknown code {e.HResult}, running anyways."); } catch {