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 SuperPMI unit test error checking #76411

Merged
Merged
Show file tree
Hide file tree
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
26 changes: 11 additions & 15 deletions src/tests/JIT/superpmi/superpmicollect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ private static void ChooseFilePaths(string outputMchPath)

private static int RunProgram(string program, string arguments)
{
if (!File.Exists(program))
{
throw new SpmiException("program " + program + " not found");
}

// If the program is a script, move the program name into the arguments, and run it
// under the appropriate shell.
if (Global.IsWindows)
Expand Down Expand Up @@ -238,7 +243,11 @@ private static void RunTest(string testName)

try
{
RunProgram(testName, "");
int retval = RunProgram(testName, "");
if (retval != 0)
{
throw new SpmiException("Test " + testName + " failed");
}
}
finally
{
Expand Down Expand Up @@ -269,22 +278,9 @@ private static string[] GetSpmiTestFullPaths()
// Run all the programs from the CoreCLR test binary drop we wish to run while collecting MC files.
private static void RunTestProgramsWhileCollecting()
{

// Run the tests
foreach (string spmiTestPath in GetSpmiTestFullPaths())
{
try
{
RunTest(spmiTestPath);
}
catch (SpmiException ex)
{
// Ignore failures running the test. We don't really care if they pass or not
// as long as they generate some .MC files. Plus, I'm not sure how confident
// we can be in getting a correct error code.

Console.Error.WriteLine("WARNING: test failed (ignoring): " + ex.Message);
}
RunTest(spmiTestPath);
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/tests/JIT/superpmi/superpmicollect.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@

<ItemGroup>
<_SpmiTestProjects Include="..\Performance\CodeQuality\Bytemark\Bytemark.csproj" />
<_SpmiTestProjects Include="..\Performance\CodeQuality\Roslyn\CscBench.csproj" />
<!-- The reference to 10w5d_cs_do.csproj is commented out due to https://github.com/dotnet/runtime/issues/76421:
merged tests (those built with BuildAsStandalone=false) don't get .cmd/.sh files, which are needed to
run the test by the superpmicollect driver.
-->
<!--
<_SpmiTestProjects Include="..\Methodical\fp\exgen\10w5d_cs_do.csproj" />
-->
<ProjectReference Include="@(_SpmiTestProjects)">
<Targets>Build</Targets>
<OutputItemType>_SpmiTest</OutputItemType>
Expand Down