aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2024-05-01 13:42:46 +0000
committerGopher Robot <gobot@golang.org>2024-05-03 16:41:38 +0000
commit44e48c7e6cb0aceccae6535b218748d9f312fc89 (patch)
treed82bdc6c0ff24bae856e8b44192f65efa09e83f2 /src/internal
parent18dd68267263b0b37c14969349f7faa59556b1a8 (diff)
downloadgo-44e48c7e6cb0aceccae6535b218748d9f312fc89.tar.gz
go-44e48c7e6cb0aceccae6535b218748d9f312fc89.zip
hash/maphash: parallel run test
This is a reapplication of CL 564576. This reduces the go test hash/maphash time by more than half. After investigation it was confirmed that the original CL would cause OOM when 32-bit machine. This CL add testenv.ParallelOn64Bit for tests that can be parallel on 64-bit machines, it is not parallel on 32-bit machines, because CL 564995 require the same API. Change-Id: I1b7feaa07716cb3f55db4671653348fabf2396b0 GitHub-Last-Rev: 28277255587f6a1b92b9bf1848e1f53adaca64dc GitHub-Pull-Request: golang/go#66359 Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/572195 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/testenv/testenv.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index 3b9d2fd1e9..9fb92406e8 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -16,6 +16,7 @@ import (
"flag"
"fmt"
"internal/cfg"
+ "internal/goarch"
"internal/platform"
"os"
"os/exec"
@@ -511,3 +512,13 @@ func WriteImportcfg(t testing.TB, dstPath string, packageFiles map[string]string
func SyscallIsNotSupported(err error) bool {
return syscallIsNotSupported(err)
}
+
+// ParallelOn64Bit calls t.Parallel() unless there is a case that cannot be parallel.
+// This function should be used when it is necessary to avoid t.Parallel on
+// 32-bit machines, typically because the test uses lots of memory.
+func ParallelOn64Bit(t *testing.T) {
+ if goarch.PtrSize == 4 {
+ return
+ }
+ t.Parallel()
+}