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

TestConsole supporting parallel execution #17993

Merged
merged 4 commits into from
Nov 13, 2024
Merged

Conversation

majocha
Copy link
Contributor

@majocha majocha commented Nov 12, 2024

Refactor of FSharp.Test.Utilities to use thread-safe console redirection and output capture.

The problem this solves looks like this:
Quite a few test cases redirect stdout and stderr to capture console output. Console.Out being a global resource makes it impossible to run them concurrently, they would either hijack the redirected streams from each other or write to the wrong redirected stream.

This PR introduces TestConsole. At the beginning of a test run it installs redirecting streams that isolate access to console for each concurrently running test case. It is implemented using AsyncLocal.

This PR does not yet enable actual parallel execution of tests.

Copy link
Contributor

✅ No release notes required

@majocha majocha mentioned this pull request Nov 12, 2024
8 tasks
@majocha majocha marked this pull request as ready for review November 12, 2024 15:48
@majocha majocha requested a review from a team as a code owner November 12, 2024 15:48
@KevinRansom
Copy link
Member

I like this. I don't know why end2end tests are failing, but it looks like they are getting the wrong sdk.

Copy link
Member

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

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

Nice work, thanks

@T-Gro T-Gro enabled auto-merge (squash) November 13, 2024 18:03
@T-Gro T-Gro merged commit fb69e58 into dotnet:main Nov 13, 2024
33 checks passed
@Martin521
Copy link
Contributor

This is really nice.
And BTW thanks also for reducing the noise in the test output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants