shared locks: like LOCK_SH for HARNESS-CONFLICTS's LOCK_EX - #455
Merged
Merged
Conversation
We already have HARNESS-CONFLICTS-XXX, which is effectively an exclusive lock on the name XXX. This is a lot better than HARNESS-CATEGORY-ISOLATION, but it's still sometimes overkill. Sometimes you have ten tests, and nine of them can run at once, but the tenth can't run with any of them. CONFLICTS would serialize all ten, which stinks. SHARES lets the nine run together, but not the tenth. SHARES is the LOCK_SH to CONFLICTS' LOCK_EX. Nothing enforces it yet, though. This is just to parse the name into the queue item! A name claimed both ways in one file is almost certainly an author error, so we warn, but just treat it as exclusive. Co-authored-by: Claude <noreply@anthropic.com>
An exclusive claim (HARNESS-CONFLICTS) on a name now waits for every
holder of that name, whether shared or exclusive. A shared claim
(HARNESS-SHARES) only waits out an exclusive holder, so any number of
them run together.
This also gives Runner::State its first unit test, and makes the two
bare $task->{conflicts} dereferences in _next() tolerate a task queued
without the key.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
We read the live window of each test out of the log and check which windows were allowed to overlap. Timing-dependent by nature: the "did not overlap" half is solid, the "did overlap" half leans on the sleeps in the fixtures, but concurrency.t already does that, so it's acceptable, I guess. Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
I think these were just misplaced? Co-authored-by: Claude <noreply@anthropic.com>
Contributor
Author
|
CI failures on older Perls are because the workflow uses cpm, which requires a more recent perl. I tested on v5.14 manually and it's fine. (I made an offer elsewhere to rewrite your test workflow, lmk.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now if you have ten tests, and one of them can't run at the same time as the others, you end up putting HARNESS-CONFLICTS-WHATEVER at the top of all ten, and now they're strictly serialized.
With this branch you get HARNESS-SHARES-WHATEVER. The nine friendly tests get that, and can run alongside each other, but the greedy test keeps HARNESS-CONFLICTS-WHATEVER and now won't run with any of the others.
If you declare both in one file, it's exclusive and warns.
Bonus: tests for Test2::Harness::Runner::State