Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 7856304

Browse files
authored
Merge pull request #10979 from wtgodbe/R2RWindows
Enable running Crossgen tests on Windows in Helix
2 parents 796cd8b + 90f1d5d commit 7856304

File tree

5 files changed

+84
-6
lines changed

5 files changed

+84
-6
lines changed

build-test.cmd

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ set __BuildAgainstPackagesArg=
5858
set __RuntimeId=
5959
set __ZipTests=
6060
set __TargetsWindows=1
61+
set __DoCrossgen=
6162

6263
:Arg_Loop
6364
if "%1" == "" goto ArgsDone
@@ -80,6 +81,7 @@ if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set proc
8081
if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
8182
if /i "%1" == "buildagainstpackages" (set __ZipTests=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
8283
if /i "%1" == "ziptests" (set __ZipTests=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
84+
if /i "%1" == "crossgen" (set __DoCrossgen=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
8385
if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
8486
if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
8587
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
@@ -295,9 +297,13 @@ REM Cleans up any lock folder used for synchronization from last run
295297
powershell "Get-ChildItem -path %__TestWorkingDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
296298

297299
set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
300+
set CORE_ROOT_STAGE=%__TestBinDir%\Tests\Core_Root_Stage
298301
if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
302+
if exist "%CORE_ROOT_STAGE%" rd /s /q "%CORE_ROOT_STAGE%"
299303
md "%CORE_ROOT%"
300-
xcopy /s "%__BinDir%" "%CORE_ROOT%"
304+
md "%CORE_ROOT_STAGE%"
305+
xcopy /s "%__BinDir%" "%CORE_ROOT_STAGE%"
306+
301307

302308
if defined __BuildAgainstPackagesArg (
303309
if "%__TargetsWindows%"=="0" (
@@ -307,8 +313,8 @@ if defined __BuildAgainstPackagesArg (
307313
exit /b 1
308314
)
309315

310-
for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT%
311-
for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT%
316+
for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT_STAGE%
317+
for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT_STAGE%
312318
)
313319
)
314320

@@ -360,6 +366,20 @@ if errorlevel 1 (
360366
exit /b 1
361367
)
362368

369+
xcopy /s /y "%CORE_ROOT_STAGE%" "%CORE_ROOT%"
370+
371+
set __CrossgenArg = ""
372+
if defined __DoCrossgen (
373+
set __CrossgenArg="-Crossgen"
374+
if "%__TargetsWindows%" == "1" (
375+
call :PrecompileFX
376+
) else (
377+
echo "%__MsgPrefix% Crossgen only supported on Windows, for now"
378+
)
379+
)
380+
381+
rd /s /q "%CORE_ROOT_STAGE%"
382+
363383
if not defined __ZipTests goto SkipPrepForPublish
364384

365385
set __BuildLogRootName=Helix_Prep
@@ -376,7 +396,7 @@ REM === Prep test binaries for Helix publishing
376396
REM ===
377397
REM =========================================================================================
378398

379-
call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__unprocessedBuildArgs%
399+
call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__unprocessedBuildArgs%
380400

381401
echo %__MsgPrefix% Prepped test binaries for publishing
382402

@@ -418,6 +438,7 @@ echo ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10
418438
echo win-x64: Builds overlay for portable Windows
419439
echo win7-x64: Builds overlay for Windows 7
420440
echo ziptests: zips CoreCLR tests & Core_Root for a Helix run
441+
echo crossgen: Precompiles the framework managed assemblies
421442
echo Exclude- Optional parameter - specify location of default exclusion file (defaults to tests\issues.targets if not specified)
422443
echo Set to "" to disable default exclusion file.
423444
echo -- ... : all arguments following this tag will be passed directly to msbuild.
@@ -466,3 +487,31 @@ set INCLUDE=^
466487
%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
467488
%__ToolsetDir%\diasdk\include
468489
exit /b 0
490+
491+
:PrecompileFX
492+
for %%F in (%CORE_ROOT%\*.dll) do call :PrecompileAssembly "%%F" %%~nF%%~xF
493+
exit /b 0
494+
495+
REM Compile the managed assemblies in Core_ROOT before running the tests
496+
:PrecompileAssembly
497+
498+
REM Skip mscorlib since it is already precompiled.
499+
if /I "%2" == "mscorlib.dll" exit /b 0
500+
if /I "%2" == "mscorlib.ni.dll" exit /b 0
501+
REM don't precompile anything from CoreCLR
502+
if /I exist %CORE_ROOT_STAGE%\%2 exit /b 0
503+
504+
"%CORE_ROOT_STAGE%\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" "%1" >nul 2>nul
505+
set /a __exitCode = %errorlevel%
506+
if "%__exitCode%" == "-2146230517" (
507+
echo %2 is not a managed assembly.
508+
exit /b 0
509+
)
510+
511+
if %__exitCode% neq 0 (
512+
echo Unable to precompile %2
513+
exit /b 0
514+
)
515+
516+
echo Successfully precompiled %2
517+
exit /b 0

buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
},
6969
"inputs": {
7070
"filename": "build-test.cmd",
71-
"arguments": "$(PB_BuildType) $(Architecture) buildagainstpackages runtimeid $(Rid) $(TargetsNonWindowsArg) -OfficialBuildId=$(OfficialBuildId) -Priority=$(Priority)",
71+
"arguments": "$(PB_BuildType) $(Architecture) buildagainstpackages runtimeid $(Rid) $(TargetsNonWindowsArg) $(CrossgenArg) -OfficialBuildId=$(OfficialBuildId) -Priority=$(Priority)",
7272
"workingFolder": "",
7373
"failOnStandardError": "false"
7474
}
@@ -86,7 +86,7 @@
8686
},
8787
"inputs": {
8888
"filename": "msbuild",
89-
"arguments": "helixpublish.proj /p:CloudDropAccessToken=$(CloudDropAccessToken) /p:CloudDropAccountName=$(CloudDropAccountName) /p:ContainerName=$(PB_ContainerName) /p:Platform=$(Architecture) /p:BuildType=$(PB_BuildType) /p:CloudResultsAccountName=$(CloudResultsAccountName) /p:CloudResultsAccessToken=$(CloudResultsAccessToken) /p:TargetsWindows=$(TargetsWindows) /p:OverwriteOnUpload=true /p:Rid=$(Rid) /p:TargetQueues=\"$(TargetQueues)\" /p:TestProduct=$(TestProduct) /p:Branch=$(HelixBranch) /p:HelixApiAccessKey=$(HelixApiAccessKey) /p:HelixApiEndpoint=$(HelixApiEndpoint) /p:FilterToOSGroup=$(FilterToOSGroup) /p:FilterToTestTFM=$(FilterToTestTFM) /p:TimeoutInSeconds=3600 /fileloggerparameters:Verbosity=diag;LogFile=helix.log",
89+
"arguments": "helixpublish.proj /p:CloudDropAccessToken=$(CloudDropAccessToken) /p:CloudDropAccountName=$(CloudDropAccountName) /p:ContainerName=$(PB_ContainerName) /p:Platform=$(Architecture) /p:BuildType=$(PB_BuildType) /p:CloudResultsAccountName=$(CloudResultsAccountName) /p:CloudResultsAccessToken=$(CloudResultsAccessToken) /p:TargetsWindows=$(TargetsWindows) /p:OverwriteOnUpload=true /p:Rid=$(Rid) /p:TargetQueues=\"$(TargetQueues)\" /p:TestProduct=$(TestProduct) /p:Branch=$(HelixBranch) /p:HelixApiAccessKey=$(HelixApiAccessKey) /p:HelixApiEndpoint=$(HelixApiEndpoint) /p:FilterToOSGroup=$(FilterToOSGroup) /p:FilterToTestTFM=$(FilterToTestTFM) /p:TimeoutInSeconds=1800 /p:HelixJobType=$(HelixJobType) /fileloggerparameters:Verbosity=diag;LogFile=helix.log",
9090
"workingFolder": "tests",
9191
"failOnStandardError": "false"
9292
}

buildpipeline/pipelines.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@
480480
{
481481
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
482482
"Parameters": {
483+
"HelixJobType": "test/functional/cli/",
483484
"TargetsWindows": "true",
484485
"Rid": "win-x64",
485486
"TargetQueues": "windows.10.amd64",
@@ -496,6 +497,25 @@
496497
{
497498
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
498499
"Parameters": {
500+
"HelixJobType": "test/functional/r2r/cli/",
501+
"TargetsWindows": "true",
502+
"Rid": "win-x64",
503+
"TargetQueues": "windows.10.amd64",
504+
"TestContainerSuffix": "windows-r2r",
505+
"TargetsNonWindowsArg": " ",
506+
"CrossgenArg": "Crossgen"
507+
},
508+
"ReportingParameters": {
509+
"OperatingSystem": "Windows",
510+
"SubType": "Build-Tests-R2R",
511+
"Type": "build/product/",
512+
"PB_BuildType": "Release"
513+
}
514+
},
515+
{
516+
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
517+
"Parameters": {
518+
"HelixJobType": "test/functional/cli/",
499519
"TargetsWindows": "false",
500520
"Rid": "osx-x64",
501521
"TargetQueues": "osx.1012.amd64",
@@ -512,6 +532,7 @@
512532
{
513533
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
514534
"Parameters": {
535+
"HelixJobType": "test/functional/cli/",
515536
"TargetsWindows": "false",
516537
"Rid": "linux-x64",
517538
"TargetQueues": "debian.82.amd64,fedora.25.amd64,redhat.72.amd64,ubuntu.1404.amd64,ubuntu.1604.amd64,ubuntu.1610.amd64",

config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@
330330
"values": [ true, false ],
331331
"defaultValue": true
332332
},
333+
"Crossgen": {
334+
"description": "Determines if we're running Crossgen tests",
335+
"valueType": "property",
336+
"values": [ true, false ],
337+
"defaultValue": true
338+
},
333339
"RuntimeId": {
334340
"description": "Specifies the OS to build Core_Root for",
335341
"valueType": "property",

tests/helixprep.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@
7474
Condition="'$(TargetsWindows)' == 'true' ">
7575

7676
<PropertyGroup>
77+
<CrossgenVar Condition="'$(Crossgen)' == 'true'">set RunCrossGen=true</CrossgenVar>
7778
<WrapperCmdContents>
7879
<![CDATA[
7980
@ECHO OFF
8081
setlocal ENABLEDELAYEDEXPANSION
8182
pushd %~dp0
8283
8384
set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD%
85+
$(CrossgenVar)
8486
8587
ECHO BEGIN EXECUTION
8688
ECHO %HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.netcore.exe %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing

0 commit comments

Comments
 (0)