]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: limit GOMAXPROCS in TestScript/test_fuzz_.*
authorBryan C. Mills <bcmills@google.com>
Thu, 1 Feb 2024 18:53:46 +0000 (13:53 -0500)
committerGopher Robot <gobot@golang.org>
Thu, 1 Feb 2024 20:09:52 +0000 (20:09 +0000)
This limits the throughput and resource consumption of the fuzz
workers in the tests, which also reduces the likelihood of running out
of address space in the fuzz coordinator during the test.

(Ideally the coordinator should not be limited by address space;
this just works around the failure mode in the tests for now.)

For #65434.

Change-Id: I3086c6278d6803a3dbf17a46ed01b68cedc92ad9
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/560515
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/go/testdata/script/test_fuzz_deadline.txt
src/cmd/go/testdata/script/test_fuzz_fuzztime.txt

index 46d3521558fe33e3909d40dd365de71493639f2b..a51df345e988a0c37d14951aedc55ab4b7237a87 100644 (file)
@@ -2,6 +2,16 @@
 [short] skip
 env GOCACHE=$WORK/cache
 
+# Warm up the build cache with GOMAXPROCS unrestricted.
+go test -c -o $devnull
+
+# For the fuzzing phase, we reduce GOMAXPROCS to avoid consuming too many
+# resources during the test. Ideally this would just free up resources to run
+# other parallel tests more quickly, but unfortunately it is actually necessary
+# in some 32-bit environments to prevent the fuzzing engine from running out of
+# address space (see https://go.dev/issue/65434).
+env GOMAXPROCS=2
+
 # The fuzz function should be able to detect whether -timeout
 # was set with T.Deadline. Note there is no F.Deadline, and
 # there is no timeout while fuzzing, even if -fuzztime is set.
index 28ef3bf7debf19a2923f2c6f64bd2cbe8b70ea88..027c434a322ec13ba25f58ae12b3cf25647ee5b5 100644 (file)
@@ -5,6 +5,13 @@ env GOCACHE=$WORK/cache
 # There are no seed values, so 'go test' should finish quickly.
 go test
 
+# For the fuzzing phase, we reduce GOMAXPROCS to avoid consuming too many
+# resources during the test. Ideally this would just free up resources to run
+# other parallel tests more quickly, but unfortunately it is actually necessary
+# in some 32-bit environments to prevent the fuzzing engine from running out of
+# address space (see https://go.dev/issue/65434).
+env GOMAXPROCS=2
+
 # Fuzzing should exit 0 after fuzztime, even if timeout is short.
 go test -timeout=3s -fuzz=FuzzFast -fuzztime=5s