Skip to content
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
60 changes: 17 additions & 43 deletions src/tests/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ set __SkipTestWrappers=
set __BuildTestWrappersOnly=
set __SkipNative=
set __TargetsWindows=1
set __DoCrossgen=
set __DoCrossgen2=
set __CompositeBuildMode=
set __TestBuildMode=
set __CreatePdb=
set __CopyNativeTestBinaries=0
set __CopyNativeProjectsAfterCombinedTestBuild=true
Expand Down Expand Up @@ -100,7 +100,6 @@ if /i "%1" == "buildtestwrappersonly" (set __SkipNative=1&set __SkipManaged=1&se

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

set __CrossgenArg = ""
if defined __DoCrossgen (
set __CrossgenArg="/p:Crossgen=true"
if "%__TargetsWindows%" == "1" (
echo %__MsgPrefix%Running crossgen on framework assemblies in CORE_ROOT: %CORE_ROOT%
call :PrecompileFX
if ERRORLEVEL 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: crossgen precompilation of framework assemblies failed
exit /b 1
)
) else (
echo "%__MsgPrefix%Crossgen only supported on Windows, for now"
)
)

if defined __DoCrossgen2 (
set __CrossgenArg="/p:Crossgen2=true"
echo %__MsgPrefix%Running crossgen2 on framework assemblies in CORE_ROOT: %CORE_ROOT%
call :PrecompileFX
if ERRORLEVEL 1 (
Expand Down Expand Up @@ -555,14 +538,17 @@ echo.
echo.-? -h -help --help: view this message.
echo Build architecture: one of x64, x86, arm, arm64 ^(default: x64^).
echo Build type: one of Debug, Checked, Release ^(default: Debug^).
echo skipgeneratelayout: Do not generate the Core_Root layout
echo skipmanaged: skip the managed tests build
echo skipnative: skip the native tests build
echo skiprestorepackages: skip package restore
echo crossgen: Precompiles the framework managed assemblies
echo skiptestwrappers: skip generating test wrappers
echo buildtestwrappersonly: generate test wrappers without building managed or native test components or generating layouts
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
echo crossgen2: Precompiles the framework managed assemblies
echo composite: Precompiles the framework managed assemblies in composite build mode
echo pdb: create PDB files when precompiling the framework managed assemblies
echo generatelayoutonly: Generate the Core_Root layout without building managed or native test components
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.
echo -- ... : all arguments following this tag will be passed directly to msbuild.
Expand Down Expand Up @@ -591,32 +577,20 @@ if defined __CompositeBuildMode (
)

set __CrossgenDir=%__BinDir%
if defined __DoCrossgen (
if /i "%__BuildArch%" == "arm" (
set __CrossgenDir=!__CrossgenDir!\x86
)
if /i "%__BuildArch%" == "arm64" (
set __CrossgenDir=!__CrossgenDir!\x64
)
set __CrossgenCmd=%__CrossgenCmd% --crossgen --nocrossgen2 --crossgen-path "!__CrossgenDir!\crossgen.exe"
) else (
if /i "%__BuildArch%" == "arm" (
set __CrossgenDir=!__CrossgenDir!\x64
)
if /i "%__BuildArch%" == "arm64" (
set __CrossgenDir=!__CrossgenDir!\x64
)
if /i "%__BuildArch%" == "x86" (
set __CrossgenDir=!__CrossgenDir!\x64
)
set __CrossgenCmd=%__CrossgenCmd% --verify-type-and-field-layout --crossgen2-path "!__CrossgenDir!\crossgen2\crossgen2.dll"
if /i "%__BuildArch%" == "arm" (
set __CrossgenDir=!__CrossgenDir!\x64
)
if /i "%__BuildArch%" == "arm64" (
set __CrossgenDir=!__CrossgenDir!\x64
)
if /i "%__BuildArch%" == "x86" (
set __CrossgenDir=!__CrossgenDir!\x64
)
set __CrossgenCmd=%__CrossgenCmd% --verify-type-and-field-layout --crossgen2-path "!__CrossgenDir!\crossgen2\crossgen2.dll"

echo Running %__CrossgenCmd%
call %__CrossgenCmd%
set /a __exitCode = !errorlevel!

if %__exitCode% neq 0 (
if %errorlevel% neq 0 (
echo Failed to crossgen the framework
exit /b 1
)
Expand Down
37 changes: 3 additions & 34 deletions src/tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ generate_layout()
build_MSBuild_projects "Tests_Overlay_Managed" "$__RepoRootDir/src/tests/run.proj" "Creating test overlay" "/t:CreateTestOverlay"

# Precompile framework assemblies with crossgen if required
if [[ "$__DoCrossgen" != 0 || "$__DoCrossgen2" != 0 ]]; then
chmod +x "$__CrossgenExe"
if [[ "$__DoCrossgen2" != 0 ]]; then
if [[ "$__SkipCrossgenFramework" == 0 ]]; then
precompile_coreroot_fx
fi
Expand Down Expand Up @@ -171,11 +170,7 @@ precompile_coreroot_fx()
crossgenDir="$crossgenDir/$__HostArch"
fi

if [[ "$__DoCrossgen" != 0 ]]; then
crossgenCmd="$crossgenCmd --crossgen --nocrossgen2 --crossgen-path \"$crossgenDir/crossgen\""
else
crossgenCmd="$crossgenCmd --verify-type-and-field-layout --crossgen2-path \"$crossgenDir/crossgen2/crossgen2.dll\""
fi
crossgenCmd="$crossgenCmd --verify-type-and-field-layout --crossgen2-path \"$crossgenDir/crossgen2/crossgen2.dll\""

echo "Running $crossgenCmd"
eval $crossgenCmd
Expand All @@ -191,17 +186,6 @@ precompile_coreroot_fx()
return 0
}

declare -a skipCrossGenFiles

function is_skip_crossgen_test {
for skip in "${skipCrossGenFiles[@]}"; do
if [[ "$1" == "$skip" ]]; then
return 0
fi
done
return 1
}

build_Tests()
{
echo "${__MsgPrefix}Building Tests..."
Expand Down Expand Up @@ -447,7 +431,6 @@ usage_list+=("-buildtestwrappersonly: only build the test wrappers.")
usage_list+=("-copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.")
usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroot.")

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

crossgen|-crossgen)
__DoCrossgen=1
__TestBuildMode=crossgen
;;

crossgen2|-crossgen2)
__DoCrossgen2=1
__TestBuildMode=crossgen2
Expand Down Expand Up @@ -559,9 +537,9 @@ __CopyNativeProjectsAfterCombinedTestBuild=true
__CopyNativeTestBinaries=0
__CrossBuild=0
__DistroRid=""
__DoCrossgen=0
__DoCrossgen2=0
__CompositeBuildMode=0
__TestBuildMode=
__DotNetCli="$__RepoRootDir/dotnet.sh"
__GenerateLayoutOnly=
__IsMSBuildOnNETCoreSupported=0
Expand Down Expand Up @@ -607,18 +585,9 @@ __TestDir="$__RepoRootDir/src/tests"
__TestWorkingDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig"
__IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig"
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig"
__CrossComponentBinDir="$__BinDir"
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
__MonoBinDir="$__RootBinDir/bin/mono/$__OSPlatformConfig"

__CrossArch="$__HostArch"
if [[ "$__CrossBuild" == 1 ]]; then
__CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
fi
__CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__TargetOS.$BuildArch.$__BuildType.log"
__CrossgenExe="$__CrossComponentBinDir/crossgen"
__Crossgen2Dll="$__CrossComponentBinDir/crossgen2/crossgen2.dll"

# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
# This is needed by CLI to function.
if [[ -z "$HOME" ]]; then
Expand Down
75 changes: 0 additions & 75 deletions src/tests/run.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ set __msbuildExtraArgs=
set __LongGCTests=
set __GCSimulatorTests=
set __IlasmRoundTrip=
set __DoCrossgen=
set __CrossgenAltJit=
set __PrintLastResultsOnly=
set RunInUnloadableContext=

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

if /i "%1" == "vs2017" (set __VSVersion=%1&shift&goto Arg_Loop)
if /i "%1" == "vs2019" (set __VSVersion=%1&shift&goto Arg_Loop)

if /i "%1" == "TestEnv" (set __TestEnv=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "sequential" (set __Sequential=1&shift&goto Arg_Loop)
if /i "%1" == "crossgen" (set __DoCrossgen=1&shift&goto Arg_Loop)
if /i "%1" == "crossgenaltjit" (set __DoCrossgen=1&set __CrossgenAltJit=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "longgc" (set __LongGCTests=1&shift&goto Arg_Loop)
if /i "%1" == "gcsimulator" (set __GCSimulatorTests=1&shift&goto Arg_Loop)
if /i "%1" == "jitstress" (set COMPlus_JitStress=%2&shift&shift&goto Arg_Loop)
Expand All @@ -66,10 +59,8 @@ if /i "%1" == "jitforcerelocs" (set COMPlus_ForceRelocs
if /i "%1" == "ilasmroundtrip" (set __IlasmRoundTrip=1&shift&goto Arg_Loop)

if /i "%1" == "printlastresultsonly" (set __PrintLastResultsOnly=1&shift&goto Arg_Loop)
if /i "%1" == "runcrossgentests" (set RunCrossGen=true&shift&goto Arg_Loop)
if /i "%1" == "runcrossgen2tests" (set RunCrossGen2=true&shift&goto Arg_Loop)
REM This test feature is currently intentionally undocumented
if /i "%1" == "runlargeversionbubblecrossgentests" (set RunCrossGen=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop)
if /i "%1" == "runlargeversionbubblecrossgen2tests" (set RunCrossGen2=true&set CrossgenLargeVersionBubble=true&shift&goto Arg_Loop)
if /i "%1" == "link" (set DoLink=true&set ILLINK=%2&shift&shift&goto Arg_Loop)
if /i "%1" == "gcname" (set COMPlus_GCName=%2&shift&shift&goto Arg_Loop)
Expand Down Expand Up @@ -138,18 +129,10 @@ if defined __Sequential (
set __RuntestPyArgs=%__RuntestPyArgs% --sequential
)

if defined RunCrossGen (
set __RuntestPyArgs=%__RuntestPyArgs% --run_crossgen_tests
)

if defined RunCrossGen2 (
set __RuntestPyArgs=%__RuntestPyArgs% --run_crossgen2_tests
)

if defined __DoCrossgen (
set __RuntestPyArgs=%__RuntestPyArgs% --precompile_core_root
)

if defined CrossgenLargeVersionBubble (
set __RuntestPyArgs=%__RuntestPyArgs% --large_version_bubble
)
Expand Down Expand Up @@ -242,14 +225,6 @@ call :SetTestEnvironment
call :ResolveDependencies
if errorlevel 1 exit /b 1

if defined __DoCrossgen (
echo %__MsgPrefix%Running crossgen on framework assemblies
call :PrecompileFX
)

REM Delete the unecessary mscorlib.ni file.
if exist %CORE_ROOT%\mscorlib.ni.dll del %CORE_ROOT%\mscorlib.ni.dll

::Check if the test Binaries are built
if not exist %XunitTestBinBase% (
echo %__MsgPrefix%Error: Ensure the Test Binaries are built and are present at %XunitTestBinBase%.
Expand Down Expand Up @@ -286,52 +261,6 @@ echo %__TestRunHtmlLog%
echo %__TestRunXmlLog%
exit /b 0

REM =========================================================================================
REM ===
REM === Compile the managed assemblies in Core_ROOT before running the tests
REM ===
REM =========================================================================================

:PrecompileAssembly

REM Skip mscorlib since it is already precompiled.
if /I "%3" == "mscorlib.dll" exit /b 0
if /I "%3" == "mscorlib.ni.dll" exit /b 0

"%1\crossgen.exe" /nologo /Platform_Assemblies_Paths "%CORE_ROOT%" "%2" >nul 2>nul
set /a __exitCode = %errorlevel%
if "%__exitCode%" == "-2146230517" (
echo %2 is not a managed assembly.
exit /b 0
)

if %__exitCode% neq 0 (
echo Unable to precompile %2
exit /b 0
)

echo %__MsgPrefix%Successfully precompiled %2
exit /b 0

:PrecompileFX
setlocal

if defined __CrossgenAltJit (
REM Set altjit flags for the crossgen run. Note that this entire crossgen section is within a setlocal/endlocal scope,
REM so we don't need to save or unset these afterwards.
echo %__MsgPrefix%Setting altjit environment variables for %__CrossgenAltJit%.
set COMPlus_AltJit=*
set COMPlus_AltJitNgen=*
set COMPlus_AltJitName=%__CrossgenAltJit%
set COMPlus_AltJitAssertOnNYI=1
set COMPlus_NoGuiOnAssert=1
set COMPlus_ContinueOnAssert=0
)

for %%F in (%CORE_ROOT%\*.dll) do call :PrecompileAssembly "%CORE_ROOT%" "%%F" %%~nF%%~xF
endlocal
exit /b 0

REM =========================================================================================
REM ===
REM === Subroutine to invoke msbuild.
Expand Down Expand Up @@ -447,12 +376,8 @@ echo.
echo./? -? /h -h /help -help - View this message.
echo ^<build_architecture^> - Specifies build architecture: x64, x86, arm, or arm64 ^(default: x64^).
echo ^<build_type^> - Specifies build type: Debug, Release, or Checked ^(default: Debug^).
echo VSVersion ^<vs_version^> - VS2017 or VS2019 ^(default: VS2019^).
echo TestEnv ^<test_env_script^> - Run a custom script before every test to set custom test environment settings.
echo sequential - Run tests sequentially (no parallelism).
echo crossgen - Precompile ^(crossgen^) the managed assemblies in CORE_ROOT before running the tests.
echo crossgenaltjit ^<altjit^> - Precompile ^(crossgen^) the managed assemblies in CORE_ROOT before running the tests, using the given altjit.
echo RunCrossgenTests - Runs ReadytoRun tests
echo RunCrossgen2Tests - Runs ReadytoRun tests compiled with Crossgen2
echo jitstress ^<n^> - Runs the tests with COMPlus_JitStress=n
echo jitstressregs ^<n^> - Runs the tests with COMPlus_JitStressRegs=n
Expand Down
Loading