Merge pull request #4025 from dotnet/piotrpMSFT/redistProj

multi-proc test execution
This commit is contained in:
Piotr Puszkiewicz 2016-08-18 20:33:54 -04:00 committed by GitHub
commit b5e00acc15
7 changed files with 89 additions and 44 deletions

View file

@ -5,14 +5,14 @@
<PropertyGroup>
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
<CoreSDKDir>$(RepoRoot)/resources/MSBuildImports</CoreSDKDir>
<MSBuildImportsDir>$(RepoRoot)/resources/MSBuildImports</MSBuildImportsDir>
</PropertyGroup>
<ItemGroup>
<PublishOutputExtensions Include="$(ExeExtension);.dll;.pdb;.deps.json;.runtimeconfig.json" />
<FilesToMove Include="$(BinaryToCorehostifyRelDir)/csc.exe;$(BinaryToCorehostifyRelDir)/MSBuild.exe;" />
<BundledTools Include="csc;MSBuild;NuGet.CommandLine.XPlat;dotnet" />
<CoreSDKContent Include="$(CoreSDKDir)/**/*" />
<MSBuildImportsContent Include="$(MSBuildImportsDir)/**/*" />
</ItemGroup>
<Target Name="Compile" DependsOnTargets="Prepare;
@ -165,7 +165,7 @@
DestinationFiles="$(SdkOutputDirectory)/$(HostPolicyBaseName)" />
<!-- copy core sdk -->
<Copy SourceFiles="@(CoreSDKContent)"
<Copy SourceFiles="@(MSBuildImportsContent)"
DestinationFolder="$(SdkOutputDirectory)/%(RecursiveDir)" />
<!-- Crossgen the Shared Framework -->

View file

@ -27,13 +27,28 @@
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsEnv)" />
</ItemGroup>
<DotNetTest WorkingDirectory="%(TestProjects.ProjectDir)"
EnvironmentVariables="@(TestTaskEnvironmentVariables)"
ToolPath="$(Stage2Directory)"
Configuration="$(Configuration)"
NoBuild="True"
NoTrait="category=failing"
Xml="$(TestResultXmlDir)/%(TestProjects.OutputName)-testResults.xml" />
<PropertyGroup>
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
</PropertyGroup>
<ItemGroup>
<ProjectsToTest Include="build/test/RunTest.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
Configuration=$(Configuration);
EnvironmentVariables=$(RunTestEnvironmentVariables);
TestProjectName=%(TestProjects.OutputName);
TestResultXmlDir=$(TestResultXmlDir);
ToolPath=$(Stage2Directory);
WorkingDirectory=%(TestProjects.ProjectDir)
</Properties>
</ProjectsToTest>
</ItemGroup>
<MSBuild
BuildInParallel="True"
Projects="@(ProjectsToTest)">
</MSBuild>
</Target>
<Target Name="PrepareTests"
@ -63,7 +78,7 @@
<Target Name="RestoreTests"
DependsOnTargets="CreateTestAssetPackageNuPkgs;
CleanTestProjectsBinObj;
CleanTestProjectsBinObjProjectJson;
SetupRestoreTestsInputs;"
Inputs="@(RestoreTestsInputs)"
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
@ -74,13 +89,13 @@
WorkingDirectory="$(TestDirectory)" />
</Target>
<Target Name="CleanTestProjectsBinObj"
<Target Name="CleanTestProjectsBinObjProjectJson"
DependsOnTargets="SetupRestoreTestsInputs;"
Inputs="@(RestoreTestsInputs)"
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
<ItemGroup>
<FilesToDelete Include="$(TestDirectory)**/bin/**/*.*" />
<FilesToDelete Include="$(TestDirectory)**/obj/**/*.*" />
<FilesToDelete Include="$(TestDirectory)**/bin/**/project.json" />
<FilesToDelete Include="$(TestDirectory)**/obj/**/project.json" />
</ItemGroup>
<Delete Files="@(FilesToDelete)" />

21
build/test/RunTest.proj Normal file
View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTarget="RunTest" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- workaround for https://github.com/Microsoft/msbuild/issues/885 -->
<PropertyGroup>
<CLIBuildDll Condition=" '!Exists($(CLIBuildDll))' ">$([MSBuild]::Unescape($(CLIBuildDll)))</CLIBuildDll>
</PropertyGroup>
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
<Target Name="RunTest">
<DotNetTest WorkingDirectory="$(WorkingDirectory)"
EnvironmentVariables="$(EnvironmentVariables)"
ToolPath="$(ToolPath)"
Configuration="$(Configuration)"
NoBuild="True"
NoTrait="category=failing"
Xml="$(TestResultXmlDir)/$(TestProjectName)-testResults.xml" />
</Target>
</Project>

View file

@ -71,10 +71,10 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
if ($NoBuild)
{
Write-Host "Not building due to --nobuild"
Write-Host "Command that would be run: 'dotnet build3 build.proj /p:Architecture=$Architecture $ExtraParameters'"
Write-Host "Command that would be run: 'dotnet build3 build.proj /m /p:Architecture=$Architecture $ExtraParameters'"
}
else
{
dotnet build3 build.proj /p:Architecture=$Architecture $ExtraParameters
dotnet build3 build.proj /m /p:Architecture=$Architecture $ExtraParameters
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
}

View file

@ -117,8 +117,8 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
echo "${args[@]}"
if [ $BUILD -eq 1 ]; then
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE "${args[@]}"
dotnet build3 build.proj /m /p:Architecture=$ARCHITECTURE "${args[@]}"
else
echo "Not building due to --nobuild"
echo "Command that would be run is: 'dotnet build3 build.proj /p:Architecture=$ARCHITECTURE ${args[@]}'"
echo "Command that would be run is: 'dotnet build3 build.proj /m /p:Architecture=$ARCHITECTURE ${args[@]}'"
fi

View file

@ -6,7 +6,7 @@
"dependencies": {
"System.Runtime.Serialization.Primitives": "4.1.1",
"xunit": "2.1.0",
"dotnet-test-xunit": "1.0.0-rc2-192208-24",
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
},
"testRunner": "xunit",

View file

@ -31,14 +31,15 @@ namespace Microsoft.DotNet.Tests
_firstDotnetNonVerbUseCommandResult = command.ExecuteWithCapturedOutput("--info");
_firstDotnetVerbUseCommandResult = command.ExecuteWithCapturedOutput("new");
_nugetCacheFolder = new DirectoryInfo(testNugetCache);
}
[Fact]
public void Using_dotnet_for_the_first_time_succeeds()
{
_firstDotnetVerbUseCommandResult.Should().Pass();
_firstDotnetVerbUseCommandResult
.Should()
.Pass();
}
[Fact]
@ -46,7 +47,9 @@ namespace Microsoft.DotNet.Tests
{
const string firstTimeNonVerbUseMessage = @".NET Command Line Tools";
_firstDotnetNonVerbUseCommandResult.StdOut.Should().StartWith(firstTimeNonVerbUseMessage);
_firstDotnetNonVerbUseCommandResult.StdOut
.Should()
.StartWith(firstTimeNonVerbUseMessage);
}
[Fact]
@ -64,19 +67,25 @@ Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.";
_firstDotnetVerbUseCommandResult.StdOut.Should().StartWith(firstTimeUseWelcomeMessage);
_firstDotnetVerbUseCommandResult.StdOut
.Should()
.StartWith(firstTimeUseWelcomeMessage);
}
[Fact]
public void It_restores_the_nuget_packages_to_the_nuget_cache_folder()
{
_nugetCacheFolder.Should().HaveFile($"{GetDotnetVersion()}.dotnetSentinel");
_nugetCacheFolder
.Should()
.HaveFile($"{GetDotnetVersion()}.dotnetSentinel");
}
[Fact]
public void It_creates_a_sentinel_file_under_the_nuget_cache_folder()
{
_nugetCacheFolder.Should().HaveDirectory("microsoft.netcore.app");
_nugetCacheFolder
.Should()
.HaveDirectory("microsoft.netcore.app");
}
private string GetDotnetVersion()