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

Create IL-RT folder to store roundtripped IL assemblies and sources, removed suffix '.asm' to roundtripped files, re-enabled rejit ilasm roundtripping #90110

Merged
merged 9 commits into from
Oct 6, 2023
36 changes: 20 additions & 16 deletions src/tests/Common/CLRTest.Jit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ WARNING: When setting properties based on their current state (for example:
<Target Name="GetIlasmRoundTripBashScript"
Returns="$(IlasmRoundTripBashScript);$(BashIlrtTestLaunchCmds)">
<PropertyGroup>
<DisassemblyName>$(AssemblyName).dasm.il</DisassemblyName>
<TargetAssemblyName>$(AssemblyName).asm.dll</TargetAssemblyName>
<DisassemblyName>IL-RT/$(AssemblyName).il</DisassemblyName>
<TargetAssemblyName>IL-RT/$(AssemblyName).dll</TargetAssemblyName>

<IlasmRoundTripBashScript Condition="'$(CLRTestKind)' == 'RunOnly'"><![CDATA[
# IlasmRoundTrip Script
Expand All @@ -62,8 +62,10 @@ export RunningIlasmRoundTrip=

if [ -z "$DoLink" -a ! -z "$RunningIlasmRoundTrip" ];
then
echo "$CORE_ROOT/ildasm" -raweh -unicode -out=$(DisassemblyName) $(InputAssemblyName)
"$CORE_ROOT/ildasm" -raweh -unicode -out=$(DisassemblyName) $(InputAssemblyName)
mkdir IL-RT
cp $(InputAssemblyName) $(TargetAssemblyName)
echo "$CORE_ROOT/ildasm" -raweh -unicode -out=$(DisassemblyName) $(TargetAssemblyName)
"$CORE_ROOT/ildasm" -raweh -unicode -out=$(DisassemblyName) $(TargetAssemblyName)
ERRORLEVEL=$?
if [ $ERRORLEVEL -ne 0 ]
then
Expand All @@ -79,8 +81,8 @@ then
ilasm_count=1
while true
do
echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
echo "$CORE_ROOT/ilasm" -output=$(InputAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
"$CORE_ROOT/ilasm" -output=$(InputAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
ERRORLEVEL=$?
if [ $ERRORLEVEL -eq 0 ]
then
Expand Down Expand Up @@ -109,8 +111,8 @@ fi
<BashIlrtTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun'"><![CDATA[
if [ -z "$DoLink" -a ! -z "$RunningIlasmRoundTrip" ];
then
echo $LAUNCHER $(TargetAssemblyName) %24(printf "'%s' " "${CLRTestExecutionArguments[@]}")
$LAUNCHER $(TargetAssemblyName) "${CLRTestExecutionArguments[@]}"
echo $LAUNCHER $(InputAssemblyName) %24(printf "'%s' " "${CLRTestExecutionArguments[@]}")
$LAUNCHER $(InputAssemblyName) "${CLRTestExecutionArguments[@]}"
ERRORLEVEL=$?
if [ $ERRORLEVEL -ne $CLRTestExpectedExitCode ]
then
Expand All @@ -126,8 +128,8 @@ fi
<Target Name="GetIlasmRoundTripBatchScript"
Returns="$(IlasmRoundTripBatchScript);$(BatchIlrtTestLaunchCmds)">
<PropertyGroup>
<DisassemblyName>$(AssemblyName).dasm.il</DisassemblyName>
<TargetAssemblyName>$(AssemblyName).asm.dll</TargetAssemblyName>
<DisassemblyName>IL-RT\$(AssemblyName).il</DisassemblyName>
<TargetAssemblyName>IL-RT\$(AssemblyName).dll</TargetAssemblyName>

<IlasmRoundTripBatchScript Condition="'$(CLRTestKind)' == 'RunOnly'"><![CDATA[
REM IlasmRoundTrip Script
Expand All @@ -144,8 +146,10 @@ REM Disable Ilasm round-tripping for Linker tests.
REM Todo: Ilasm round-trip on linked binaries.
IF NOT DEFINED DoLink (
IF DEFINED RunningIlasmRoundTrip (
ECHO %CORE_ROOT%\ildasm.exe /raweh /unicode /out=$(DisassemblyName) $(InputAssemblyName)
%CORE_ROOT%\ildasm.exe /raweh /unicode /out=$(DisassemblyName) $(InputAssemblyName)
mkdir IL-RT
copy $(InputAssemblyName) $(TargetAssemblyName)
ECHO %CORE_ROOT%\ildasm.exe /raweh /unicode /out=$(DisassemblyName) $(TargetAssemblyName)
%CORE_ROOT%\ildasm.exe /raweh /unicode /out=$(DisassemblyName) $(TargetAssemblyName)

IF NOT "!ERRORLEVEL!"=="0" (
ECHO EXECUTION OF ILDASM - FAILED !ERRORLEVEL!
Expand All @@ -158,8 +162,8 @@ IF NOT DEFINED DoLink (

set ilasm_count=1
:Try_ilasm
ECHO %CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
%CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
ECHO %CORE_ROOT%\ilasm.exe /output=$(InputAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
%CORE_ROOT%\ilasm.exe /output=$(InputAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
IF NOT "!ERRORLEVEL!"=="0" (
ECHO EXECUTION OF ILASM - Try !ilasm_count! FAILED with status !ERRORLEVEL!
IF !ilasm_count! LEQ 3 (
Expand All @@ -178,8 +182,8 @@ IF NOT DEFINED DoLink (
<BatchIlrtTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun'"><![CDATA[
IF NOT DEFINED DoLink (
if defined RunningIlasmRoundTrip (
ECHO %LAUNCHER% $(TargetAssemblyName) %CLRTestExecutionArguments%
%LAUNCHER% $(TargetAssemblyName) %CLRTestExecutionArguments%
ECHO %LAUNCHER% $(InputAssemblyName) %CLRTestExecutionArguments%
%LAUNCHER% $(InputAssemblyName) %CLRTestExecutionArguments%
IF NOT "!ERRORLEVEL!"=="%CLRTestExpectedExitCode%" (
ECHO END EXECUTION OF IL{D}ASM BINARY - FAILED !ERRORLEVEL! vs %CLRTestExpectedExitCode%
Exit /b 1
Expand Down
2 changes: 0 additions & 2 deletions src/tests/profiler/rejit/rejit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
runincontext loads even framework assemblies into the unloadable
context, locals in this loop prevent unloading -->
<UnloadabilityIncompatible>true</UnloadabilityIncompatible>
<!-- Different file names after roundtripping causes problems with this test -->
<IlasmRoundTripIncompatible>true</IlasmRoundTripIncompatible>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
Expand Down
Loading