Skip to content

Commit

Permalink
Apple Silicon platform detection (#49155)
Browse files Browse the repository at this point in the history
* Add Apple Silicon PlatformDetection

* Disable OSVersion_ValidVersion_OSX on Apple Silicon

* Update docs
  • Loading branch information
sdmaclea authored Mar 4, 2021
1 parent 1806e46 commit e422345
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/workflow/testing/libraries/filtering-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ This attribute returns the 'failing' category, which is disabled by default.
```cs
[ActiveIssue(string issue, TestPlatforms platforms, TargetFrameworkMonikers frameworks)]
```
**Disable using PlatformDetection filter:**
```cs
[ActiveIssue(string issue, typeof(PlatformDetection), nameof(PlatformDetection.{member name}))]
```
Use this attribute over test methods to skip failing tests only on the specific platforms and the specific target frameworks.

#### SkipOnTargetFrameworkAttribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public static partial class PlatformDetection
public static bool IsNotOSX => !IsOSX;
public static bool IsMacOsMojaveOrHigher => IsOSX && Environment.OSVersion.Version >= new Version(10, 14);
public static bool IsMacOsCatalinaOrHigher => IsOSX && Environment.OSVersion.Version >= new Version(10, 15);
public static bool IsMacOsAppleSilicon => IsOSX && IsArm64Process;
public static bool IsNotMacOsAppleSilicon => !IsMacOsAppleSilicon;

// RedHat family covers RedHat and CentOS
public static bool IsRedHatFamily => IsRedHatFamilyAndVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public void OSVersion_ParseVersion(string input, int major, int minor, int build

[Fact]
[PlatformSpecific(TestPlatforms.OSX)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/49106", typeof(PlatformDetection), nameof(PlatformDetection.IsNotMacOsAppleSilicon))]
public void OSVersion_ValidVersion_OSX()
{
Version version = Environment.OSVersion.Version;
Expand Down

0 comments on commit e422345

Please sign in to comment.