Skip to content

Commit dcae07b

Browse files
committed
Fix Ilasm Round Trip script by adding retry logic
Fix bash syntax Update bash syntax to use while true
1 parent 97d11fb commit dcae07b

1 file changed

Lines changed: 40 additions & 6 deletions

File tree

src/tests/Common/CLRTest.Jit.targets

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,32 @@ then
109109
echo EXECUTION OF ILDASM - FAILED $ERRORLEVEL
110110
exit 1
111111
fi
112+
if [ ! -f "$(DisassemblyName)" ]
113+
then
114+
echo "EXECUTION OF ILDASM - FAILED $(DisassemblyName) is missing"
115+
exit 1
116+
fi
117+
118+
ilasm_count=1
119+
while true
120+
do
121+
echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
122+
"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
123+
ERRORLEVEL=$?
124+
if [ $ERRORLEVEL -eq 0 ]
125+
then
126+
break
127+
fi
128+
echo EXECUTION $ilasm_count OF ILASM - FAILED with $ERRORLEVEL
129+
if [ $ilasm_count -eq 3 ]
130+
then
131+
break
132+
fi
133+
echo Trying again
134+
sleep 10
135+
done
112136
113-
echo "$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
114-
"$CORE_ROOT/ilasm" -output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
115-
ERRORLEVEL=$?
116137
if [ $ERRORLEVEL -ne 0 ]
117-
then
118-
echo EXECUTION OF ILASM - FAILED $ERRORLEVEL
119138
exit 1
120139
fi
121140
fi
@@ -163,14 +182,29 @@ IF NOT DEFINED DoLink (
163182
IF DEFINED RunningIlasmRoundTrip (
164183
ECHO %CORE_ROOT%\ildasm.exe /raweh /out=$(DisassemblyName) $(InputAssemblyName)
165184
%CORE_ROOT%\ildasm.exe /raweh /out=$(DisassemblyName) $(InputAssemblyName)
185+
166186
IF NOT "!ERRORLEVEL!"=="0" (
167187
ECHO EXECUTION OF ILDASM - FAILED !ERRORLEVEL!
168188
Exit /b 1
169189
)
190+
IF NOT EXIST $(DisassemblyName) (
191+
ECHO EXECUTION OF ILDASM - FAILED $(DisassemblyName) is missing
192+
Exit /b 1
193+
)
194+
195+
set ilasm_count=1
196+
:Try_ilasm
170197
ECHO %CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
171198
%CORE_ROOT%\ilasm.exe /output=$(TargetAssemblyName) $(_IlasmSwitches) $(DisassemblyName)
172199
IF NOT "!ERRORLEVEL!"=="0" (
173-
ECHO EXECUTION OF ILASM - FAILED !ERRORLEVEL!
200+
ECHO EXECUTION OF ILASM - Try !ilasm_count! FAILED with status !ERRORLEVEL!
201+
IF !ilasm_count! LEQ 3 (
202+
ECHO Trying again
203+
set /A ilasm_count=ilasm_count+1
204+
timeout /t 10 /nobreak
205+
goto :Try_ilasm
206+
)
207+
ECHO EXECUTION OF ILASM - FAILED
174208
Exit /b 1
175209
)
176210
)

0 commit comments

Comments
 (0)