Merge branch 'release' into dev

This commit is contained in:
Pranav K 2016-05-03 11:28:59 -07:00
Родитель d985b7e81e 2ba19e81a7
Коммит 4e09c8c3c6
4 изменённых файлов: 25 добавлений и 103 удалений

Просмотреть файл

@ -1,11 +1,9 @@
{
"frameworks": {
"dnx451": { }
"net451": { }
},
"dependencies": {
"Sake": "0.2.2",
"xunit.runner.console": "2.1.0",
"xunit.core": "2.1.0",
"NuGetPackageVerifier": "1.0.1-*"
}
}

Просмотреть файл

@ -17,17 +17,27 @@ configuration=''
default configuration = 'Debug'
@{
var projectFolder = Path.GetDirectoryName(projectFile);
var projectName = Path.GetFileName(projectFolder);
var noParallelTestProjects = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
if (!string.IsNullOrEmpty(NO_PARALLEL_TEST_PROJECTS))
var content = File.ReadAllText(projectFile);
// Desktop tests only work on Windows. Only run the test on xplat if it has a netcoreapp1.0 TFM.
if (content.Contains("\"testRunner\"") && (!IsLinux || content.Contains("netcoreapp1.0")))
{
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
}
var projectFolder = Path.GetDirectoryName(projectFile);
var projectName = Path.GetFileName(projectFolder);
var testArgs = " -f netcoreapp1.0 --configuration " + configuration;
testArgs += noParallelTestProjects.Contains(projectName) || IsLinux ? " -parallel none" : "";
Dotnet("test" + testArgs, 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 = " --configuration " + configuration;
if (IsLinux)
{
testArgs += " -f netcoreapp1.0";
}
testArgs += noParallelTestProjects.Contains(projectName) ? " -parallel none" : "";
Dotnet("test" + testArgs, projectFolder);
}
}

Просмотреть файл

@ -205,45 +205,11 @@ default PACKAGELIST_JSON_FILENAME = 'NuGetPackageVerifier.json'
#xunit-test target='test' if='Directory.Exists("test")'
@{
var projectFiles = Files.Include("test/*/project.json").ToArray();
var parallelOptions = new ParallelOptions
var projectFiles = Files.Include("test/*/project.json");
foreach (var projectFile in projectFiles)
{
MaxDegreeOfParallelism = ExecuteParallel ? 8 : 1
};
Parallel.ForEach(projectFiles, parallelOptions, (projectFile, _) =>
{
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;
if (!string.IsNullOrEmpty(BuildFramework))
{
targetFrameworks = targetFrameworks.Where(t => t.Equals(BuildFramework, StringComparison.OrdinalIgnoreCase)).ToList();
}
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));
var netstandardAppTFM = targetFrameworks.FirstOrDefault(t => t.Equals("netstandardapp1.5", StringComparison.OrdinalIgnoreCase));
var netCoreAppTFM = targetFrameworks.FirstOrDefault(t => t.Equals("netcoreapp1.0", StringComparison.OrdinalIgnoreCase));
if ((netstandardAppTFM != null || dnxCore50TFM != null || netCoreAppTFM != null) && project.Keys.Contains("testRunner"))
{
DotnetTest(projectFile, Configuration);
}
if (project.Keys.Contains("testRunner"))
{
if (net45TFM != null)
{
XunitTest(projectFile, net45TFM, Configuration);
}
else if (dnx451TFM != null)
{
XunitTest(projectFile, dnx451TFM, Configuration);
}
}
});
DotnetTest(projectFile, Configuration);
}
}
@ -428,9 +394,6 @@ macro name="DotnetPublish" projectFile='string' outputFolder='string' framework=
macro name="DotnetTest" projectFile='string' configuration='string'
dotnet-test
macro name="XunitTest" projectFile='string' framework='string' configuration='string'
xunit-test
macro name='Npm' npmCommand='string' npmDir='string'
npm

Просмотреть файл

@ -1,49 +0,0 @@
use import="Json"
use import="Environment"
default NO_PARALLEL_TEST_PROJECTS='${E("NO_PARALLEL_TEST_PROJECTS")}'
default KOREBUILD_TEST_SKIPMONO='${E("KOREBUILD_TEST_SKIPMONO")}'
@{/*
xunit-test
Run unit tests in your project.
projectFile=''
Required. Path to the test project.json to execute
framework=''
Required. The TFM to run tests for
configuration=''
Required. The configuration to build in. Defaults to 'Debug'.
*/}
@{
if (!string.Equals(KOREBUILD_TEST_SKIPMONO, "1") && !string.Equals(KOREBUILD_TEST_SKIPMONO, "true"))
{
var projectFolder = Path.GetDirectoryName(projectFile);
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 runnerExe = Path.GetFullPath(Path.Combine(KoreBuildFolderPath, "xunit.runner.console", "2.1.0", "tools", "xunit.console.exe"));
if (IsLinux)
{
// Work around issue with testing in parallel on Mono
// and issue https://github.com/xunit/xunit/issues/158
testArgs = " -parallel none -noappdomain";
}
var publishFolder = Directory.EnumerateDirectories(Path.Combine(projectFolder, "bin", configuration, framework)).First();
var targetTestDll = projectName + ".dll";
ExecClr(runnerExe, targetTestDll + " " + testArgs, publishFolder);
}
}