Merge pull request #1340 from Sridhar-MS/test-fx
[WIP]: TestFramework with support for managing test projects.
This commit is contained in:
commit
735b4beb7c
48 changed files with 843 additions and 248 deletions
|
@ -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]
|
||||
|
|
45
scripts/test/setup/build-test-prerequisites.ps1
Normal file
45
scripts/test/setup/build-test-prerequisites.ps1
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue