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

Clean up test discovery #76663

Merged
merged 2 commits into from
Jan 8, 2025
Merged

Clean up test discovery #76663

merged 2 commits into from
Jan 8, 2025

Conversation

jaredpar
Copy link
Member

@jaredpar jaredpar commented Jan 7, 2025

Make a few small changes here:

  1. Added a README.md to explain the purpose of TestDiscoveryWorker
  2. Moved to using standard command line arguments so the tool can be run locally more easily

Make a few small changes here:

1. Added a README.md to explain the purpose of `TestDiscoveryWorker`
2. Moved to using standard command line arguments so the tool can be run
   locally more easily
@jaredpar jaredpar requested a review from a team as a code owner January 7, 2025 19:10
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 7, 2025
@jaredpar
Copy link
Member Author

jaredpar commented Jan 7, 2025

@dotnet/roslyn-infrastructure PTAL

.. Directory.EnumerateDirectories(artifactsDir, "*.UnitTests"),
.. Directory.EnumerateDirectories(artifactsDir, "*.IntegrationTests"),
.. Directory.EnumerateDirectories(artifactsDir, "RunTests")
];
Copy link
Member

Choose a reason for hiding this comment

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

what black magic is this...

Copy link
Member Author

Choose a reason for hiding this comment

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

Just trying to creat a List<string> vs a lazy evaluated IEnumerable<string>. No functional changes here.

List<string> directories =
[
Path.Combine(sourceDirectory, "eng"),
Path.Combine(sourceDirectory, "artifacts", "VSSetup"),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the previous !isUnix check is not needed here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. That check was basically replaced with the Directory.Exists check. I like the latter better cause I can run the tools locally without having a 100% full roslyn build.

}

Console.WriteLine($"{testsToWrite.Count} found");

using var fileStream = new FileStream(outputFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
Copy link
Contributor

Choose a reason for hiding this comment

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

If the file already exists, will this code do the right thing? I would expect existing file contents to get replaced with the new contents?

catch (OptionException e)
{
Console.WriteLine(e.Message);
options.WriteOptionDescriptions(Console.Out);
return ExitFailure;
}
catch (Exception ex)
{
// Write the exception details to stderr so the host process can pick it up.
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like we write to stderr anymore, i.e., the comment is incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Will fix this on the next change.

@@ -4,12 +4,14 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>$(NetRoslyn);net472</TargetFrameworks>
<Nullable>enable</Nullable>
<SignAssembly>false</SignAssembly>
Copy link
Member

Choose a reason for hiding this comment

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

Curious why was this added?

Copy link
Member Author

Choose a reason for hiding this comment

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

The Mono.Options reference isn't signed hence this can't be either since it uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants