Enabling standalone builds for Test Project of any Priority
authorRama Krishnan Raghupathy <ramarag@microsoft.com>
Thu, 10 Mar 2016 23:45:22 +0000 (15:45 -0800)
committerRama Krishnan Raghupathy <ramarag@microsoft.com>
Fri, 11 Mar 2016 02:15:03 +0000 (18:15 -0800)
Documentation/building/windows-test-instructions.md
tests/src/Common/test_runtime/test_runtime.csproj
tests/src/dir.targets

index 6b748340483dc23bbcee01a9b5d5e11569bfafce..87d0b792ba5988384d56e9e9def646dbdc2c5c4e 100644 (file)
@@ -35,6 +35,14 @@ To run a clean, priority 1, crossgen test pass:
 
 Additionally, there is a Visual Studio solution, `<repo_root>\tests\src\AllTestProjects.sln`, where users can build a particular testcase, or all priority 0 testcases that are within it.
 
+**Building Individual Tests**
+
+Note: buildtest.cmd or build.cmd skipnative skipmscorlib needs to be run atleast once
+
+* Native Test: Build the generated Visual Studio solution or make file corresponding to Test cmake file.
+  
+* Managed Test: You can invoke msbuild on the project directly from Visual Studio Command Prompt.
+
 **Running Tests**
 
 In a clean command prompt: `<repo_root>\tests\runtest.cmd`
@@ -83,3 +91,13 @@ If test changes are needed, make the change and build the test project. This wil
 8. Add any other projects as a dependency, if needed.
 9. Build the test.
 10. Follow the steps to re-run a failed test to validate the new test.
+
+Note:
+
+1. You can disable building of a test per architecture or configuration by using DisableProjectBuild tag in the project. for example:
+
+  ``<PropertyGroup>``
+
+     ``<DisableProjectBuild Condition=" '$(Platform)' == 'arm64' ">true</DisableProjectBuild>``
+
+  ``</PropertyGroup>``
index e9e3a5a911a9a03e45e2402f2fa7466dc8ea540b..08881fdbc14ca4697cd84138e7d98ea59f8f3734 100644 (file)
@@ -4,8 +4,6 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <OutputType>Library</OutputType>
-    <GenerateRunScript>false</GenerateRunScript>
     <CLRTestKind>BuildOnly</CLRTestKind>
   </PropertyGroup>
   <ItemGroup>
@@ -15,4 +13,5 @@
     <None Include="project.json" />
   </ItemGroup>
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
\ No newline at end of file
+  <Target Name="Build" /> 
+</Project>
index a792d14768b7b740bec89423d1d3450f7c58bd90..8faec24672447f3881474eddbb7d61de970ff916 100644 (file)
   <!-- If we are a run-only, that depends on another project, this is the "Build" we use. I.e. build all dependency projects, absolutely.
   -->
 
-  <Target Name="Build" Condition="('$(CLRTestKind)'=='RunOnly') And ('$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)')">
+  <PropertyGroup> 
+    <BuildAllProjects Condition=" '$(BuildAllProjects)' == ''">false</BuildAllProjects>
+    <_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
+    <_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != true">true</_WillCLRTestProjectBuild>
+    <_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != true And '$(BuildAllProjects)' == true And '$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
+  </PropertyGroup>
+
+  <Target Name="Build" Condition="('$(CLRTestKind)'=='RunOnly') And '$(_WillCLRTestProjectBuild)'">
     <MSBuild Projects="@(ProjectReference)" />
     <MakeDir Condition="'$(CLRTestKind)' == 'RunOnly'" ContinueOnError="false" Directories="$(OutputPath)" />
   </Target>
   
   <!-- We will use an imported build here in the instance that we have source that we need to build, and we are the correct priority...OR if we are being asked to build for
   a test with a higher priority. -->
-  <Import Project="$(ToolsDir)Build.Common.targets" Condition="('$(CLRTestKind)'!='RunOnly') And (Exists('$(ToolsDir)Build.Common.targets') And $(_CLRTestCompilesSource) And '$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)')" />
+  <Import Project="$(ToolsDir)Build.Common.targets" Condition="('$(CLRTestKind)'!='RunOnly') And $(_CLRTestCompilesSource) And ('$(_WillCLRTestProjectBuild)')"/>
 
 
   <Import Project="..\override.targets" Condition="Exists('..\override.targets')"/>
   <Import Project="CLRTest.Execute.targets" />
   <Target Name="CreateExecuteScript" 
           AfterTargets="Build"
-          Condition="'$(GenerateRunScript)' != 'false' And ('$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)')"
+          Condition="'$(GenerateRunScript)' != 'false' And ('$(_WillCLRTestProjectBuild)')"
           DependsOnTargets="GenerateExecutionScriptsInternal" />
 
   <PropertyGroup>