Skip to content

Commit

Permalink
Only run AntlrGeneratedFiles test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Oct 30, 2017
1 parent 527d15a commit fa60b86
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
20 changes: 19 additions & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,27 @@ Task("PrepareTestAssets")
.ExceptionOnError($"Failed to build '{folder}'.");
}

var platform = Platform.Current;

// Restore and build Windows-only test assets
if (platform.IsWindows)
{
foreach (var project in buildPlan.WindowsOnlyTestAssets)
{
Information("Restoring and building: {0} (windows-only)...", project);

var folder = CombinePaths(env.Folders.TestAssets, "test-projects", project);

RunTool(env.DotNetCommand, "restore", folder)
.ExceptionOnError($"Failed to restore '{folder}'.");

RunTool(env.DotNetCommand, "build", folder)
.ExceptionOnError($"Failed to build '{folder}'.");
}
}

if (AllowLegacyTests())
{
var platform = Platform.Current;
if (platform.IsMacOS && platform.Version.Major == 10 && platform.Version.Minor == 12)
{
// Trick to allow older .NET Core SDK to run on Sierra.
Expand Down
6 changes: 4 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"ProjectAndSolution",
"ProjectAndSolutionWithProjectSection",
"TwoProjectsWithSolution",
"ProjectWithGeneratedFile",
"AntlrGeneratedFiles"
"ProjectWithGeneratedFile"
],
"LegacyTestAssets": [
"LegacyNUnitTestProject",
Expand All @@ -46,5 +45,8 @@
],
"CakeTestAssets": [
"CakeProject"
],
"WindowsOnlyTestAssets": [
"AntlrGeneratedFiles"
]
}
1 change: 1 addition & 0 deletions scripts/common.cake
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public class BuildPlan
public string[] TestAssets { get; set; }
public string[] LegacyTestAssets { get; set; }
public string[] CakeTestAssets { get; set; }
public string[] WindowsOnlyTestAssets { get; set; }

public static BuildPlan Load(BuildEnvironment env)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/OmniSharp.MSBuild.Tests/WorkspaceInformationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public async Task ProjectWithSdkProperty()
}
}

[Fact]
[ConditionalFact(typeof(WindowsOnly))]
public async Task AntlrGeneratedFiles()
{
using (var testProject = await TestAssets.Instance.GetTestProjectAsync("AntlrGeneratedFiles"))
Expand Down
6 changes: 6 additions & 0 deletions tests/TestUtility/ConditionalFactAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public class NotOnAppVeyor : SkipCondition
public override string SkipReason => "Can't run on AppVeyor";
}

public class WindowsOnly : SkipCondition
{
public override bool ShouldSkip => !PlatformHelper.IsWindows;
public override string SkipReason => "Can only be run on Windows";
}

public class IsLegacyTest : SkipCondition
{
public override bool ShouldSkip
Expand Down

0 comments on commit fa60b86

Please sign in to comment.