Skip to content

Commit 3174651

Browse files
Remove crossgen from test build and run scripts (#54348)
1 parent f5da499 commit 3174651

File tree

5 files changed

+21
-283
lines changed

5 files changed

+21
-283
lines changed

src/tests/build.cmd

Lines changed: 17 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ set __SkipTestWrappers=
4747
set __BuildTestWrappersOnly=
4848
set __SkipNative=
4949
set __TargetsWindows=1
50-
set __DoCrossgen=
5150
set __DoCrossgen2=
5251
set __CompositeBuildMode=
52+
set __TestBuildMode=
5353
set __CreatePdb=
5454
set __CopyNativeTestBinaries=0
5555
set __CopyNativeProjectsAfterCombinedTestBuild=true
@@ -100,7 +100,6 @@ if /i "%1" == "buildtestwrappersonly" (set __SkipNative=1&set __SkipManaged=1&se
100100

101101
if /i "%1" == "-msbuild" (set __Ninja=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
102102
if /i "%1" == "buildagainstpackages" (echo error: Remove /BuildAgainstPackages switch&&exit /b1)
103-
if /i "%1" == "crossgen" (set __DoCrossgen=1&set __TestBuildMode=crossgen&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
104103
if /i "%1" == "crossgen2" (set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
105104
if /i "%1" == "composite" (set __CompositeBuildMode=1&set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
106105
if /i "%1" == "pdb" (set __CreatePdb=1&shift&goto Arg_Loop)
@@ -506,23 +505,7 @@ REM ============================================================================
506505
if defined __SkipCrossgenFramework goto SkipCrossgen
507506
if defined __BuildTestWrappersOnly goto SkipCrossgen
508507

509-
set __CrossgenArg = ""
510-
if defined __DoCrossgen (
511-
set __CrossgenArg="/p:Crossgen=true"
512-
if "%__TargetsWindows%" == "1" (
513-
echo %__MsgPrefix%Running crossgen on framework assemblies in CORE_ROOT: %CORE_ROOT%
514-
call :PrecompileFX
515-
if ERRORLEVEL 1 (
516-
echo %__ErrMsgPrefix%%__MsgPrefix%Error: crossgen precompilation of framework assemblies failed
517-
exit /b 1
518-
)
519-
) else (
520-
echo "%__MsgPrefix%Crossgen only supported on Windows, for now"
521-
)
522-
)
523-
524508
if defined __DoCrossgen2 (
525-
set __CrossgenArg="/p:Crossgen2=true"
526509
echo %__MsgPrefix%Running crossgen2 on framework assemblies in CORE_ROOT: %CORE_ROOT%
527510
call :PrecompileFX
528511
if ERRORLEVEL 1 (
@@ -555,14 +538,17 @@ echo.
555538
echo.-? -h -help --help: view this message.
556539
echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
557540
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
541+
echo skipgeneratelayout: Do not generate the Core_Root layout
558542
echo skipmanaged: skip the managed tests build
559543
echo skipnative: skip the native tests build
560544
echo skiprestorepackages: skip package restore
561-
echo crossgen: Precompiles the framework managed assemblies
545+
echo skiptestwrappers: skip generating test wrappers
546+
echo buildtestwrappersonly: generate test wrappers without building managed or native test components or generating layouts
562547
echo copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.
563-
echo skipgeneratelayout: Do not generate the Core_Root layout
548+
echo crossgen2: Precompiles the framework managed assemblies
549+
echo composite: Precompiles the framework managed assemblies in composite build mode
550+
echo pdb: create PDB files when precompiling the framework managed assemblies
564551
echo generatelayoutonly: Generate the Core_Root layout without building managed or native test components
565-
echo targetsNonWindows:
566552
echo Exclude- Optional parameter - specify location of default exclusion file ^(defaults to tests\issues.targets if not specified^)
567553
echo Set to "" to disable default exclusion file.
568554
echo -- ... : all arguments following this tag will be passed directly to msbuild.
@@ -591,32 +577,20 @@ if defined __CompositeBuildMode (
591577
)
592578

593579
set __CrossgenDir=%__BinDir%
594-
if defined __DoCrossgen (
595-
if /i "%__BuildArch%" == "arm" (
596-
set __CrossgenDir=!__CrossgenDir!\x86
597-
)
598-
if /i "%__BuildArch%" == "arm64" (
599-
set __CrossgenDir=!__CrossgenDir!\x64
600-
)
601-
set __CrossgenCmd=%__CrossgenCmd% --crossgen --nocrossgen2 --crossgen-path "!__CrossgenDir!\crossgen.exe"
602-
) else (
603-
if /i "%__BuildArch%" == "arm" (
604-
set __CrossgenDir=!__CrossgenDir!\x64
605-
)
606-
if /i "%__BuildArch%" == "arm64" (
607-
set __CrossgenDir=!__CrossgenDir!\x64
608-
)
609-
if /i "%__BuildArch%" == "x86" (
610-
set __CrossgenDir=!__CrossgenDir!\x64
611-
)
612-
set __CrossgenCmd=%__CrossgenCmd% --verify-type-and-field-layout --crossgen2-path "!__CrossgenDir!\crossgen2\crossgen2.dll"
580+
if /i "%__BuildArch%" == "arm" (
581+
set __CrossgenDir=!__CrossgenDir!\x64
582+
)
583+
if /i "%__BuildArch%" == "arm64" (
584+
set __CrossgenDir=!__CrossgenDir!\x64
613585
)
586+
if /i "%__BuildArch%" == "x86" (
587+
set __CrossgenDir=!__CrossgenDir!\x64
588+
)
589+
set __CrossgenCmd=%__CrossgenCmd% --verify-type-and-field-layout --crossgen2-path "!__CrossgenDir!\crossgen2\crossgen2.dll"
614590

615591
echo Running %__CrossgenCmd%
616592
call %__CrossgenCmd%
617-
set /a __exitCode = !errorlevel!
618-
619-
if %__exitCode% neq 0 (
593+
if %errorlevel% neq 0 (
620594
echo Failed to crossgen the framework
621595
exit /b 1
622596
)

src/tests/build.sh

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ generate_layout()
133133
build_MSBuild_projects "Tests_Overlay_Managed" "$__RepoRootDir/src/tests/run.proj" "Creating test overlay" "/t:CreateTestOverlay"
134134

135135
# Precompile framework assemblies with crossgen if required
136-
if [[ "$__DoCrossgen" != 0 || "$__DoCrossgen2" != 0 ]]; then
137-
chmod +x "$__CrossgenExe"
136+
if [[ "$__DoCrossgen2" != 0 ]]; then
138137
if [[ "$__SkipCrossgenFramework" == 0 ]]; then
139138
precompile_coreroot_fx
140139
fi
@@ -171,11 +170,7 @@ precompile_coreroot_fx()
171170
crossgenDir="$crossgenDir/$__HostArch"
172171
fi
173172

174-
if [[ "$__DoCrossgen" != 0 ]]; then
175-
crossgenCmd="$crossgenCmd --crossgen --nocrossgen2 --crossgen-path \"$crossgenDir/crossgen\""
176-
else
177-
crossgenCmd="$crossgenCmd --verify-type-and-field-layout --crossgen2-path \"$crossgenDir/crossgen2/crossgen2.dll\""
178-
fi
173+
crossgenCmd="$crossgenCmd --verify-type-and-field-layout --crossgen2-path \"$crossgenDir/crossgen2/crossgen2.dll\""
179174

180175
echo "Running $crossgenCmd"
181176
eval $crossgenCmd
@@ -191,17 +186,6 @@ precompile_coreroot_fx()
191186
return 0
192187
}
193188

194-
declare -a skipCrossGenFiles
195-
196-
function is_skip_crossgen_test {
197-
for skip in "${skipCrossGenFiles[@]}"; do
198-
if [[ "$1" == "$skip" ]]; then
199-
return 0
200-
fi
201-
done
202-
return 1
203-
}
204-
205189
build_Tests()
206190
{
207191
echo "${__MsgPrefix}Building Tests..."
@@ -447,7 +431,6 @@ usage_list+=("-buildtestwrappersonly: only build the test wrappers.")
447431
usage_list+=("-copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.")
448432
usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroot.")
449433

450-
usage_list+=("-crossgen: Precompiles the framework managed assemblies in coreroot.")
451434
usage_list+=("-crossgen2: Precompiles the framework managed assemblies in coreroot using the Crossgen2 compiler.")
452435
usage_list+=("-priority1: include priority=1 tests in the build.")
453436
usage_list+=("-allTargets: Build managed tests for all target platforms.")
@@ -480,11 +463,6 @@ handle_arguments_local() {
480463
__SkipCrossgenFramework=1
481464
;;
482465

483-
crossgen|-crossgen)
484-
__DoCrossgen=1
485-
__TestBuildMode=crossgen
486-
;;
487-
488466
crossgen2|-crossgen2)
489467
__DoCrossgen2=1
490468
__TestBuildMode=crossgen2
@@ -559,9 +537,9 @@ __CopyNativeProjectsAfterCombinedTestBuild=true
559537
__CopyNativeTestBinaries=0
560538
__CrossBuild=0
561539
__DistroRid=""
562-
__DoCrossgen=0
563540
__DoCrossgen2=0
564541
__CompositeBuildMode=0
542+
__TestBuildMode=
565543
__DotNetCli="$__RepoRootDir/dotnet.sh"
566544
__GenerateLayoutOnly=
567545
__IsMSBuildOnNETCoreSupported=0
@@ -607,18 +585,9 @@ __TestDir="$__RepoRootDir/src/tests"
607585
__TestWorkingDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
608586
__IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
609587
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
610-
__CrossComponentBinDir="$__BinDir"
611588
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
612589
__MonoBinDir="$__RootBinDir/bin/mono/$__OSPlatformConfig"
613590

614-
__CrossArch="$__HostArch"
615-
if [[ "$__CrossBuild" == 1 ]]; then
616-
__CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
617-
fi
618-
__CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__TargetOS.$BuildArch.$__BuildType.log"
619-
__CrossgenExe="$__CrossComponentBinDir/crossgen"
620-
__Crossgen2Dll="$__CrossComponentBinDir/crossgen2/crossgen2.dll"
621-
622591
# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
623592
# This is needed by CLI to function.
624593
if [[ -z "$HOME" ]]; then

src/tests/run.cmd

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ set __msbuildExtraArgs=
2626
set __LongGCTests=
2727
set __GCSimulatorTests=
2828
set __IlasmRoundTrip=
29-
set __DoCrossgen=
30-
set __CrossgenAltJit=
3129
set __PrintLastResultsOnly=
3230
set RunInUnloadableContext=
3331

@@ -50,13 +48,8 @@ if /i "%1" == "debug" (set __BuildType=Debug&s
5048
if /i "%1" == "release" (set __BuildType=Release&shift&goto Arg_Loop)
5149
if /i "%1" == "checked" (set __BuildType=Checked&shift&goto Arg_Loop)
5250

53-
if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop)
54-
if /i "%1" == "vs2019" (set __VSVersion=%1&shift&goto Arg_Loop)
55-
5651
if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
5752
if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop)
58-
if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop)
59-
if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop)
6053
if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop)
6154
if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop)
6255
if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop)
@@ -66,10 +59,8 @@ if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs
6659
if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop)
6760

6861
if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop)
69-
if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop)
7062
if /i "%1" == "runcrossgen2tests" (set RunCrossGen2=true&shift&goto Arg_Loop)
7163
REM This test feature is currently intentionally undocumented
72-
if /i "%1" == "runlargeversionbubblecrossgentests" (set RunCrossGen=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop)
7364
if /i "%1" == "runlargeversionbubblecrossgen2tests" (set RunCrossGen2=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop)
7465
if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop)
7566
if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop)
@@ -138,18 +129,10 @@ if defined __Sequential (
138129
set __RuntestPyArgs=%__RuntestPyArgs% --sequential
139130
)
140131

141-
if defined RunCrossGen (
142-
set __RuntestPyArgs=%__RuntestPyArgs% --run_crossgen_tests
143-
)
144-
145132
if defined RunCrossGen2 (
146133
set __RuntestPyArgs=%__RuntestPyArgs% --run_crossgen2_tests
147134
)
148135

149-
if defined __DoCrossgen (
150-
set __RuntestPyArgs=%__RuntestPyArgs% --precompile_core_root
151-
)
152-
153136
if defined CrossgenLargeVersionBubble (
154137
set __RuntestPyArgs=%__RuntestPyArgs% --large_version_bubble
155138
)
@@ -242,14 +225,6 @@ call :SetTestEnvironment
242225
call :ResolveDependencies
243226
if errorlevel 1 exit /b 1
244227

245-
if defined __DoCrossgen (
246-
echo %__MsgPrefix%Running crossgen on framework assemblies
247-
call :PrecompileFX
248-
)
249-
250-
REM Delete the unecessary mscorlib.ni file.
251-
if exist %CORE_ROOT%\mscorlib.ni.dll del %CORE_ROOT%\mscorlib.ni.dll
252-
253228
::Check if the test Binaries are built
254229
if not exist %XunitTestBinBase% (
255230
echo %__MsgPrefix%Error: Ensure the Test Binaries are built and are present at %XunitTestBinBase%.
@@ -286,52 +261,6 @@ echo %__TestRunHtmlLog%
286261
echo %__TestRunXmlLog%
287262
exit /b 0
288263

289-
REM =========================================================================================
290-
REM ===
291-
REM === Compile the managed assemblies in Core_ROOT before running the tests
292-
REM ===
293-
REM =========================================================================================
294-
295-
:PrecompileAssembly
296-
297-
REM Skip mscorlib since it is already precompiled.
298-
if /I "%3" == "mscorlib.dll" exit /b 0
299-
if /I "%3" == "mscorlib.ni.dll" exit /b 0
300-
301-
"%1\crossgen.exe" /nologo /Platform_Assemblies_Paths "%CORE_ROOT%" "%2" >nul 2>nul
302-
set /a __exitCode = %errorlevel%
303-
if "%__exitCode%" == "-2146230517" (
304-
echo %2 is not a managed assembly.
305-
exit /b 0
306-
)
307-
308-
if %__exitCode% neq 0 (
309-
echo Unable to precompile %2
310-
exit /b 0
311-
)
312-
313-
echo %__MsgPrefix%Successfully precompiled %2
314-
exit /b 0
315-
316-
:PrecompileFX
317-
setlocal
318-
319-
if defined __CrossgenAltJit (
320-
REM Set altjit flags for the crossgen run. Note that this entire crossgen section is within a setlocal/endlocal scope,
321-
REM so we don't need to save or unset these afterwards.
322-
echo %__MsgPrefix%Setting altjit environment variables for %__CrossgenAltJit%.
323-
set COMPlus_AltJit=*
324-
set COMPlus_AltJitNgen=*
325-
set COMPlus_AltJitName=%__CrossgenAltJit%
326-
set COMPlus_AltJitAssertOnNYI=1
327-
set COMPlus_NoGuiOnAssert=1
328-
set COMPlus_ContinueOnAssert=0
329-
)
330-
331-
for %%F in (%CORE_ROOT%\*.dll) do call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nF%%~xF
332-
endlocal
333-
exit /b 0
334-
335264
REM =========================================================================================
336265
REM ===
337266
REM === Subroutine to invoke msbuild.
@@ -447,12 +376,8 @@ echo.
447376
echo./? -? /h -h /help -help - View this message.
448377
echo ^<build_architecture^> - Specifies build architecture: x64, x86, arm, or arm64 ^(default: x64^).
449378
echo ^<build_type^> - Specifies build type: Debug, Release, or Checked ^(default: Debug^).
450-
echo VSVersion ^<vs_version^> - VS2017 or VS2019 ^(default: VS2019^).
451379
echo TestEnv ^<test_env_script^> - Run a custom script before every test to set custom test environment settings.
452380
echo sequential - Run tests sequentially (no parallelism).
453-
echo crossgen - Precompile ^(crossgen^) the managed assemblies in CORE_ROOT before running the tests.
454-
echo crossgenaltjit ^<altjit^> - Precompile ^(crossgen^) the managed assemblies in CORE_ROOT before running the tests, using the given altjit.
455-
echo RunCrossgenTests - Runs ReadytoRun tests
456381
echo RunCrossgen2Tests - Runs ReadytoRun tests compiled with Crossgen2
457382
echo jitstress ^<n^> - Runs the tests with COMPlus_JitStress=n
458383
echo jitstressregs ^<n^> - Runs the tests with COMPlus_JitStressRegs=n

0 commit comments

Comments
 (0)