Closed vfaronov closed 3 years ago
Right now, things like (*T).Helper()
or (*T).Fatalf()
are safe for concurrent use (they either delegate ot testing.(*T)
, or use a mutex internally), but drawing from (*T)
is not. As rapid relies on reproducibility for shrinking, I am not sure that allowing concurrent draws makes a lot of sense. Documenting this definitely sound like a good idea.
I would like to test a program’s concurrent behavior by calling it from multiple goroutines, each imitating some workload. In each goroutine, I would make calls such as
rapid.Int().Draw(t, ...)
, possibly alsot.Helper()
,t.Errorf()
. But it’s not clear if such concurrent calls are safe onrapid.(*T)
. By contrast,testing.(*T).Helper
andErrorf
are documented as concurrent-safe.If
rapid.(*T)
is safe for concurrent use, this should be documented. If it is not safe, I think it should be made safe.I see the problems with reproducibility though...