set __RuntimeId=
set __TargetsWindows=1
set __DoCrossgen=
+set __CopyNativeTestBinaries=0
+set __SkipGenerateLayout=0
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
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" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __SkipNative=1&set __SkipRestorePackages=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" == "--" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
REM ===
REM =========================================================================================
-if "%__SkipRestorePackages%" == 1 goto SkipRestoreProduct
+if "%__SkipRestorePackages%" == "1" goto SkipRestoreProduct
echo %__MsgPrefix%Restoring CoreCLR product from packages
set __Logging='!__MsbuildLog!' '!__MsbuildWrn!' '!__MsbuildErr!'
set __TestGroupToBuild=%%G
- echo Running: msbuild %__ProjectDir%\tests\build.proj !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
-
- REM Disable warnAsError - coreclr issue 19922
- powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "%__ProjectDir%\eng\common\msbuild.ps1" %__ArcadeScriptArgs%^
- %__ProjectDir%\tests\build.proj -warnAsError:0 !__Logging! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
-
- if errorlevel 1 (
- echo %__ErrMsgPrefix%%__MsgPrefix%Error: managed test build failed. Refer to the build log files for details:
- echo %__BuildLog%
- echo %__BuildWrn%
- echo %__BuildErr%
- REM This is necessary because of a(n apparent) bug in the FOR /L command. Under certain circumstances,
- REM such as when this script is invoke with CMD /C "build-test.cmd", a non-zero exit directly from
- REM within the loop body will not propagate to the caller. For some reason, goto works around it.
- goto :Exit_Failure
+
+ if not "%__CopyNativeTestBinaries%" == "1" (
+ echo Running: msbuild %__ProjectDir%\tests\build.proj !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
+
+ REM Disable warnAsError - coreclr issue 19922
+ powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "%__ProjectDir%\eng\common\msbuild.ps1" %__ArcadeScriptArgs%^
+ %__ProjectDir%\tests\build.proj -warnAsError:0 !__Logging! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
+
+ if errorlevel 1 (
+ echo %__ErrMsgPrefix%%__MsgPrefix%Error: managed test build failed. Refer to the build log files for details:
+ echo %__BuildLog%
+ echo %__BuildWrn%
+ echo %__BuildErr%
+ REM This is necessary because of a(n apparent) bug in the FOR /L command. Under certain circumstances,
+ REM such as when this script is invoke with CMD /C "build-test.cmd", a non-zero exit directly from
+ REM within the loop body will not propagate to the caller. For some reason, goto works around it.
+ goto :Exit_Failure
+ )
+ ) else (
+ echo Running: msbuild %__ProjectDir%\tests\build.proj !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs% /t:CopyAllNativeProjectReferenceBinaries
+
+ REM Disable warnAsError - coreclr issue 19922
+ powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "%__ProjectDir%\eng\common\msbuild.ps1" %__ArcadeScriptArgs%^
+ %__ProjectDir%\tests\build.proj -warnAsError:0 !__Logging! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs% "/t:CopyAllNativeProjectReferenceBinaries"
+
+ if errorlevel 1 (
+ echo %__ErrMsgPrefix%%__MsgPrefix%Error: copying native test binaries failed. Refer to the build log files for details:
+ echo %__BuildLog%
+ echo %__BuildWrn%
+ echo %__BuildErr%
+ REM This is necessary because of a(n apparent) bug in the FOR /L command. Under certain circumstances,
+ REM such as when this script is invoke with CMD /C "build-test.cmd", a non-zero exit directly from
+ REM within the loop body will not propagate to the caller. For some reason, goto works around it.
+ goto :Exit_Failure
+ )
)
set __SkipPackageRestore=true
set __AppendToLog=true
)
+if "%__CopyNativeTestBinaries%" == "1" goto :SkipManagedBuild
+
REM Check that we've built about as many tests as we expect. This is primarily intended to prevent accidental changes that cause us to build
REM drastically fewer Pri-1 tests than expected.
echo %__MsgPrefix%Check the managed tests build
:SkipManagedBuild
+if "%__SkipGenerateLayout%" == "1" goto TestBuildDone
+
REM =========================================================================================
REM ===
REM === Prepare the test drop
REM === All builds complete!
REM ===
REM =========================================================================================
+:TestBuildDone
echo %__MsgPrefix%Test build succeeded. Finished at %TIME%
echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
echo win-x64: Builds overlay for portable Windows
echo win7-x64: Builds overlay for Windows 7
echo crossgen: Precompiles the framework managed assemblies
+echo copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.
+echo skipgeneratelayout: Do not generate the Core_Root layout or the CoreFX testhost.
echo targetsNonWindows:
echo Exclude- Optional parameter - specify location of default exclusion file ^(defaults to tests\issues.targets if not specified^)
echo Set to "" to disable default exclusion file.
fi
echo "Managed tests build success!"
+
+ build_test_wrappers
fi
- build_test_wrappers
+ if [ $__CopyNativeTestBinaries == 1 ]; then
+ echo "Copying native test binaries to output..."
+
+ build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "/t:CopyAllNativeProjectReferenceBinaries"
+
+ if [ $? -ne 0 ]; then
+ echo "${__ErrMsgPrefix}${__MsgPrefix}Error: copying native test binaries failed. Refer to the build log files for details (above)"
+ exit 1
+ fi
+ fi
if [ -n "$__UpdateInvalidPackagesArg" ]; then
__up="/t:UpdateInvalidPackageVersions"
fi
- generate_layout
+ if [ $__SkipGenerateLayout != 1 ]; then
+ generate_layout
+ fi
}
build_MSBuild_projects()
echo "bindir - output directory (defaults to $__ProjectRoot/bin)"
echo "msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
echo "priority1 - include priority=1 tests in the build"
+ echo "copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests."
+ echo "skipgeneratelayout: Do not generate the Core_Root layout or the CoreFX testhost."
exit 1
}
__priority1=
__BuildTestWrappersOnly=
__DoCrossgen=0
+__CopyNativeTestBinaries=0
+__SkipGenerateLayout=0
CORE_ROOT=
while :; do
__UnprocessedBuildArgs+=("/p:CLRTestPriorityToBuild=1")
;;
+ copynativeonly)
+ __SkipNative=1
+ __SkipManaged=1
+ __CopyNativeTestBinaries=1
+ __SkipRestorePackages=1
+ ;;
+
+ skipgeneratelayout)
+ __SkipGenerateLayout=1
+ ;;
+
*)
__UnprocessedBuildArgs+=("$1")
;;
<!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
<Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
</Target>
+
+ <Target Name="CopyAllNativeTestProjectBinaries">
+ <Message Importance="High" Text="Copying native test binaries..." />
+
+ <PropertyGroup>
+ <DefaultCopyAllNativeTestProjectBinariesTarget Condition="'$(DefaultCopyAllNativeTestProjectBinariesTarget)'==''">CopyAllNativeProjectReferenceBinaries</DefaultCopyAllNativeTestProjectBinariesTarget>
+ </PropertyGroup>
+
+ <!-- To Serialize we use msbuild's batching functionality '%' to force it to batch all similar projects with the same identity
+ however since the project names are unique it will essentially force each to run in its own batch -->
+ <MSBuild Targets="$(DefaultCopyAllNativeTestProjectBinariesTarget)"
+ Projects="@(Project)"
+ Condition="'$(SerializeProjects)'=='true'"
+ Properties="Dummy=%(Identity)"
+ ContinueOnError="ErrorAndContinue" />
+
+ <MSBuild Targets="$(DefaultCopyAllNativeTestProjectBinariesTarget)"
+ Projects="@(Project)"
+ Condition="'$(SerializeProjects)'!='true'"
+ BuildInParallel="true"
+ ContinueOnError="ErrorAndContinue" />
+
+ <!-- Given we ErrorAndContinue we need to propagate the error if the overall task failed -->
+ <Error Condition="'$(MSBuildLastTaskResult)'=='false'" />
+ </Target>
<PropertyGroup>
<TraversalBuildDependsOn>
RestoreAllProjectPackages;
$(TraversalRestorePackagesDependsOn)
</TraversalRestorePackagesDependsOn>
+ <TraversalCopyAllNativeProjectReferenceBinariesDependsOn>
+ CopyAllNativeTestProjectBinaries;
+ $(TraversalCopyAllNativeProjectReferenceBinariesDependsOn)
+ </TraversalCopyAllNativeProjectReferenceBinariesDependsOn>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(TraversalBuildDependsOn)" />
<Target Name="RestorePackages" DependsOnTargets="$(TraversalRestorePackagesDependsOn)" />
-</Project>
\ No newline at end of file
+ <Target Name="CopyAllNativeProjectReferenceBinaries" DependsOnTargets="$(TraversalCopyAllNativeProjectReferenceBinariesDependsOn)" />
+</Project>
echo "Product Location : ${coreClrBinDir}"
fi
-if [ -z "$coreOverlayDir" ]; then
- runtestPyArguments+=("--generate_layout")
-else
- runtestPyArguments+=("-core_root" "$coreOverlayDir")
- echo "Core Root Location : ${coreOverlayDir}"
-fi
-
if [ ! -z "$testNativeBinDir" ]; then
runtestPyArguments+=("-test_native_bin_location" "$testNativeBinDir")
echo "Test Native Bin Location : ${testNativeBinDir}"
<_WillCLRTestProjectBuild Condition="'$(BuildAllProjects)' != 'true'">true</_WillCLRTestProjectBuild>
<_WillCLRTestProjectBuild Condition="'$(DisableProjectBuild)' != 'true' And '$(BuildAllProjects)' == 'true' And '$(CLRTestPriority)' <= '$(CLRTestPriorityToBuild)'">true</_WillCLRTestProjectBuild>
</PropertyGroup>
+
+ <PropertyGroup>
+ <CopyNativeProjectBinaries Condition="'$(CopyNativeProjectBinaries)' == '' And '$(_WillCLRTestProjectBuild)' == 'true' And '$(DisableProjectBuild)' != 'true'">true</CopyNativeProjectBinaries>
+ <CopyNativeProjectBinaries Condition="'$(CopyNativeProjectBinaries)' == '' And ('$(_WillCLRTestProjectBuild)' == 'false' Or '$(DisableProjectBuild)' == 'true')">false</CopyNativeProjectBinaries>
+ </PropertyGroup>
<!-- if we have determined that there is nothing to build, overwrite the build targets so that nothing happens -->
<Import Project="nobuild.targets" Condition="'$(_WillCLRTestProjectBuild)' == 'false'" />
</Target>
<Target Name="ConsolidateNativeProjectReference"
- Condition="'@(NativeProjectReferenceNormalized)' != ''"
+ Condition="'@(NativeProjectReferenceNormalized)' != '' and '$(CopyNativeProjectBinaries)' == 'true'"
BeforeTargets="Build" >
<ItemGroup>
<NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(SourceDir),$(__NativeTestIntermediatesDir)\src\))" Condition="'$(RunningOnUnix)' == 'true'" />
</Target>
+ <Target Name="CopyAllNativeProjectReferenceBinaries" DependsOnTargets="ResolveCmakeNativeProjectReference;ConsolidateNativeProjectReference" />
+
<Target Name="UpdateReferenceItems"
BeforeTargets="BeforeResolveReferences"
>
<Warning Text="Looks like there may be an update to the build tools. Please run buildtest.cmd from the root of the repo to refresh the build tools." />
</Target>
- <Target Name="ResolveDisabledProjects" BeforeTargets="BuildAllProjects" >
+ <Target Name="ResolveDisabledProjects" BeforeTargets="BuildAllProjects;CopyAllNativeTestProjectBinaries" >
<ItemGroup>
<DisabledProjects Include="TestWrappers*\**\*.csproj" />
<DisabledProjects Include="*\**\cs_template.csproj" />