From e30b1ce761f3ee9a7cc5e89b442ce32276e50385 Mon Sep 17 00:00:00 2001 From: Peter Jas Date: Tue, 16 Jun 2015 15:59:20 +0000 Subject: [PATCH 1/3] xplat: Adds FreeBSD support. Refs: dotnet/corefx#2068 PR-URL: #180 --- dir.props | 5 ++-- src/PerfEventsData/Platform.cs | 1 + .../Discoverers/ActiveIssueDiscoverer.cs | 5 ++-- .../Discoverers/PlatformSpecificDiscoverer.cs | 2 ++ .../Interop.PlatformDetection.cs | 24 +++++++++++++------ src/xunit.netcore.extensions/PlatformID.cs | 5 ++-- .../XunitConstants.cs | 3 ++- 7 files changed, 31 insertions(+), 14 deletions(-) diff --git a/dir.props b/dir.props index 878ac70224..88de58d0db 100644 --- a/dir.props +++ b/dir.props @@ -55,11 +55,12 @@ Release $(Configuration) - Windows_NT - Unix + Unix Unix Unix + Windows_NT + Unix $(OS) diff --git a/src/PerfEventsData/Platform.cs b/src/PerfEventsData/Platform.cs index 7d1ab9c2d4..75bd1f39cc 100644 --- a/src/PerfEventsData/Platform.cs +++ b/src/PerfEventsData/Platform.cs @@ -10,6 +10,7 @@ namespace PerfEventsData /// public enum Platform { + FreeBSD, Linux, Mac, Windows diff --git a/src/xunit.netcore.extensions/Discoverers/ActiveIssueDiscoverer.cs b/src/xunit.netcore.extensions/Discoverers/ActiveIssueDiscoverer.cs index 55ea123d92..05edeafe54 100644 --- a/src/xunit.netcore.extensions/Discoverers/ActiveIssueDiscoverer.cs +++ b/src/xunit.netcore.extensions/Discoverers/ActiveIssueDiscoverer.cs @@ -27,9 +27,10 @@ public IEnumerable> GetTraits(IAttributeInfo traitA string issue = ctorArgs.First().ToString(); PlatformID platforms = (PlatformID)ctorArgs.Last(); - if ((platforms.HasFlag(PlatformID.Windows) && Interop.IsWindows) || + if ((platforms.HasFlag(PlatformID.FreeBSD) && Interop.IsFreeBSD) || (platforms.HasFlag(PlatformID.Linux) && Interop.IsLinux) || - (platforms.HasFlag(PlatformID.OSX) && Interop.IsOSX)) + (platforms.HasFlag(PlatformID.OSX) && Interop.IsOSX) || + (platforms.HasFlag(PlatformID.Windows) && Interop.IsWindows)) { yield return new KeyValuePair(XunitConstants.Category, XunitConstants.Failing); yield return new KeyValuePair(XunitConstants.ActiveIssue, issue); diff --git a/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs b/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs index 7183e33705..5cf59bf78d 100644 --- a/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs +++ b/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs @@ -28,6 +28,8 @@ public IEnumerable> GetTraits(IAttributeInfo traitA yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonLinuxTest); if (!platform.HasFlag(PlatformID.OSX)) yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonOSXTest); + if (!platform.HasFlag(PlatformID.FreeBSD)) + yield return new KeyValuePair(XunitConstants.Category, XunitConstants.NonFreeBSDTest); } } } diff --git a/src/xunit.netcore.extensions/Interop.PlatformDetection.cs b/src/xunit.netcore.extensions/Interop.PlatformDetection.cs index 6e173e5008..c37cbf1b70 100644 --- a/src/xunit.netcore.extensions/Interop.PlatformDetection.cs +++ b/src/xunit.netcore.extensions/Interop.PlatformDetection.cs @@ -11,14 +11,15 @@ internal static partial class Interop { internal enum OperatingSystem { - Windows, + FreeBSD, Linux, - OSX + OSX, + Windows } - internal static bool IsWindows + internal static bool IsFreeBSD { - get { return OperatingSystem.Windows == PlatformDetection.OperatingSystem; } + get { return OperatingSystem.FreeBSD == PlatformDetection.OperatingSystem; } } internal static bool IsLinux @@ -31,6 +32,11 @@ internal static bool IsOSX get { return OperatingSystem.OSX == PlatformDetection.OperatingSystem; } } + internal static bool IsWindows + { + get { return OperatingSystem.Windows == PlatformDetection.OperatingSystem; } + } + internal static class PlatformDetection { internal static OperatingSystem OperatingSystem { get { return s_os.Value; } } @@ -44,9 +50,13 @@ internal static class PlatformDetection byte* buffer = stackalloc byte[8192]; // the size use with uname is platform specific; this should be large enough for any OS if (uname(buffer) == 0) { - return Marshal.PtrToStringAnsi((IntPtr)buffer) == "Darwin" ? - OperatingSystem.OSX : - OperatingSystem.Linux; + string os = Marshal.PtrToStringAnsi((IntPtr)buffer); + if (os == "FreeBSD") + return OperatingSystem.FreeBSD; + else if (os == "Darwin") + return OperatingSystem.OSX; + else + return OperatingSystem.Linux; } } } diff --git a/src/xunit.netcore.extensions/PlatformID.cs b/src/xunit.netcore.extensions/PlatformID.cs index 9f4d9bfd5b..5c6c9f9d76 100644 --- a/src/xunit.netcore.extensions/PlatformID.cs +++ b/src/xunit.netcore.extensions/PlatformID.cs @@ -12,7 +12,8 @@ public enum PlatformID Windows = 1, Linux = 2, OSX = 4, - AnyUnix = Linux | OSX, - Any = Windows | Linux | OSX + FreeBSD = 8, + AnyUnix = FreeBSD | Linux | OSX, + Any = ~0 } } diff --git a/src/xunit.netcore.extensions/XunitConstants.cs b/src/xunit.netcore.extensions/XunitConstants.cs index eef93b9dcd..7898ec3fcd 100644 --- a/src/xunit.netcore.extensions/XunitConstants.cs +++ b/src/xunit.netcore.extensions/XunitConstants.cs @@ -8,9 +8,10 @@ namespace Xunit.NetCore.Extensions { internal struct XunitConstants { - public const string NonWindowsTest = "nonwindowstests"; + public const string NonFreeBSDTest = "nonfreebsdtests"; public const string NonLinuxTest = "nonlinuxtests"; public const string NonOSXTest = "nonosxtests"; + public const string NonWindowsTest = "nonwindowstests"; public const string Category = "category"; public const string Failing = "failing"; public const string ActiveIssue = "activeissue"; From cb60931f2f584da941d87609ea742fc604215449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 21 Jun 2015 11:32:15 +0000 Subject: [PATCH 2/3] System.XML -> System.xml --- src/EventTracer/EventTracer.csproj | 4 ++-- .../Microsoft.DotNet.Build.Tasks.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EventTracer/EventTracer.csproj b/src/EventTracer/EventTracer.csproj index 3ceefbf9c1..1a76b4b843 100644 --- a/src/EventTracer/EventTracer.csproj +++ b/src/EventTracer/EventTracer.csproj @@ -30,7 +30,7 @@ - + @@ -49,4 +49,4 @@ - \ No newline at end of file + diff --git a/src/Microsoft.DotNet.Build.Tasks/Microsoft.DotNet.Build.Tasks.csproj b/src/Microsoft.DotNet.Build.Tasks/Microsoft.DotNet.Build.Tasks.csproj index f024e00de7..5e8eb7c493 100644 --- a/src/Microsoft.DotNet.Build.Tasks/Microsoft.DotNet.Build.Tasks.csproj +++ b/src/Microsoft.DotNet.Build.Tasks/Microsoft.DotNet.Build.Tasks.csproj @@ -77,7 +77,7 @@ ..\..\packages\System.Reflection.Metadata.1.0.17-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll - + @@ -95,4 +95,4 @@ - \ No newline at end of file + From e5adba46ea6fe8b61a9c6a32f533982690902c6f Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Sun, 21 Jun 2015 11:55:43 +0000 Subject: [PATCH 3/3] Workarounds for building with Roslyn/MSBuild on Unix. Taken from corefx: commit 67fd8265894bd6707a10517133001b143f747693 Author: Jeremy Kuhne Date: Thu Apr 30 15:56:28 2015 -0700 Workarounds for building with Roslyn/MSBuild on Unix. Allows a successful compile with xplat MSBuild branch and Roslyn on Mono. Adds the Roslyn package and UseRoslyn property to use Roslyn. Disable PDB generation (NYI), skip packaging, disables ECMA delay signing. --- dir.props | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dir.props b/dir.props index 88de58d0db..6cf0e7d18e 100644 --- a/dir.props +++ b/dir.props @@ -64,7 +64,20 @@ $(OS) - + + + false + none + + false + + true