Skip to content

Make nextest work better#20

Merged
flub merged 3 commits intomainfrom
flub/less-macro-code
Mar 15, 2026
Merged

Make nextest work better#20
flub merged 3 commits intomainfrom
flub/less-macro-code

Conversation

@flub
Copy link
Copy Markdown
Owner

@flub flub commented Mar 14, 2026

  • Move some code around from macros to private module
  • Fix nextest race condition that creates too many directories
  • Try deal better with concurrent different runs

@flub flub force-pushed the flub/less-macro-code branch from fae8a88 to 398826a Compare March 14, 2026 15:30
That's easier to write and test and makes the api surface of the
private module a bit smaller.
@flub flub force-pushed the flub/less-macro-code branch from 398826a to 30540f7 Compare March 14, 2026 16:51
@flub flub changed the title Move some code from the macro to the private module Make nextest work better Mar 14, 2026
flub added 2 commits March 15, 2026 11:03
When multiple processes are racing to create the next testdir, as is
the case with cargo-nextest, a process might encounter a a numbered
dir with no cargo-pid file present.

Previously it would assume this directory can not be used and create
the next one. Which results in cargo-nextest creating directories per
thread, often deleting some earlier testdirs that are being used by
the same testrun.

By waiting a little for the pidfile to appear we can avoid this and do
correctly reuse the directory.

If two processes create the same numbered dir concurrently this will
be fine, since only one will create the cargo-pid file or they will
create the same cargo-pid file.

Fixes #17.
If multiple test runs are started at virutally the same time they
could accidentally start using the same testdir. This protects against
this by making sure to not overwrite a pidfile and check if the
correct pid is inside. If it is not, then it tries again.
@flub flub force-pushed the flub/less-macro-code branch from f45d51e to 8435461 Compare March 15, 2026 10:04
@flub flub merged commit 0963b97 into main Mar 15, 2026
6 checks passed
@flub flub deleted the flub/less-macro-code branch March 15, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant