From 499458e3889a68b633be1bccc31eae6fe4f30191 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Fri, 30 Sep 2016 21:26:04 -0700 Subject: [PATCH] Move test publishing from post-build to pre-test-run Currently test publishing happens during PrepareForRun which is a post step of build. However we need TestTFM as a parameter in test publishing which we don't know until test runtime because a given test build can have a set of TestTFM's that apply to it. To address this we are moving test publishing as a pre-step for test running. To do this we are overriding the Test target and adding a set of DependsOnTargets to allow for ordering them correctly. --- .../PackageFiles/publishtest.targets | 13 ++++---- .../PackageFiles/tests.targets | 31 ++++++++++++++----- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks/PackageFiles/publishtest.targets b/src/Microsoft.DotNet.Build.Tasks/PackageFiles/publishtest.targets index 85fb7ed335..f87f429192 100644 --- a/src/Microsoft.DotNet.Build.Tasks/PackageFiles/publishtest.targets +++ b/src/Microsoft.DotNet.Build.Tasks/PackageFiles/publishtest.targets @@ -13,7 +13,6 @@ - $(PrepareForRunDependsOn);CopyTestToTestDirectory;CreateTestNuGetPackage;ArchiveTestBuild x64 win7-$(TestArchitecture) @@ -55,7 +54,7 @@ TargetMonikers="@(TestNugetTargetMoniker)"> - + <_TestCopyLocalXunitFiles Include="$(PackagesDir)xunit.runner.console\2.1.0\tools\*.exe" /> <_TestCopyLocalXunitFiles Include="$(PackagesDir)xunit.runner.console\2.1.0\tools\*.dll" /> @@ -65,7 +64,7 @@ false - + <_TestCopyLocalAppXRunner Include="$(PackagesDir)microsoft.xunit.runner.uwp\$(AppXRunnerVersion)\**\*.*"/> @@ -217,11 +216,11 @@ - @@ -235,7 +234,7 @@ <_DestinationsForTestsInVS Include="@(_IncludedFileForTestsInVS->'$(TestPath)$(TestNugetTargetMonikerFolder)\%(Filename)%(Extension)')" /> - + - + diff --git a/src/Microsoft.DotNet.Build.Tasks/PackageFiles/tests.targets b/src/Microsoft.DotNet.Build.Tasks/PackageFiles/tests.targets index 1d0ff7e8f8..3422d2b9aa 100644 --- a/src/Microsoft.DotNet.Build.Tasks/PackageFiles/tests.targets +++ b/src/Microsoft.DotNet.Build.Tasks/PackageFiles/tests.targets @@ -106,7 +106,7 @@ $(XunitOptions) -notrait Benchmark=true $(XunitOptions) -redirectoutput - + $(XunitOptions) -notrait category=non$(TestTFM)tests $(XunitOptions) -maxthreads $(XunitMaxThreads) $(TargetFileName) @@ -151,7 +151,7 @@ --> @@ -258,8 +258,7 @@ ScriptOutputPath ="$(OutputPathForScriptGenerator)" /> - - + @@ -300,8 +298,7 @@ Files="$(TestsSuccessfulSemaphore)" /> - + @@ -311,4 +308,22 @@ + + + + + + $(TestDependsOn); + DiscoverTestInputs; + SetupTestProperties; + CopyTestToTestDirectory; + RunTestsForProject; + ArchiveTestBuild + + + + + +