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 Ilasm Round Trip script by adding retry logic #46765

Merged
merged 3 commits into from
Jan 12, 2021
Merged
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
49 changes: 44 additions & 5 deletions src/tests/Common/CLRTest.Jit.targets
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,37 @@ then
echo EXECUTION OF ILDASM - FAILED $ERRORLEVEL
exit 1
fi
if [ ! -f "$(DisassemblyName)" ]
then
echo "EXECUTION OF ILDASM - FAILED $(DisassemblyName) is missing"
exit 1
fi

ilasm_count=1
while true
do
echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
ERRORLEVEL=$?
if [ $ERRORLEVEL -eq 0 ]
then
break
fi

echo EXECUTION $ilasm_count OF ILASM - FAILED with $ERRORLEVEL

if [ $ilasm_count -eq 3 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be a >= instead of ==? (is that -ge?)

then
break
fi

((ilasm_count++))
echo Trying again
sleep 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like ilasm_count is never incremented.

done

echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
ERRORLEVEL=$?
if [ $ERRORLEVEL -ne 0 ]
then
echo EXECUTION OF ILASM - FAILED $ERRORLEVEL
exit 1
fi
fi
Expand Down Expand Up @@ -163,14 +187,29 @@ IF NOT DEFINED DoLink (
IF DEFINED RunningIlasmRoundTrip (
ECHO %CORE_ROOT%\ildasm.exe /raweh /out=$(DisassemblyName) $(InputAssemblyName)
%CORE_ROOT%\ildasm.exe /raweh /out=$(DisassemblyName) $(InputAssemblyName)

IF NOT "!ERRORLEVEL!"=="0" (
ECHO EXECUTION OF ILDASM - FAILED !ERRORLEVEL!
Exit /b 1
)
IF NOT EXIST $(DisassemblyName) (
ECHO EXECUTION OF ILDASM - FAILED $(DisassemblyName) is missing
Exit /b 1
)

set ilasm_count=1
:Try_ilasm
ECHO %CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
%CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
IF NOT "!ERRORLEVEL!"=="0" (
ECHO EXECUTION OF ILASM - FAILED !ERRORLEVEL!
ECHO EXECUTION OF ILASM - Try !ilasm_count! FAILED with status !ERRORLEVEL!
IF !ilasm_count! LEQ 3 (
ECHO Trying again
set /A ilasm_count=ilasm_count+1
timeout /t 10 /nobreak
goto :Try_ilasm
)
ECHO EXECUTION OF ILASM - FAILED
Exit /b 1
)
)
Expand Down