Skip to main content

run_test

Function run_test 

Source
pub fn run_test(
    num_iterations: usize,
    explicit_seeds: &[u64],
    max_retries: usize,
    test_fn: &mut (dyn RefUnwindSafe + Fn(TestDispatcher, u64)),
    on_fail_fn: Option<fn()>,
)
Expand description

Runs test_fn for each seed, retrying a failing seed up to max_retries times.

The #[gpui::test] macro calls this function. It chooses seeds from the macro’s arguments and these environment variables:

  • ITERATIONS=n overrides the number of iterations.
  • SEED=n runs only seed n, or, with more than one iteration, the seeds n to n + iterations - 1. It replaces explicit_seeds.

When more than one seed runs, each seed is printed before it runs, and a failing seed is printed when its last attempt fails. After the last failure, on_fail_fn runs, then the panic is re-raised.