Skip to content

Commit

Permalink
Hacking test script
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Aug 20, 2024
1 parent 12969bb commit 31ae7c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/tests/Common/CLRTest.Execute.Batch.targets
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ if not defined CLRTestExecutionArguments (set CLRTestExecutionArguments=$(CLRTes
]]></BatchCLRTestArgPrep>

<!-- By default, be prepared to do a full check -->
<BatchLoopPart2 Condition="'$(CLRTestLoop)' == 'true'"><![CDATA[SET /A RetryCount=%RetryCount%-1
IF NOT "%RetryCount%"=="0" (
GOTO :RetryingRerun
) ELSE (
ECHO END EXECUTION - PASSED BUT ALSO FAILED
ECHO FAILED
popd
Exit /b 1
)]]></BatchLoopPart2>
<BatchCLRTestExitCodeCheck><![CDATA[
ECHO Expected: %CLRTestExpectedExitCode%
ECHO Actual: %CLRTestExitCode%
Expand All @@ -157,6 +166,7 @@ IF NOT "%CLRTestExitCode%"=="%CLRTestExpectedExitCode%" (
) ELSE (
ECHO END EXECUTION - PASSED
ECHO PASSED
$(BatchLoopPart2)
popd
Exit /b 0
)
Expand Down Expand Up @@ -305,6 +315,8 @@ REM Local CoreShim requested - see MSBuild property 'CLRTestScriptLocalCoreShim'
ECHO Copying '%CORE_ROOT%\CoreShim.dll'...
COPY /y %CORE_ROOT%\CoreShim.dll .
]]></BatchCopyCoreShimLocalCmds>
<BatchLoopPart1 Condition="'$(CLRTestLoop)' == 'true'"><![CDATA[SET RetryCount=100
:RetryingRerun]]></BatchLoopPart1>
<BatchCLRTestLaunchCmds Condition="'$(CLRTestKind)' == 'BuildAndRun' And $(TargetOS) != 'android'">
<![CDATA[
$(BatchLinkerTestLaunchCmds)
Expand All @@ -323,6 +335,7 @@ if defined RunCrossGen2 (
)
ECHO %LAUNCHER% %ExePath% %CLRTestExecutionArguments%
$(BatchLoopPart1)
%LAUNCHER% %ExePath% %CLRTestExecutionArguments%
set CLRTestExitCode=!ERRORLEVEL!
if defined RunCrossGen2 (
Expand Down
2 changes: 2 additions & 0 deletions src/tests/Common/Coreclr.TestWrapper/CoreclrTestWrapperLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ public int RunTest(string executable, string outputFile, string errorFile, strin
using (var errorWriter = new StreamWriter(errorStream))
using (Process process = new Process())
{
outputWriter.WriteLine("Andrew modified CoreclrTestWrapper is running '" + executable + "'");
if (MobileAppHandler.IsRetryRequested(testBinaryBase))
{
outputWriter.WriteLine("\nWork item retry had been requested earlier - skipping test...");
Expand Down Expand Up @@ -719,6 +720,7 @@ public int RunTest(string executable, string outputFile, string errorFile, strin
Task copyOutput = process.StandardOutput.BaseStream.CopyToAsync(outputStream, 4096, cts.Token);
Task copyError = process.StandardError.BaseStream.CopyToAsync(errorStream, 4096, cts.Token);


if (process.WaitForExit(timeout))
{
// Process completed. Check process.ExitCode here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<!-- We skip the ReadyToRun tests when sanitized due to build complexity -->
<DisableProjectBuild Condition="'$(EnableNativeSanitizers)' != ''">true</DisableProjectBuild>
<OldToolsVersion>2.0</OldToolsVersion>
<!-- Rerun the test for 100 times or stop if we get a failure -->
<CLRTestLoop>true</CLRTestLoop>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
Expand Down

0 comments on commit 31ae7c2

Please sign in to comment.