Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test build target agnostic separately from target specific tests #34658

Merged
merged 10 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/coreclr/build-test.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ set __GenerateLayoutOnly=0
set __Priority=0
set __PriorityArg=

set __BuildNeedTargetArg=

:Arg_Loop
if "%1" == "" goto ArgsDone

Expand Down Expand Up @@ -108,6 +110,8 @@ if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!pro
if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "-priority" (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
if /i "%1" == "targetGeneric" (set "__BuildNeedTargetArg=/p:CLRTestNeedTargetToBuild=%1"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "targetSpecific" (set "__BuildNeedTargetArg=/p:CLRTestNeedTargetToBuild=%1"&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set __SkipCrossgenFramework=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "skipgeneratelayout" (set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
Expand Down Expand Up @@ -300,7 +304,7 @@ powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "%__RepoRootDir%\
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount^
%__SkipFXRestoreArg%^
!__Logging! %__CommonMSBuildArgs% %__PriorityArg% %__UnprocessedBuildArgs%
!__Logging! %__CommonMSBuildArgs% %__PriorityArg% %__BuildNeedTargetArg% %__UnprocessedBuildArgs%

if errorlevel 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: Package restoration failed. Refer to the build log files for details:
Expand Down Expand Up @@ -360,7 +364,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__Logging!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !TargetsWindowsMsbuildArg!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__msbuildArgs!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__PriorityArg!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__PriorityArg! !__BuildNeedTargetArg!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__UnprocessedBuildArgs!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:CopyNativeProjectBinaries=!__CopyNativeProjectsAfterCombinedTestBuild!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:__SkipPackageRestore=true
Expand All @@ -379,7 +383,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
goto :Exit_Failure
)
) else (
set __MSBuildBuildArgs=!__ProjectDir!\tests\build.proj -warnAsError:0 /nodeReuse:false !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__SkipFXRestoreArg! !__UnprocessedBuildArgs! "/t:CopyAllNativeProjectReferenceBinaries"
set __MSBuildBuildArgs=!__ProjectDir!\tests\build.proj -warnAsError:0 /nodeReuse:false !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__BuildNeedTargetArg! !__SkipFXRestoreArg! !__UnprocessedBuildArgs! "/t:CopyAllNativeProjectReferenceBinaries"
echo Running: msbuild !__MSBuildBuildArgs!
!__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs!

Expand Down Expand Up @@ -464,7 +468,7 @@ powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__RepoRootDir%\eng
/p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
/p:UsePartialNGENOptimization=false /maxcpucount^
%__SkipFXRestoreArg%^
!__Logging! %__CommonMSBuildArgs% %RuntimeIdArg% %__PriorityArg% %__UnprocessedBuildArgs%
!__Logging! %__CommonMSBuildArgs% %RuntimeIdArg% %__PriorityArg% %__BuildNeedTargetArg% %__UnprocessedBuildArgs%
if errorlevel 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: Create Test Overlay failed. Refer to the build log files for details:
echo %__BuildLog%
Expand Down Expand Up @@ -606,6 +610,8 @@ echo -priority=^<N^> : specify a set of tests that will be built and run, with p
echo 0: Build only priority 0 cases as essential testcases (default)
echo 1: Build all tests with priority 0 and 1
echo 666: Build all tests with priority 0, 1 ... 666
echo targetGeneric: Only build tests which run on any target platform.
echo targetSpecific: Only build tests which run on a specific target platform.
echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file.
exit /b 1

Expand Down
13 changes: 12 additions & 1 deletion src/coreclr/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ usage_list+=("-crossgen2: Precompiles the framework managed assemblies in corero
usage_list+=("-generatetesthostonly: only generate the test host.")
usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroot.")
usage_list+=("-priority1: include priority=1 tests in the build.")
usage_list+=("-targetGeneric: Only build tests which run on any target platform.")
usage_list+=("-targetSpecific: Only build tests which run on a specific target platform.")

usage_list+=("-rebuild: if tests have already been built - rebuild them.")
usage_list+=("-runtests: run tests after building them.")
usage_list+=("-skiprestorepackages: skip package restore.")
Expand All @@ -503,6 +506,7 @@ usage_list+=("-excludemonofailures: Mark the build as running on Mono runtime so
# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
__BuildArch=

handle_arguments_local() {
case "$1" in
Expand Down Expand Up @@ -545,6 +549,14 @@ handle_arguments_local() {
__UnprocessedBuildArgs+=("/p:CLRTestPriorityToBuild=1")
;;

targetGeneric|-targetGeneric)
__UnprocessedBuildArgs+=("/p:CLRTestNeedTargetToBuild=targetGeneric")
;;

targetSpecific|-targetSpecific)
__UnprocessedBuildArgs+=("/p:CLRTestNeedTargetToBuild=targetSpecific")
;;

rebuild|-rebuild)
__RebuildTests=1
;;
Expand All @@ -570,7 +582,6 @@ handle_arguments_local() {
esac
}

__BuildArch=
__BuildType=Debug
__CodeCoverage=
__IncludeTests=INCLUDE_TESTS
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
<CLRTestPriorityToBuild>0</CLRTestPriorityToBuild>
</PropertyGroup>

<!-- Which tests can we build? Default: All tests.
At the command-line, the user can specify:
+ /p:CLRTestNeedTargetToBuild=targetGeneric Only build tests which run on any target platform.
+ /p:CLRTestNeedTargetToBuild=targetSpecific Only build tests which run on a specific target platform.
-->
<PropertyGroup>
<CLRTestNeedTargetToBuild></CLRTestNeedTargetToBuild>
</PropertyGroup>

<!-- Where to put a "testhost" for running corefx tests -->
<PropertyGroup>
<TestHostVersion>$(ProductVersion)</TestHostVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
</ItemGroup>
</Target>

<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>

<Target Name="AddLibrariesToCoreRoot" BeforeTargets="CopyDependencyToCoreRoot" DependsOnTargets="ResolveLibrariesFromLocalBuild">
<ItemGroup>
<RuntimeCopyLocalItems Include="@(LibrariesRuntimeFiles)" />
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/tests/src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<CLRTestKind Condition="'$(CLRTestKind)' == '' and '$(OutputType)' == 'Library'">SharedLibrary</CLRTestKind>
<CLRTestKind Condition="'$(CLRTestKind)' == ''">BuildAndRun</CLRTestKind>
<CLRTestPriority Condition="'$(CLRTestPriority)' == ''">0</CLRTestPriority>
<CLRTestNeedTarget Condition="'$(CLRTestNeedTarget)' == ''">0</CLRTestNeedTarget>
</PropertyGroup>

<!-- All CLRTests need to be of a certain "kind". These kinds are enumerated below.
Expand Down Expand Up @@ -72,6 +73,8 @@
<_WillCLRTestProjectBuild Condition="'$(_WillCLRTestProjectBuild)' == ''">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != 'true'">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' == 'true' And '$(CLRTestPriority)' &lt;= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(CLRTestNeedTargetToBuild)' == 'targetGeneric' And '$(CLRTestNeedTarget)' == '1'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(CLRTestNeedTargetToBuild)' == 'targetSpecific' And '$(CLRTestNeedTarget)' != '1'">false</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' == 'true'">false</_WillCLRTestProjectBuild>
</PropertyGroup>

Expand Down Expand Up @@ -102,6 +105,7 @@
<ProjectLanguage Condition="'$(MSBuildProjectExtension)' == '.csproj' OR '$(Language)' == 'C#' OR '$(ProjectLanguage)'==''">CSharp</ProjectLanguage>

<SkipImportILTargets Condition="'$(CLRTestPriority)' &gt; '$(CLRTestPriorityToBuild)'">true</SkipImportILTargets>
<SkipImportILTargets Condition="'$(CLRTestNeedTargetToBuild)' != '' And '$(CLRTestNeedTarget)' != '$(CLRTestNeedTargetToBuild)'">true</SkipImportILTargets>
</PropertyGroup>

<Import Project="CLRTest.Execute.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
<ProjectReference Include="CMakeLists.txt" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<ProjectReference Include="../NetServer/NetServer.DefaultInterfaces.ilproj" />
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<ProjectReference Include="../NetServer/NetServer.csproj" />
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<ProjectReference Include="../NetServer/NetServer.csproj" />
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<ProjectReference Include="../NetServer/NetServer.csproj" />
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<ItemGroup>
<ProjectReference Include="CMakeLists.txt" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<ProjectReference Include="CMakeLists.txt" />
<ProjectReference Include="$(TestSourceDir)Common/CoreCLRTestLibrary/CoreCLRTestLibrary.csproj" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<Compile Include="ICustomMarshaler.cs" />
<Compile Include="..\..\common\XunitBase.cs" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<ItemGroup>
<ProjectReference Include="../NativeLibraryToLoad/CMakeLists.txt" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm64'" Include="arglist64.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="arglistARM.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="ArchSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm64'" Include="arglist64.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="arglistARM.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="ArchSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm64'" Include="arglist64.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="arglistARM.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="ArchSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm64'" Include="arglist64.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="arglistARM.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="ArchSpecific" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions src/coreclr/tests/src/JIT/Directed/StructABI/StructABI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<DebugType>PdbOnly</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
<ItemGroup>
<Compile Include="StructABI.cs" />
<Compile Include="StructABI.Windows.cs" Condition="'$(TargetOS)' == 'Windows_NT'" />
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/tests/src/JIT/Directed/arglist/vararg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<ItemGroup>
<ProjectReference Include="CMakeLists.txt" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="OsSpecific" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="i_array_merge-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="i_array_merge-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="sizeof-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="sizeof-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="u_array_merge-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="u_array_merge-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="i_array_merge-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="i_array_merge-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="sizeof-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="sizeof-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'arm'" Include="u_array_merge-i386.il" />
<Compile Condition="'$(TargetArchitecture)' == 'armel'" Include="u_array_merge-i386.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@
<Compile Condition="'$(TargetArchitecture)' == 'x86'" Include="sizeof.il" />
<Compile Condition="'$(TargetArchitecture)' != 'x86'" Include="64sizeof.il" />
</ItemGroup>
<PropertyGroup>
<CLRTestNeedTarget>1</CLRTestNeedTarget>
</PropertyGroup>
<ItemGroup>
<TraitTags Include="BitSpecific" />
</ItemGroup>
</Project>
Loading