<PropertyGroup>
<BashScriptSnippetGen>$(BashScriptSnippetGen);GetCrossgenBashScript</BashScriptSnippetGen>
<BatchScriptSnippetGen>$(BatchScriptSnippetGen);GetCrossgenBatchScript</BatchScriptSnippetGen>
-
- <!-- Crossgen2 testing is incompatible with the ilasm/ildasm round trip testing. -->
- <IlasmRoundTripIncompatible Condition="'$(AlwaysUseCrossGen2)' == 'true'">true</IlasmRoundTripIncompatible>
</PropertyGroup>
<!--
-->
<Target Name="GetCrossgenBashScript">
- <Error Text="Setting both AlwaysUseCrossGen2 to true and CrossGenTest to false is non-sensical" Condition="'$(CrossGenTest)' == 'false' and '$(AlwaysUseCrossGen2)' == 'true'"/>
-
<PropertyGroup>
<CrossgenBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(CrossGenTest)' != 'false'">
<![CDATA[
+# CrossGen Script
+if [ ! -z ${RunCrossGen+x} ]%3B then
+ export COMPlus_ZapRequire=$(ZapRequire)
+ export COMPlus_ZapRequireList=$(MSBuildProjectName)
+
+ if [ -d IL ]%3B then
+ echo Inconsistency, IL dir already exists, reinstall tests
+ exit 1
+ fi
-if [ "$(AlwaysUseCrossGen2)" == "true" ]; then
- unset RunCrossGen
- export RunCrossGen2=1
- export CompositeBuildMode=1
-fi
+ mkdir IL
+ mv *.dll IL/
-# CrossGen2 Script
-if [ ! -z ${RunCrossGen2+x} ]%3B then
- compilationDoneFlagFile="IL-CG2/done"
- if [ -d IL-CG2 ]%3B then
- while [ ! -f $compilationDoneFlagFile ]%3B
- do
- echo "Waiting for concurrent Crossgen2 compilation: $compilationDoneFlagFile"
- sleep 5%3B
- done
- else
- TakeLock
- if [ ! -d IL-CG2 ]%3B then
- mkdir IL-CG2
- if [ ! -z ${CompositeBuildMode+x} ]%3B then
- cp $(MSBuildProjectName).dll IL-CG2/
- cp $CORE_ROOT/lib*.so $CORE_ROOT/lib*.dylib $(scriptPath)
- else
- cp *.dll IL-CG2/
- rm IL-CG2/composite-r2r.dll
- fi
+ for file in `find $PWD/IL -name "*.dll"`%3B do
+ filename=`basename $file`
+ outfile="$PWD/$filename"
- ExtraCrossGen2Args+=" $(CrossGen2TestExtraArguments)"
+ __Command="$CORE_ROOT/crossgen $CrossGenOptions /p $CORE_ROOT%3A$PWD/IL /in $file /out $outfile"
- if [ ! -z ${LargeVersionBubble+x} ]%3B then
- ExtraCrossGen2Args+=" --inputbubble"
+ echo "Running CrossGen: $__Command"
+ COMPlus_MultiCoreJitProfile= $__Command
+ __cgExitCode=$?
+ if [ $__cgExitCode -ne 0 ]
+ then
+ mv IL/* .
+ rm -rf IL
+ echo Crossgen failed for $file with exitcode: $__cgExitCode
+ exit 1
fi
+ done
+fi
- __cg2ExitCode=0
-
- OneFileCrossgen2() {
- __OutputFile=$1
-
- __ResponseFile="$__OutputFile.rsp"
- rm $__ResponseFile
-
- __Command=$_DebuggerFullPath
- # Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
- if [ ! -z ${__TestDotNetCmd+x} ] %3B then
- __Command+=" $__TestDotNetCmd"
- else
- __Command+=" dotnet"
- fi
- __Command+=" $CORE_ROOT/crossgen2/crossgen2.dll"
- __Command+=" @$__ResponseFile"
- __Command+=" $ExtraCrossGen2Args"
-
- echo $2 >> $__ResponseFile
-
- echo -o:$__OutputFile>>$__ResponseFile
- echo -r:$CORE_ROOT/System.*.dll>>$__ResponseFile
- echo -r:$CORE_ROOT/Microsoft.*.dll>>$__ResponseFile
- echo -r:$CORE_ROOT/mscorlib.dll>>$__ResponseFile
- echo --verify-type-and-field-layout>>$__ResponseFile
- echo --targetarch:$(TargetArchitecture)>>$__ResponseFile
- echo -O>>$__ResponseFile
+# CrossGen2 Script
+if [ ! -z ${RunCrossGen2+x} ]%3B then
+ if [ -d IL ]%3B then
+ echo Inconsistency, IL dir already exists, reinstall tests
+ exit 1
+ fi
- echo "Response file: $__ResponseFile"
- cat $__ResponseFile
+ mkdir IL
+ mv *.dll IL/
- # Suppress some COMPlus variables for the duration of Crossgen2 execution
- export -n COMPlus_GCName COMPlus_GCStress COMPlus_HeapVerify COMPlus_ReadyToRun
+ refs=""
+ for file in `find $CORE_ROOT -maxdepth 1 -name "*.dll" | grep -v ".ni.dll" | grep -v "xunit" `%3B do
+ refs="${refs} -r:$file"
+ done
+ for file in `find $PWD/IL -name "*.dll"`%3B do
+ refs="${refs} -r:$file"
+ done
- echo "Running CrossGen2: $__Command"
- $__Command
- __cg2ExitCode=$?
+ extraCrossGen2Args="$(CrossGen2TestExtraArguments)"
- export COMPlus_GCName COMPlus_GCStress COMPlus_HeapVerify COMPlus_ReadyToRun
- }
+ for file in `find $PWD/IL -name "*.dll"`%3B do
+ filename=`basename $file`
+ outfile="$PWD/$filename"
- if [ ! -z ${CompositeBuildMode+x} ]%3B then
- ExtraCrossGen2Args+=" --composite"
- OneFileCrossgen2 "$PWD/composite-r2r.dll" "$PWD/IL-CG2/*.dll"
- else
- ExtraCrossGen2Args+= -r:$PWD/IL-CG2/*.dll
- for dllFile in $PWD/IL-CG2/*.dll
- do
- echo $dllFile
- bareFileName="${dllFile##*/}"
- OneFileCrossgen2 "$PWD/$bareFileName" "$dllFile"
- if [ $__cg2ExitCode -ne 0 ]; then
- break
- fi
- done
- fi
+ __Command="$CORE_ROOT/corerun $CORE_ROOT/crossgen2/crossgen2.dll $CrossGen2Options $extraCrossGen2Args -o%3A$outfile $file ${refs}"
- echo "Crossgen2 compilation finished, exit code $__cg2ExitCode" >> $compilationDoneFlagFile
- if [ $__cg2ExitCode -ne 0 ]; then
- echo Crossgen2 failed with exitcode: $__cg2ExitCode
- ReleaseLock
+ echo "Running CrossGen2: $__Command"
+ COMPlus_MultiCoreJitProfile= $__Command
+ __cg2ExitCode=$?
+ if [ $__cg2ExitCode -ne 0 ]
+ then
+ mv IL/* .
+ rm -rf IL
+ echo Crossgen2 failed for $file with exitcode: $__cg2ExitCode
exit 1
fi
- fi
- ReleaseLock
- fi
-
- export COMPlus_ZapRequire=$(ZapRequire)
- export COMPlus_ZapRequireList=$(MSBuildProjectName)
+ done
fi
]]>
</CrossgenBashScript>
+ <CrossgenCleanupBashScript Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(CrossGenTest)' != 'false'">
+ <![CDATA[
+ if [ ! -z ${RunCrossGen+x} ] || [ ! -z ${RunCrossGen2+x} ]%3B then
+ mv IL/* .
+ rm -rf IL
+ fi
+ ]]>
+ </CrossgenCleanupBashScript>
+
<BashCLRTestPreCommands>$(BashCLRTestPreCommands);$(CrossgenBashScript)</BashCLRTestPreCommands>
+ <BashCLRTestPostCommands>$(BashCLRTestPostCommands);$(CrossgenCleanupBashScript)</BashCLRTestPostCommands>
</PropertyGroup>
</Target>
<CrossgenBatchScript Condition="'$(CLRTestKind)' == 'BuildAndRun' and '$(CrossGenTest)' != 'false'">
<![CDATA[
-if /i "$(AlwaysUseCrossGen2)" == "true" (
- set RunCrossGen=
- set RunCrossGen2=1
- set CompositeBuildMode=1
-)
-
-REM CrossGen2 Script
-if defined RunCrossGen2 (
- set ExtraCrossGen2Args=!ExtraCrossGen2Args! $(CrossGen2TestExtraArguments)
-
- if defined LargeVersionBubble ( set ExtraCrossGen2Args=!ExtraCrossGen2Args! --inputbubble)
- set CrossGen2Status=0
- set compilationDoneFlagFile=!ScriptPath!IL-CG2\done
- if exist "IL-CG2" (
- REM We may have come in the middle of a concurrent CG2 compilation, wait for it to finish
- :ProbeCompilationFinished
- if exist "!compilationDoneFlagFile!" goto :DoneCrossgen2OperationsNoRelease
- echo Waiting for concurrent Crossgen2 compilation^: !compilationDoneFlagFile!
- timeout /t 5 /nobreak
- goto :ProbeCompilationFinished
- )
- call :TakeLock
- if exist "IL-CG2" goto :DoneCrossgen2Operations
-
- mkdir IL-CG2
- copy *.dll IL-CG2\
- del IL-CG2\composite-r2r.dll
-
- if defined CompositeBuildMode (
- set ExtraCrossGen2Args=!ExtraCrossGen2Args! --composite
- set __OutputFile=!scriptPath!\composite-r2r.dll
- rem In composite mode, treat all dll's in the test folder as rooting inputs
- set __InputFile=!scriptPath!IL-CG2\*.dll
- call :CompileOneFileCrossgen2
- IF NOT !CrossGen2Status!==0 goto :DoneCrossgen2Operations
- ) else (
- for %%I in (!scriptPath!\*.dll) do (
- set ExtraCrossGen2Args=!ExtraCrossGen2Args! -r:!scriptPath!IL-CG2\*.dll
- set __OutputFile=!scriptPath!\%%~nI.dll
- set __InputFile=!scriptPath!IL-CG2\%%~nI.dll
- call :CompileOneFileCrossgen2
- IF NOT !CrossGen2Status!==0 (
- IF NOT !CrossGen2Status!==2 goto :DoneCrossgen2Operations
- )
- rem Normalize return code 2, no valid input files, to success code
- set CrossGen2Status=0
- )
- )
-
- goto :DoneCrossgen2Operations
-:CompileOneFileCrossgen2
- set __ResponseFile=!__OutputFile!.rsp
- del /Q !__ResponseFile!
-
- set __Command=!_DebuggerFullPath!
- REM Tests run locally need __TestDotNetCmd (set by runtest.py) or a compatible 5.0 dotnet runtime in the path
- if defined __TestDotNetCmd (
- set __Command=!__Command! "!__TestDotNetCmd!"
- ) else (
- set __Command=!__Command! "dotnet"
- )
- set __Command=!__Command! "!CORE_ROOT!\crossgen2\crossgen2.dll"
- set __Command=!__Command! @"!__ResponseFile!"
- set __Command=!__Command! !ExtraCrossGen2Args!
- echo !__InputFile!>>!__ResponseFile!
- echo -o:!__OutputFile!>>!__ResponseFile!
- echo --targetarch:$(TargetArchitecture)>>!__ResponseFile!
- echo --verify-type-and-field-layout>>!__ResponseFile!
- echo --method-layout:random>>!__ResponseFile!
- echo -r:!CORE_ROOT!\System.*.dll>>!__ResponseFile!
- echo -r:!CORE_ROOT!\Microsoft.*.dll>>!__ResponseFile!
- echo -r:!CORE_ROOT!\mscorlib.dll>>!__ResponseFile!
- echo -r:!CORE_ROOT!\netstandard.dll>>!__ResponseFile!
- echo -O>>!__ResponseFile!
-
- if not "$(__CreatePdb)" == "" (
- echo --pdb>>!__ResponseFile!
- )
-
- echo Response file: !__ResponseFile!
- type !__ResponseFile!
-
- REM Suppress some COMPlus variables for the duration of Crossgen2 execution
- setlocal
- set "COMPlus_GCName="
- set "COMPlus_GCStress="
- set "COMPlus_HeapVerify="
- set "COMPlus_ReadyToRun="
-
- echo "!__Command!"
- call !__Command!
- endlocal
- set CrossGen2Status=!ERRORLEVEL!
- Exit /b 0
-
-:DoneCrossgen2Operations
- echo Crossgen2 compilation finished, exit code !CrossGen2Status!>>!compilationDoneFlagFile!
- call :ReleaseLock
-:DoneCrossgen2OperationsNoRelease
- IF NOT !CrossGen2Status!==0 (
- ECHO Crossgen2 failed with exitcode - !CrossGen2Status!
- Exit /b 1
- )
-
- set COMPlus_ZapRequire=$(ZapRequire)
- set COMPlus_ZapRequireList=$(MSBuildProjectName)
-)
]]>
</CrossgenBatchScript>
<CLRTestBatchPreCommands>$(CLRTestBatchPreCommands);$(CrossgenBatchScript)</CLRTestBatchPreCommands>
</PropertyGroup>
</Target>
+
</Project>