Only run one set of desktop tests (net451 or dnx451).
This commit is contained in:
parent
350f9c4cef
commit
a7642bd20d
|
|
@ -17,15 +17,15 @@ IF "%KOREBUILD_DOTNET_VERSION%"=="" (
|
||||||
SET KOREBUILD_DOTNET_VERSION=1.0.0.001496
|
SET KOREBUILD_DOTNET_VERSION=1.0.0.001496
|
||||||
)
|
)
|
||||||
|
|
||||||
IF NOT EXIST Sake (
|
IF NOT EXIST %~dp0Sake (
|
||||||
"%NUGET_PATH%" install Sake -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
"%NUGET_PATH%" install Sake -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||||
)
|
)
|
||||||
|
|
||||||
IF NOT EXIST xunit.runner.console (
|
IF NOT EXIST %~dp0xunit.runner.console (
|
||||||
"%NUGET_PATH%" install xunit.runner.console -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
"%NUGET_PATH%" install xunit.runner.console -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||||
)
|
)
|
||||||
|
|
||||||
IF NOT EXIST xunit.core (
|
IF NOT EXIST %~dp0xunit.core (
|
||||||
"%NUGET_PATH%" install xunit.core -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
"%NUGET_PATH%" install xunit.core -ExcludeVersion -Source https://api.nuget.org/v3/index.json -o %~dp0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ use import="Json"
|
||||||
use import="Environment"
|
use import="Environment"
|
||||||
|
|
||||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||||
default KOREBUILD_TEST_SKIPMONO='${E("KOREBUILD_TEST_SKIPMONO")}'
|
|
||||||
|
|
||||||
@{/*
|
@{/*
|
||||||
|
|
||||||
|
|
@ -12,44 +11,25 @@ dnx-test
|
||||||
projectFile=''
|
projectFile=''
|
||||||
Required. Path to the test project.json to execute
|
Required. Path to the test project.json to execute
|
||||||
|
|
||||||
|
framework=''
|
||||||
|
Required. The TFM to run tests for
|
||||||
|
|
||||||
*/}
|
*/}
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var projectText = File.ReadAllText(projectFile);
|
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||||
var project = (JsonObject)Json.Deserialize(projectText);
|
var projectName = Path.GetFileName(projectFolder);
|
||||||
|
|
||||||
var commands = project.ValueAsJsonObject("commands");
|
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||||
|
{
|
||||||
|
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||||
|
}
|
||||||
|
|
||||||
if (commands != null && commands.Keys.Contains("test"))
|
var testArgs = noParallelTestProjects.Contains(projectName) || IsLinux ? " -parallel none" : "";
|
||||||
{
|
|
||||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
|
||||||
var projectName = Path.GetFileName(projectFolder);
|
|
||||||
|
|
||||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
if (framework.StartsWith("dnxcore", StringComparison.OrdinalIgnoreCase))
|
||||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
{
|
||||||
{
|
Dnx("test" + testArgs, projectFolder, "default -runtime coreclr");
|
||||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
|
||||||
}
|
|
||||||
|
|
||||||
var configs = project.ValueAsJsonObject("frameworks");
|
|
||||||
IEnumerable<string> targetFrameworks = configs == null?
|
|
||||||
new string[0]:
|
|
||||||
configs.Keys.Where(k => k.StartsWith("dnx", StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
foreach (var framework in targetFrameworks)
|
|
||||||
{
|
|
||||||
var testArgs = noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
|
|
||||||
|
|
||||||
if (framework.StartsWith("dnxcore", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
if (IsLinux)
|
|
||||||
{
|
|
||||||
// Work around issue with testing in parallel on Mono.
|
|
||||||
testArgs = " -parallel none";
|
|
||||||
}
|
|
||||||
|
|
||||||
Dnx("test" + testArgs, projectFolder, "default -runtime coreclr");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use import="Json"
|
|
||||||
use import="Environment"
|
use import="Environment"
|
||||||
|
|
||||||
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
|
||||||
|
|
@ -11,6 +10,9 @@ dotnet-test
|
||||||
projectFile=''
|
projectFile=''
|
||||||
Required. Path to the test project.json to execute
|
Required. Path to the test project.json to execute
|
||||||
|
|
||||||
|
framework=''
|
||||||
|
Required. The TFM to run tests for
|
||||||
|
|
||||||
configuration=''
|
configuration=''
|
||||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
Optional. The configuration to build in. Defaults to 'Debug'.
|
||||||
*/}
|
*/}
|
||||||
|
|
@ -18,31 +20,8 @@ configuration=''
|
||||||
default configuration = 'Debug'
|
default configuration = 'Debug'
|
||||||
|
|
||||||
@{
|
@{
|
||||||
var projectText = File.ReadAllText(projectFile);
|
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||||
var project = (JsonObject)Json.Deserialize(projectText);
|
var testArgs = "--configuration " + configuration + " --framework " + framework;
|
||||||
|
Dotnet("test " + testArgs, projectFolder);
|
||||||
// This check is just used to transition from dnx to dotnet
|
|
||||||
var commands = project.ValueAsJsonObject("commands");
|
|
||||||
|
|
||||||
if (commands == null && project.Keys.Contains("testRunner"))
|
|
||||||
{
|
|
||||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
|
||||||
var projectName = Path.GetFileName(projectFolder);
|
|
||||||
|
|
||||||
var testArgs = "--configuration " + configuration;
|
|
||||||
|
|
||||||
var configs = project.ValueAsJsonObject("frameworks");
|
|
||||||
IEnumerable<string> targetFrameworks = configs == null?
|
|
||||||
new string[0]:
|
|
||||||
configs.Keys.Where(k => k.StartsWith("dnx", StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
foreach (var framework in targetFrameworks)
|
|
||||||
{
|
|
||||||
if (framework.StartsWith("dnxcore"))
|
|
||||||
{
|
|
||||||
Dotnet("test " + testArgs, projectFolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,12 +179,45 @@ default NUGET_FEED = 'https://api.nuget.org/v3/index.json'
|
||||||
|
|
||||||
#xunit-test target='test' if='Directory.Exists("test")'
|
#xunit-test target='test' if='Directory.Exists("test")'
|
||||||
@{
|
@{
|
||||||
var projectFiles = Files.Include("test/**/project.json").Exclude("**/bin/*/app/project.json").ToList();
|
var projectFiles = Files.Include("test/**/project.json").Exclude("**/bin/*/app/project.json");
|
||||||
projectFiles.ForEach(projectFile => XunitTest(projectFile, testParallel: false, configuration: Configuration));
|
foreach (var projectFile in projectFiles)
|
||||||
projectFiles.ForEach(projectFile => DotnetTest(projectFile, testParallel: false, configuration: Configuration));
|
{
|
||||||
projectFiles.ForEach(projectFile => DnxTest(projectFile, testParallel: false));
|
var projectText = File.ReadAllText(projectFile);
|
||||||
|
var project = (JsonObject)Json.Deserialize(projectText);
|
||||||
|
var configs = project.ValueAsJsonObject("frameworks");
|
||||||
|
var targetFrameworks = configs == null ? new string[0] : configs.Keys;
|
||||||
|
|
||||||
|
var net45TFM = targetFrameworks.FirstOrDefault(t => t.StartsWith("net45", StringComparison.OrdinalIgnoreCase));
|
||||||
|
var dnx451TFM = targetFrameworks.FirstOrDefault(t => t.Equals("dnx451", StringComparison.OrdinalIgnoreCase));
|
||||||
|
var dnxCore50TFM = targetFrameworks.FirstOrDefault(t => t.Equals("dnxcore50", StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (dnxCore50TFM != null)
|
||||||
|
{
|
||||||
|
var hasTestCommand = project.Keys.Contains("commands") && project.ValueAsJsonObject("commands").Keys.Contains("test");
|
||||||
|
if (projectText.Contains("dotnet-test-xunit"))
|
||||||
|
{
|
||||||
|
DotnetTest(projectFile, dnxCore50TFM, Configuration);
|
||||||
|
}
|
||||||
|
else if (hasTestCommand)
|
||||||
|
{
|
||||||
|
DnxTest(projectFile, dnxCore50TFM, Configuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.Keys.Contains("testRunner"))
|
||||||
|
{
|
||||||
|
if (net45TFM != null)
|
||||||
|
{
|
||||||
|
XunitTest(projectFile, net45TFM, Configuration);
|
||||||
|
}
|
||||||
|
else if (dnx451TFM != null)
|
||||||
|
{
|
||||||
|
XunitTest(projectFile, dnx451TFM, Configuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#make-roslyn-fast
|
#make-roslyn-fast
|
||||||
ngen-roslyn
|
ngen-roslyn
|
||||||
|
|
||||||
|
|
@ -355,22 +388,19 @@ macro name="DotnetBuild" projectFile='string' configuration='string'
|
||||||
macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' configuration='string'
|
macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' configuration='string'
|
||||||
dotnet-pack
|
dotnet-pack
|
||||||
|
|
||||||
macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string'
|
|
||||||
dotnet-publish
|
|
||||||
|
|
||||||
macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string' configuration='string'
|
macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string' configuration='string'
|
||||||
dotnet-publish
|
dotnet-publish
|
||||||
|
|
||||||
macro name="DotnetTest" projectFile='string' testParallel='bool' configuration='string'
|
macro name="DotnetTest" projectFile='string' framework='string' configuration='string'
|
||||||
dotnet-test
|
dotnet-test
|
||||||
|
|
||||||
macro name="XunitTest" projectFile='string' testParallel='bool' configuration='string'
|
macro name="XunitTest" projectFile='string' framework='string' configuration='string'
|
||||||
xunit-test
|
xunit-test
|
||||||
|
|
||||||
macro name='Dnx' command='string' dnxDir='string' dnvmUse='string'
|
macro name='Dnx' command='string' dnxDir='string' dnvmUse='string'
|
||||||
dnx
|
dnx
|
||||||
|
|
||||||
macro name="DnxTest" projectFile='string' testParallel='bool'
|
macro name="DnxTest" projectFile='string' framework='string' configuration='string'
|
||||||
dnx-test
|
dnx-test
|
||||||
|
|
||||||
macro name="UpdateResx" resxFile='string'
|
macro name="UpdateResx" resxFile='string'
|
||||||
|
|
|
||||||
|
|
@ -12,74 +12,45 @@ xunit-test
|
||||||
projectFile=''
|
projectFile=''
|
||||||
Required. Path to the test project.json to execute
|
Required. Path to the test project.json to execute
|
||||||
|
|
||||||
configuration=''
|
framework=''
|
||||||
Optional. The configuration to build in. Defaults to 'Debug'.
|
Required. The TFM to run tests for
|
||||||
*/}
|
|
||||||
|
|
||||||
default configuration = 'Debug'
|
configuration=''
|
||||||
|
Required. The configuration to build in. Defaults to 'Debug'.
|
||||||
|
*/}
|
||||||
|
|
||||||
@{
|
@{
|
||||||
if (!string.Equals(KOREBUILD_TEST_SKIPMONO, "1") && !string.Equals(KOREBUILD_TEST_SKIPMONO, "true"))
|
if (!string.Equals(KOREBUILD_TEST_SKIPMONO, "1") && !string.Equals(KOREBUILD_TEST_SKIPMONO, "true"))
|
||||||
{
|
{
|
||||||
var projectText = File.ReadAllText(projectFile);
|
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||||
var project = (JsonObject)Json.Deserialize(projectText);
|
var projectName = Path.GetFileName(projectFolder);
|
||||||
|
|
||||||
if (project.Keys.Contains("testRunner"))
|
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
||||||
{
|
{
|
||||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||||
var projectName = Path.GetFileName(projectFolder);
|
|
||||||
|
|
||||||
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
|
||||||
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
|
|
||||||
{
|
|
||||||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
|
||||||
}
|
|
||||||
|
|
||||||
var testArgs = noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
|
|
||||||
|
|
||||||
var configs = project.ValueAsJsonObject("frameworks");
|
|
||||||
var targetFrameworks = configs == null
|
|
||||||
? new string[0]
|
|
||||||
: configs.Keys
|
|
||||||
.Where(k => k.StartsWith("dnx4", StringComparison.OrdinalIgnoreCase)
|
|
||||||
|| k.StartsWith("net4", StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
var runnerFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.runner.console", "tools"));
|
|
||||||
var xunitCoreFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.core", "build", "_desktop"));
|
|
||||||
|
|
||||||
foreach (var framework in targetFrameworks)
|
|
||||||
{
|
|
||||||
if (IsLinux)
|
|
||||||
{
|
|
||||||
// Work around issue with testing in parallel on Mono.
|
|
||||||
testArgs = " -parallel none";
|
|
||||||
}
|
|
||||||
|
|
||||||
var publishFolder = Path.Combine(projectFolder, "obj", "testPublish-" + framework);
|
|
||||||
DotnetPublish(projectFile, publishFolder, framework, configuration);
|
|
||||||
|
|
||||||
var runnerExe = "xunit.console.exe";
|
|
||||||
string runnerFullPath;
|
|
||||||
|
|
||||||
// Copy xunit.execution.desktop. This is required in order to load the binding
|
|
||||||
// redirects for dlls. See this thread for more details:
|
|
||||||
// https://github.com/xunit/xunit/issues/732
|
|
||||||
// Furthermore, xunit.console.exe must be launched in the same folder as the test dll
|
|
||||||
if (framework.StartsWith("dnx", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
Copy(runnerFolder, publishFolder, "*.*", true);
|
|
||||||
Copy(xunitCoreFolder, publishFolder, "*.*", true);
|
|
||||||
runnerFullPath = Path.GetFullPath(Path.Combine(publishFolder, runnerExe));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
runnerFullPath = Path.Combine(runnerFolder, runnerExe);
|
|
||||||
}
|
|
||||||
|
|
||||||
var targetTestDll = projectName + ".dll";
|
|
||||||
|
|
||||||
ExecClr(runnerFullPath, targetTestDll + " " + testArgs, publishFolder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var testArgs = noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
|
||||||
|
var runnerFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.runner.console", "tools"));
|
||||||
|
var xunitCoreFolder = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "build", "xunit.core", "build", "_desktop"));
|
||||||
|
|
||||||
|
if (IsLinux)
|
||||||
|
{
|
||||||
|
// Work around issue with testing in parallel on Mono.
|
||||||
|
testArgs = " -parallel none";
|
||||||
|
}
|
||||||
|
|
||||||
|
var publishFolder = Path.Combine(projectFolder, "obj", "testPublish-" + framework);
|
||||||
|
DotnetPublish(projectFile, publishFolder, framework, configuration);
|
||||||
|
|
||||||
|
var runnerExe = "xunit.console.exe";
|
||||||
|
Copy(runnerFolder, publishFolder, "*.*", true);
|
||||||
|
Copy(xunitCoreFolder, publishFolder, "*.*", true);
|
||||||
|
var runnerFullPath = Path.GetFullPath(Path.Combine(publishFolder, runnerExe));
|
||||||
|
|
||||||
|
var targetTestDll = projectName + ".dll";
|
||||||
|
|
||||||
|
ExecClr(runnerFullPath, targetTestDll + " " + testArgs, publishFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue