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 async GlobalSetup/Cleanup with InProcessEmit toolchain #2109

Merged

Conversation

timcassell
Copy link
Collaborator

@timcassell timcassell commented Sep 20, 2022

Fixes #1738 and fixes #2236.

@timcassell timcassell mentioned this pull request Sep 20, 2022
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from a18e5c4 to d7ceb27 Compare September 20, 2022 04:59
@timcassell timcassell marked this pull request as draft September 20, 2022 05:03
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from d7ceb27 to 79ffa8d Compare September 20, 2022 05:06
@timcassell timcassell marked this pull request as ready for review September 20, 2022 06:07
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch 4 times, most recently from c4a07b0 to ac7210d Compare September 26, 2022 15:05
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch 2 times, most recently from 4618084 to 35948a1 Compare January 2, 2023 08:09
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from 35948a1 to a0ebccf Compare February 17, 2023 23:21
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from a0ebccf to a84da10 Compare March 10, 2024 06:01
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from a84da10 to f27e83b Compare March 19, 2024 22:20
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from f27e83b to 95c5485 Compare April 19, 2024 21:52
@timcassell timcassell force-pushed the async-globalsetup-inprocessemit branch from 95c5485 to ea5639b Compare August 30, 2024 16:06
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for providing the fix @timcassell and apologies for not noticing the PR (due to the fact that I work on the .NET Team I get few dozens of GH notifications a day).

[InlineData(typeof(GlobalSetupCleanupTask))]
[InlineData(typeof(GlobalSetupCleanupValueTask))]
[InlineData(typeof(GlobalSetupCleanupValueTaskSource))]
public void InProcessEmitToolchainSupportsSetupAndCleanup(Type benchmarkType)
Copy link
Member

Choose a reason for hiding this comment

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

So far this test was a [Fact] (having a single test case), so we did not have to worry about multiple tests accessing the same static field at the same time.

As long as we keep the test parallelization disabled here:

"parallelizeAssembly": false,
"parallelizeTestCollections": false

It's OK. But if we ever change our policy on that, multiple tests may update Counters fields at the same time and make this test flaky.

There is no need to change anything as of now, just something to keep in mind when writing more tests in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

According to the documentation,

By default, each test class is a unique test collection. Tests within the same test class will not run in parallel against each other.

So we should be good, regardless of that setting.

@timcassell timcassell merged commit 5f0c47b into dotnet:master Nov 26, 2024
8 checks passed
@timcassell timcassell deleted the async-globalsetup-inprocessemit branch November 26, 2024 18:54
@timcassell timcassell added this to the v0.14.1 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants