Skip to content

Commit

Permalink
Enabling standalone builds for Test Project of any Priority
Browse files Browse the repository at this point in the history
  • Loading branch information
ramarag committed Mar 11, 2016
1 parent e483278 commit 3ae10f3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
18 changes: 18 additions & 0 deletions Documentation/building/windows-test-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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>``
5 changes: 2 additions & 3 deletions tests/src/Common/test_runtime/test_runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -15,4 +13,5 @@
<None Include="project.json" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
<Target Name="Build" />
</Project>
13 changes: 10 additions & 3 deletions tests/src/dir.targets
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,21 @@
<!-- 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')"/>
Expand All @@ -96,7 +103,7 @@
<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>
Expand Down

0 comments on commit 3ae10f3

Please sign in to comment.