Add seed argument to #[gpui::test] attribute macro (#26764)

This PR introduces the arguments `seed` and `seeds` to `gpui::test`,
e.g.:
- `#[gpui::test(seed = 10)]`
- `#[gpui::test(seeds(10, 20, 30, 40))]`

Which allows us to run a test against a specific seed value without
slowing
down our tests like `iterations` does with high values.

This was motivated by a diff hunk test that only fails in a 400+ seed,
but is
slow to run 400+ times for every `cargo test`.

If your test failed with a specific seed, you can now add the `seed` arg
to
increase the chances of detecting a regression.

There are now three ways of setting seeds, the `SEED` env var,
`iterations`,
and the args this PR adds. See docs in `gpui::test`.

---

I also relaxed the limitation on `retries` not working with
`iterations`, as
that seemed unnecessary.

Release Notes:

- N/A
This commit is contained in:
João Marcos 2025-03-14 13:40:02 -03:00 committed by GitHub
parent 83dfdb0cfe
commit f587e95a7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 165 additions and 90 deletions

View file

@ -4,6 +4,7 @@ version = "0.1.0"
edition.workspace = true
authors = ["Nathan Sobo <nathan@zed.dev>"]
description = "Zed's GPU-accelerated UI framework"
repository = "https://github.com/zed-industries/zed"
publish.workspace = true
license = "Apache-2.0"