Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix differences between bash and cmd versions of crossgen test script #108500

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Changes from 2 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
80 changes: 51 additions & 29 deletions src/tests/Common/CLRTest.CrossGen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
TakeLock
if [ ! -d IL-CG2 ]%3B then
mkdir IL-CG2
cp *.dll IL-CG2/
rm IL-CG2/composite-r2r.dll 2>/dev/null
rm IL-CG2/Coreclr.TestWrapper.dll 2>/dev/null
rm IL-CG2/*.XUnitWrapper.dll 2>/dev/null

if [ ! -z ${CompositeBuildMode+x} ]%3B then
cp $(AssemblyName).dll IL-CG2/
# FIXME: Why is this cp here? Windows doesn't do it.
kg marked this conversation as resolved.
Show resolved Hide resolved
cp $CORE_ROOT/lib*.so $CORE_ROOT/lib*.dylib $(scriptPath)
else
cp *.dll IL-CG2/
rm IL-CG2/composite-r2r.dll 2>/dev/null
rm IL-CG2/Coreclr.TestWrapper.dll 2>/dev/null
rm IL-CG2/*.XUnitWrapper.dll 2>/dev/null
ExtraCrossGen2Args+=" --composite"
fi

ExtraCrossGen2Args+=" $(CrossGen2TestExtraArguments)"
Expand All @@ -75,10 +76,13 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
ExtraCrossGen2Args+=" --inputbubble"
fi

# FIXME: CrossGen2TestCheckPdb is missing
kg marked this conversation as resolved.
Show resolved Hide resolved

__cg2ExitCode=0
__r2rDumpExitCode=0
__CrossgenInputsList=()

OneFileCrossgen2() {
RunCrossgen2OnInputsList() {
date +%H:%M:%S
__OutputFile=$1

Expand All @@ -99,13 +103,13 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
__Command+=" @$__ResponseFile"
__Command+=" $ExtraCrossGen2Args"

echo $2 >> $__ResponseFile
for dllFile in ${__CrossgenInputsList[@]}; do
echo $dllFile >> $__ResponseFile
done

echo -o:$__OutputFile>>$__ResponseFile
echo -r:$CORE_ROOT/System.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/Microsoft.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/xunit.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/mscorlib.dll>>$__ResponseFile
echo --targetarch:$(TargetArchitecture)>>$__ResponseFile
echo --targetos:$(TargetOS)>>$__ResponseFile
echo --verify-type-and-field-layout>>$__ResponseFile
echo --method-layout:random>>$__ResponseFile
if [ ! -z ${CrossGen2SynthesizePgo+x} ]%3B then
Expand All @@ -115,14 +119,25 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
if [ ! -z ${HotColdSplitting+x} ]%3B then
echo --hot-cold-splitting>>$__ResponseFile
fi
echo --targetarch:$(TargetArchitecture)>>$__ResponseFile
echo --targetos:$(TargetOS)>>$__ResponseFile
# HACK: Suppress the globbing of the reference causing empty lines in the response file
set -o noglob
echo -r:$CORE_ROOT/System.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/Microsoft.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/xunit.*.dll>>$__ResponseFile
echo -r:$CORE_ROOT/mscorlib.dll>>$__ResponseFile
echo -r:$CORE_ROOT/netstandard.dll>>$__ResponseFile
set +o noglob

# FIXME: --pdb
kg marked this conversation as resolved.
Show resolved Hide resolved

echo "Response file: $__ResponseFile"
cat $__ResponseFile

# Suppress some DOTNET variables for the duration of Crossgen2 execution
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun DOTNET_TC_OnStackReplacement DOTNET_TC_PartialCompilation
export -n DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
# FIXME: Remove this?
# work around problems in 6.0 OSR
export -n DOTNET_TC_OnStackReplacement DOTNET_TC_PartialCompilation

echo "Running CrossGen2: $__Command"
$__Command
Expand All @@ -132,24 +147,29 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
$__R2RDumpCommand
__r2rDumpExitCode=$?

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun DOTNET_TC_OnStackReplacement DOTNET_TC_PartialCompilation
# FIXME: Run PdbChecker if enabled
kg marked this conversation as resolved.
Show resolved Hide resolved

export DOTNET_GCName DOTNET_GCStress DOTNET_HeapVerify DOTNET_ReadyToRun
export DOTNET_TC_OnStackReplacement DOTNET_TC_PartialCompilation
date +%H:%M:%S
}

if [ ! -z ${CompositeBuildMode+x} ]%3B then
ExtraCrossGen2Args+=" --composite"
OneFileCrossgen2 "$PWD/composite-r2r.dll" "$PWD/IL-CG2/*.dll"
shopt -s nullglob
__CrossgenInputsList=($PWD/IL-CG2/*.dll)
kg marked this conversation as resolved.
Show resolved Hide resolved
RunCrossgen2OnInputsList "$PWD/composite-r2r.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
for dllFile in $PWD/IL-CG2/*.dll
do
echo $dllFile
bareFileName="${dllFile##*/}"
__CrossgenInputsList=($dllFile)
RunCrossgen2OnInputsList "$PWD/$bareFileName"
if [ $__cg2ExitCode -ne 0 ]; then
break
fi
done
fi

echo "Crossgen2 compilation finished, exit code $__cg2ExitCode" >> $compilationDoneFlagFile
Expand Down Expand Up @@ -254,6 +274,7 @@ if defined RunCrossGen2 (
set __Command=!_DebuggerFullPath! "!CORE_ROOT!\crossgen2\crossgen2.exe"
set __Command=!__Command! @"!__ResponseFile!"
set __Command=!__Command! !ExtraCrossGen2Args!

echo !__InputFile!>>!__ResponseFile!
echo -o:!__OutputFile!>>!__ResponseFile!
echo --targetarch:$(TargetArchitecture)>>!__ResponseFile!
Expand Down Expand Up @@ -287,18 +308,19 @@ if defined RunCrossGen2 (
set "DOTNET_HeapVerify="
set "DOTNET_ReadyToRun="

REM remove this?
ivdiazsa marked this conversation as resolved.
Show resolved Hide resolved
REM work around problems in 6.0 OSR
set "DOTNET_TC_OnStackReplacement="
set "DOTNET_TC_PartialCompilation="

echo "!__Command!"
echo "Running CrossGen2: !__Command!"
call !__Command!

set CrossGen2Status=!ERRORLEVEL!

IF NOT !CrossGen2Status!==0 goto :DoneR2RDumpOperations

echo "!__R2RDumpCommand!"
echo "Running R2RDump: !__R2RDumpCommand!"
call !__R2RDumpCommand!

set R2RDumpStatus=!ERRORLEVEL!
Expand Down
Loading