1 @if not defined _echo @echo off
2 setlocal EnableDelayedExpansion EnableExtensions
4 :: Define a prefix for most output progress messages that come from this script. That makes
5 :: it easier to see where these are coming from. Note that there is a trailing space here.
6 set "__MsgPrefix=BUILDTEST: "
8 echo %__MsgPrefix%Starting Build at %TIME%
10 set __ThisScriptDir="%~dp0"
12 call "%__ThisScriptDir%"\setup_vs_tools.cmd
13 if NOT '%ERRORLEVEL%' == '0' exit /b 1
15 if defined VS160COMNTOOLS (
16 set "__VSToolsRoot=%VS160COMNTOOLS%"
17 set "__VCToolsRoot=%VS160COMNTOOLS%\..\..\VC\Auxiliary\Build"
18 set __VSVersion=vs2019
19 ) else if defined VS150COMNTOOLS (
20 set "__VSToolsRoot=%VS150COMNTOOLS%"
21 set "__VCToolsRoot=%VS150COMNTOOLS%\..\..\VC\Auxiliary\Build"
22 set __VSVersion=vs2017
25 :: Set the default arguments for build
28 set __BuildOS=Windows_NT
30 set "__ProjectDir=%~dp0"
31 :: remove trailing slash
32 if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
33 set "__TestDir=%__ProjectDir%\tests"
34 set "__ProjectFilesDir=%__TestDir%"
35 set "__SourceDir=%__ProjectDir%\src"
36 set "__PackagesDir=%__ProjectDir%\.packages"
37 set "__RootBinDir=%__ProjectDir%\bin"
38 set "__LogsDir=%__RootBinDir%\Logs"
39 set "__MsbuildDebugLogsDir=%__LogsDir%\MsbuildDebugLogs"
41 :: Default __Exclude to issues.targets
42 set __Exclude=%__TestDir%\issues.targets
44 REM __UnprocessedBuildArgs are args that we pass to msbuild (e.g. /p:__BuildArch=x64)
47 set __UnprocessedBuildArgs=
48 set __CommonMSBuildArgs=
50 set __SkipRestorePackages=
54 set __TargetsWindows=1
57 @REM CMD has a nasty habit of eating "=" on the argument list, so passing:
59 @REM appears to CMD parsing as "-priority 1". Handle -priority specially to avoid problems,
60 @REM and allow the "-priority=1" syntax.
65 if "%1" == "" goto ArgsDone
67 if /i "%1" == "/?" goto Usage
68 if /i "%1" == "-?" goto Usage
69 if /i "%1" == "/h" goto Usage
70 if /i "%1" == "-h" goto Usage
71 if /i "%1" == "/help" goto Usage
72 if /i "%1" == "-help" goto Usage
73 if /i "%1" == "--help" goto Usage
75 if /i "%1" == "x64" (set __BuildArch=x64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
76 if /i "%1" == "x86" (set __BuildArch=x86&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
77 if /i "%1" == "arm" (set __BuildArch=arm&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
78 if /i "%1" == "arm64" (set __BuildArch=arm64&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
80 if /i "%1" == "debug" (set __BuildType=Debug&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
81 if /i "%1" == "release" (set __BuildType=Release&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
82 if /i "%1" == "checked" (set __BuildType=Checked&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
84 if /i "%1" == "skipmanaged" (set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
85 if /i "%1" == "skipnative" (set __SkipNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
86 if /i "%1" == "buildtesthostonly" (set __SkipNative=1&set __SkipManaged=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
87 if /i "%1" == "buildagainstpackages" (echo error: Remove /BuildAgainstPackages switch&&exit /b1)
88 if /i "%1" == "skiprestorepackages" (set __SkipRestorePackages=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
89 if /i "%1" == "crossgen" (set __DoCrossgen=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
90 if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
91 if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
92 if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
93 if /i "%1" == "-priority" (set __Priority=%2&shift&set processedArgs=!processedArgs! %1=%2&shift&goto Arg_Loop)
94 if /i "%1" == "--" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
96 if [!processedArgs!]==[] (
97 set __UnprocessedBuildArgs=%__args%
99 set __UnprocessedBuildArgs=%__args%
100 for %%t in (!processedArgs!) do (
101 set __UnprocessedBuildArgs=!__UnprocessedBuildArgs:*%%t=!
107 @REM Special handling for -priority=N argument.
108 if %__Priority% GTR 0 (
109 set "__PriorityArg=/p:CLRTestPriorityToBuild=%__Priority%"
112 set TargetsWindowsArg=
113 set TargetsWindowsMsbuildArg=
114 if "%__TargetsWindows%"=="1" (
115 set TargetsWindowsArg=-TargetsWindows=true
116 set TargetsWindowsMsbuildArg=/p:TargetsWindows=true
117 ) else if "%__TargetsWindows%"=="0" (
118 set TargetsWindowsArg=-TargetsWindows=false
119 set TargetsWindowsMsbuildArg=/p:TargetsWindows=false
122 @if defined _echo @echo on
124 set __CommonMSBuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch%
125 REM As we move from buildtools to arcade, __RunArgs should be replaced with __msbuildArgs
126 set __msbuildArgs=/p:__BuildOS=%__BuildOS% /p:__BuildType=%__BuildType% /p:__BuildArch=%__BuildArch% /nologo /verbosity:minimal /clp:Summary /maxcpucount
128 echo %__MsgPrefix%Commencing CoreCLR test build
130 set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
131 set "__TestRootDir=%__RootBinDir%\tests"
132 set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
134 REM We have different managed and native intermediate dirs because the managed bits will include
135 REM the configuration information deeper in the intermediates path.
136 REM These variables are used by the msbuild project files.
138 if not defined __TestIntermediateDir (
139 set "__TestIntermediateDir=tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
141 set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Native"
142 set "__ManagedTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Managed"
144 REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
145 set "__CMakeBinDir=%__TestBinDir%"
146 set "__CMakeBinDir=%__CMakeBinDir:\=/%"
148 if not exist "%__TestBinDir%" md "%__TestBinDir%"
149 if not exist "%__NativeTestIntermediatesDir%" md "%__NativeTestIntermediatesDir%"
150 if not exist "%__ManagedTestIntermediatesDir%" md "%__ManagedTestIntermediatesDir%"
151 if not exist "%__LogsDir%" md "%__LogsDir%"
152 if not exist "%__MsbuildDebugLogsDir%" md "%__MsbuildDebugLogsDir%"
154 REM Set up the directory for MSBuild debug logs.
155 set MSBUILDDEBUGPATH=%__MsbuildDebugLogsDir%
157 echo %__MsgPrefix%Checking prerequisites
159 REM Eval the output from set-cmake-path.ps1
160 for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\set-cmake-path.ps1"""') do %%a
162 REM =========================================================================================
164 REM === Restore Build Tools
166 REM =========================================================================================
168 call "%__ProjectDir%\init-tools.cmd"
169 if NOT [%ERRORLEVEL%]==[0] (
172 @if defined _echo @echo on
174 set "__ToolsDir=%__ProjectDir%\Tools"
176 REM =========================================================================================
178 REM === Resolve runtime dependences
180 REM =========================================================================================
182 call "%__TestDir%\setup-stress-dependencies.cmd" /arch %__BuildArch% /outputdir %__BinDir%
183 @if defined _echo @echo on
185 REM =========================================================================================
187 REM === Native test build section
189 REM =========================================================================================
191 if defined __SkipNative goto skipnative
193 echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType%
195 REM Set the environment for the native build
196 set __VCBuildArch=x86_amd64
197 if /i "%__BuildArch%" == "x86" ( set __VCBuildArch=x86 )
198 if /i "%__BuildArch%" == "arm" ( set __VCBuildArch=x86_arm )
199 if /i "%__BuildArch%" == "arm64" ( set __VCBuildArch=x86_arm64 )
201 echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
202 call "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
203 @if defined _echo @echo on
205 if not defined VSINSTALLDIR (
206 echo %__MsgPrefix%Error: VSINSTALLDIR variable not defined.
209 if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA
211 pushd "%__NativeTestIntermediatesDir%"
212 set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0"
213 call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" ""%__ProjectFilesDir%"" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
214 @if defined _echo @echo on
217 if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" (
218 echo %__MsgPrefix%Failed to generate test native component build project!
222 set __BuildLogRootName=Tests_Native
223 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
224 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
225 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
226 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
227 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
228 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
229 set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
231 call "%__ProjectDir%\cmake_msbuild.cmd" /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
232 /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
233 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
234 /p:UsePartialNGENOptimization=false /maxcpucount^
235 "%__NativeTestIntermediatesDir%\install.vcxproj"^
236 !__Logging! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__CommonMSBuildArgs% %__PriorityArg% %__UnprocessedBuildArgs%
238 echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
247 REM =========================================================================================
249 REM === Restore product binaries from packages
251 REM =========================================================================================
253 if "%__SkipRestorePackages%" == 1 goto SkipRestoreProduct
255 echo %__MsgPrefix%Restoring CoreCLR product from packages
257 if not defined XunitTestBinBase set XunitTestBinBase=%__TestBinDir%
258 set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
260 set __BuildLogRootName=Restore_Product
261 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
262 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
263 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
264 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
265 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
266 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
267 set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
269 call "%__ProjectDir%\dotnet.cmd" msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
270 /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
271 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
272 /p:UsePartialNGENOptimization=false /maxcpucount^
273 %__ProjectDir%\tests\build.proj /t:BatchRestorePackages^
274 !__Logging! %__CommonMSBuildArgs% %__PriorityArg% %__UnprocessedBuildArgs%
278 REM =========================================================================================
280 REM === Managed test build section
282 REM =========================================================================================
284 if defined __SkipManaged goto SkipManagedBuild
286 echo %__MsgPrefix%Starting the Managed Tests Build
288 if not defined VSINSTALLDIR (
289 echo %__MsgPrefix%Error: build-test.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions.
292 set __AppendToLog=false
293 set __BuildLogRootName=Tests_Managed
294 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
295 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
296 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
298 REM Execute msbuild test build in stages - workaround for excessive data retention in MSBuild ConfigCache
299 REM See https://github.com/Microsoft/msbuild/issues/2993
301 set __SkipPackageRestore=false
302 set __SkipTargetingPackBuild=false
303 set __NumberOfTestGroups=3
305 if %__Priority% GTR 0 (set __NumberOfTestGroups=10)
306 echo %__MsgPrefix%Building tests divided into %__NumberOfTestGroups% test groups
308 for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
310 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
311 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%";Append=!__AppendToLog!
312 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%";Append=!__AppendToLog!
314 set __TestGroupToBuild=%%G
315 echo Running: msbuild %__ProjectDir%\tests\build.proj !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
317 call "%__ProjectDir%\dotnet.cmd" msbuild %__ProjectDir%\tests\build.proj !__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! %TargetsWindowsMsbuildArg% %__msbuildArgs% !__PriorityArg! %__UnprocessedBuildArgs%
320 echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
324 REM This is necessary because of a(n apparent) bug in the FOR /L command. Under certain circumstances,
325 REM such as when this script is invoke with CMD /C "build-test.cmd", a non-zero exit directly from
326 REM within the loop body will not propagate to the caller. For some reason, goto works around it.
330 set __SkipPackageRestore=true
331 set __SkipTargetingPackBuild=true
332 set __AppendToLog=true
335 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
336 REM drastically fewer Pri-1 tests than expected.
337 echo %__MsgPrefix%Check the managed tests build
338 echo Running: dotnet msbuild %__ProjectDir%\tests\runtest.proj /t:CheckTestBuild /p:CLRTestPriorityToBuild=%__Priority% %__msbuildArgs% %__unprocessedBuildArgs%
339 call "%__ProjectDir%\dotnet.cmd" msbuild %__ProjectDir%\tests\runtest.proj /t:CheckTestBuild /p:CLRTestPriorityToBuild=%__Priority% %__msbuildArgs% %__unprocessedBuildArgs%
341 echo %__MsgPrefix%Error: build failed.
347 REM =========================================================================================
349 REM === Prepare the test drop
351 REM =========================================================================================
353 echo %__MsgPrefix%Removing 'ni' files and 'lock' folders from %__TestBinDir%
354 REM Remove any NI from previous runs.
355 powershell -NoProfile "Get-ChildItem -path %__TestBinDir% -Include '*.ni.*' -Recurse -Force | Remove-Item -force"
356 REM Remove any lock folder used for synchronization from previous runs.
357 powershell -NoProfile "Get-ChildItem -path %__TestBinDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
359 set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
360 set CORE_ROOT_STAGE=%__TestBinDir%\Tests\Core_Root_Stage
361 if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
362 if exist "%CORE_ROOT_STAGE%" rd /s /q "%CORE_ROOT_STAGE%"
364 md "%CORE_ROOT_STAGE%"
365 xcopy /s "%__BinDir%" "%CORE_ROOT_STAGE%"
367 REM =========================================================================================
369 REM === Create the test overlay
371 REM =========================================================================================
373 echo %__MsgPrefix%Creating test overlay
376 if defined __RuntimeId (
377 set RuntimeIdArg=/p:RuntimeId="%__RuntimeId%"
380 set __BuildLogRootName=Tests_Overlay_Managed
381 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
382 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
383 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
384 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
385 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
386 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
387 set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
389 call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
390 /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
391 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
392 /p:UsePartialNGENOptimization=false /maxcpucount^
393 %__ProjectDir%\tests\runtest.proj /t:CreateTestOverlay^
394 !__Logging! %__CommonMSBuildArgs% %RuntimeIdArg% %__PriorityArg% %__UnprocessedBuildArgs%
396 echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
403 xcopy /s /y "%CORE_ROOT_STAGE%" "%CORE_ROOT%"
405 REM =========================================================================================
407 REM === Create the test host necessary for running CoreFX tests.
408 REM === The test host includes a dotnet executable, system libraries and CoreCLR assemblies found in CORE_ROOT.
410 REM =========================================================================================
412 echo %__MsgPrefix%Building CoreFX test host
414 set __BuildLogRootName=Tests_CoreFX_Testhost
415 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
416 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
417 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
418 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
419 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
420 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
421 set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
423 call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^
424 /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^
425 /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^
426 /p:UsePartialNGENOptimization=false /maxcpucount^
427 %__ProjectDir%\tests\runtest.proj /t:CreateTestHost^
428 !__Logging! %__CommonMSBuildArgs% %RuntimeIdArg% %__PriorityArg% %__UnprocessedBuildArgs%
430 echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
437 REM =========================================================================================
439 REM === Create test wrappers.
441 REM =========================================================================================
443 if defined __SkipManaged goto SkipBuildingWrappers
445 echo %__MsgPrefix%Creating test wrappers
447 set __BuildLogRootName=Tests_XunitWrapper
448 set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
449 set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
450 set __BuildErr=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.err
451 set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
452 set __MsbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
453 set __MsbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
454 set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
456 REM Build wrappers using the local SDK's msbuild. As we move to arcade, the other builds should be moved away from run.exe as well.
457 call "%__ProjectDir%\dotnet.cmd" msbuild %__ProjectDir%\tests\runtest.proj /p:RestoreAdditionalProjectSources=https://dotnet.myget.org/F/dotnet-core/ /p:BuildWrappers=true !__Logging! %__msbuildArgs% %TargetsWindowsMsbuildArg% %__UnprocessedBuildArgs%
459 echo %__MsgPrefix%Error: Xunit wrapper build failed. Refer to the build log files for details:
466 echo { "build_os": "%__BuildOS%", "build_arch": "%__BuildArch%", "build_type": "%__BuildType%" } > "%__TestBinDir%/build_info.json"
468 :SkipBuildingWrappers
470 REM =========================================================================================
472 REM === Crossgen assemblies if needed.
474 REM =========================================================================================
476 set __CrossgenArg = ""
477 if defined __DoCrossgen (
478 set __CrossgenArg="/p:Crossgen=true"
479 if "%__TargetsWindows%" == "1" (
480 echo %__MsgPrefix%Running crossgen on framework assemblies
483 echo "%__MsgPrefix%Crossgen only supported on Windows, for now"
487 rd /s /q "%CORE_ROOT_STAGE%"
489 REM =========================================================================================
491 REM === All builds complete!
493 REM =========================================================================================
495 echo %__MsgPrefix%Test build succeeded. Finished at %TIME%
496 echo %__MsgPrefix%Test binaries are available at !__TestBinDir!
501 echo Build the CoreCLR tests.
504 echo %0 [option1] [option2] ...
505 echo All arguments are optional. Options are case-insensitive. The options are:
507 echo.-? -h -help --help: view this message.
508 echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
509 echo Build type: one of Debug, Checked, Release ^(default: Debug^).
510 echo skipmanaged: skip the managed tests build
511 echo skipnative: skip the native tests build
512 echo buildtesthostonly: build the CoreFX testhost only
513 echo skiprestorepackages: skip package restore
514 echo runtimeid ^<ID^>: Builds a test overlay for the specified OS ^(Only supported when building against packages^). Supported IDs are:
515 echo alpine.3.4.3-x64: Builds overlay for Alpine 3.4.3
516 echo debian.8-x64: Builds overlay for Debian 8
517 echo fedora.24-x64: Builds overlay for Fedora 24
518 echo linux-x64: Builds overlay for portable linux
519 echo opensuse.42.1-x64: Builds overlay for OpenSUSE 42.1
520 echo osx.10.12-x64: Builds overlay for OSX 10.12
521 echo osx-x64: Builds overlay for portable OSX
522 echo rhel.7-x64: Builds overlay for RHEL 7 or CentOS
523 echo ubuntu.14.04-x64: Builds overlay for Ubuntu 14.04
524 echo ubuntu.16.04-x64: Builds overlay for Ubuntu 16.04
525 echo ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10
526 echo win-x64: Builds overlay for portable Windows
527 echo win7-x64: Builds overlay for Windows 7
528 echo crossgen: Precompiles the framework managed assemblies
529 echo targetsNonWindows:
530 echo Exclude- Optional parameter - specify location of default exclusion file ^(defaults to tests\issues.targets if not specified^)
531 echo Set to "" to disable default exclusion file.
532 echo -- ... : all arguments following this tag will be passed directly to msbuild.
533 echo -priority=^<N^> : specify a set of tests that will be built and run, with priority N.
534 echo 0: Build only priority 0 cases as essential testcases (default)
535 echo 1: Build all tests with priority 0 and 1
536 echo 666: Build all tests with priority 0, 1 ... 666
537 echo -verbose: enables detailed file logging for the msbuild tasks into the msbuild log file.
541 echo Error: DIA SDK is missing at "%VSINSTALLDIR%DIA SDK". ^
542 This is due to a bug in the Visual Studio installer. It does not install DIA SDK at "%VSINSTALLDIR%" but rather ^
543 at the install location of previous Visual Studio version. The workaround is to copy the DIA SDK folder from the Visual Studio install location ^
544 of the previous version to "%VSINSTALLDIR%" and then build.
545 REM DIA SDK not included in Express editions
546 echo Visual Studio Express does not include the DIA SDK. ^
547 You need Visual Studio 2017 or 2019 (Community is free).
548 echo See: https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md#prerequisites
552 for %%F in (%CORE_ROOT%\*.dll) do call :PrecompileAssembly "%%F" %%~nF%%~xF
555 REM Compile the managed assemblies in Core_ROOT before running the tests
558 REM Skip mscorlib since it is already precompiled.
559 if /I "%2" == "mscorlib.dll" exit /b 0
560 if /I "%2" == "mscorlib.ni.dll" exit /b 0
561 REM don't precompile anything from CoreCLR
562 if /I exist %CORE_ROOT_STAGE%\%2 exit /b 0
564 REM Don't precompile xunit.* files
565 echo "%2" | findstr /b "xunit." >nul && (
569 set __CrossgenExe="%CORE_ROOT_STAGE%\crossgen.exe"
570 if /i "%__BuildArch%" == "arm" ( set __CrossgenExe="%CORE_ROOT_STAGE%\x86\crossgen.exe" )
571 if /i "%__BuildArch%" == "arm64" ( set __CrossgenExe="%CORE_ROOT_STAGE%\x64\crossgen.exe" )
573 "%__CrossgenExe%" /Platform_Assemblies_Paths "%CORE_ROOT%" /in "%1" /out "%CORE_ROOT%/temp.ni.dll" >nul 2>nul
574 set /a __exitCode = %errorlevel%
575 if "%__exitCode%" == "-2146230517" (
576 echo %2 is not a managed assembly.
580 if %__exitCode% neq 0 (
581 echo Unable to precompile %2, Exit Code is %__exitCode%
585 REM Delete original .dll & replace it with the Crossgened .dll
587 ren "%CORE_ROOT%\temp.ni.dll" %2
589 echo Successfully precompiled %2