Merge pull request #1340 from Sridhar-MS/test-fx

[WIP]: TestFramework with support for managing test projects.
This commit is contained in:
Sridhar Periyasamy 2016-02-16 16:09:09 -08:00
commit 735b4beb7c
48 changed files with 843 additions and 248 deletions

View file

@ -58,6 +58,13 @@ namespace Microsoft.DotNet.Cli.Build
[Target]
public static BuildTargetResult BuildTestPrerequisites(BuildTargetContext c)
{
BuildTestAssetPackages(c);
BuildTestAssetProjects(c);
return c.Success();
}
public static void BuildTestAssetPackages(BuildTargetContext c)
{
var dotnet = DotNetCli.Stage2;
@ -73,8 +80,24 @@ namespace Microsoft.DotNet.Cli.Build
.Execute()
.EnsureSuccessful();
}
}
return c.Success();
public static void BuildTestAssetProjects(BuildTargetContext c)
{
var dotnet = DotNetCli.Stage2;
string testProjectsRoot = Path.Combine(c.BuildContext.BuildDirectory, "TestAssets", "TestProjects");
List<string> exclusionList = new List<string> { Path.Combine(testProjectsRoot, "CompileFail", "project.json") };
var projects = Directory.GetFiles(testProjectsRoot, "project.json", SearchOption.AllDirectories)
.Where(p => !exclusionList.Any(e => e.Contains(p)));
foreach (var project in projects)
{
c.Info($"Building: {project}");
dotnet.Build("--framework", "dnxcore50")
.WorkingDirectory(Path.GetDirectoryName(project))
.Execute()
.EnsureSuccessful();
}
}
[Target]

View file

@ -0,0 +1,45 @@
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
. "$PSScriptRoot\..\..\common\_common.ps1"
function buildTestPackages
{
mkdir -Force $TestPackageDir
loadTestPackageList | foreach {
dotnet pack "$RepoRoot\TestAssets\TestPackages\$($_.ProjectName)" --output "$TestPackageDir"
if (!$?) {
error "Command failed: dotnet pack"
Exit 1
}
}
}
function buildTestProjects
{
$testProjectsRoot = "$RepoRoot\TestAssets\TestProjects"
$exclusionList = @("$testProjectsRoot\CompileFail\project.json")
$testProjectsList = (Get-ChildItem "$testProjectsRoot" -rec -filter "project.json").FullName
$testProjectsList | foreach {
if ($exclusionList -notcontains $_) {
Write-Host "$_"
dotnet build "$_"
if (!$?) {
error "Command failed: dotnet build"
Exit 1
}
}
}
}
buildTestPackages
buildTestProjects