From: Cherry Mui Date: Fri, 1 Jul 2022 16:56:39 +0000 (-0400) Subject: misc/cgo/test: make TestSetgidStress cheaper X-Git-Tag: go1.19rc1~6 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4484c30f788835d8dda0afcefdb12e4b25b2c312;p=gostls13.git misc/cgo/test: make TestSetgidStress cheaper TestSetgidStress spawns 1000 threads, which can be expensive on some platforms or slow builders. Run with 50 threads in short mode instead. This makes the failure less reproducible even with buggy code. But one can manually stress test it (e.g. when a flaky failure appear on the builder). Fixes #53641. Change-Id: I33b5ea5ecaa8c7a56f59c16f9171657ee295db47 Reviewed-on: https://go-review.googlesource.com/c/go/+/415677 Reviewed-by: Austin Clements TryBot-Result: Gopher Robot Run-TryBot: Cherry Mui --- diff --git a/misc/cgo/test/setgid2_linux.go b/misc/cgo/test/setgid2_linux.go index d239893f43..9069cff334 100644 --- a/misc/cgo/test/setgid2_linux.go +++ b/misc/cgo/test/setgid2_linux.go @@ -20,7 +20,10 @@ import ( ) func testSetgidStress(t *testing.T) { - const N = 1000 + var N = 1000 + if testing.Short() { + N = 50 + } ch := make(chan int, N) for i := 0; i < N; i++ { go func() {