From 4b43d668c2ae42465af7cbad4bc5fa86d0b6cc15 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Thu, 2 Feb 2023 10:42:46 -0500 Subject: internal/testenv: avoid rebuilding all of std in WriteImportcfg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead, have the caller pass in an explicit list of the packages (if any) they need. After #47257, a builder running a test does not necessarily have the entire standard library already cached, especially when running tests in sharded mode. testenv.WriteImportcfg used to write an importcfg for the entire standard library — which required rebuilding the entire standard library — even though most tests need only a tiny subset. This reduces the time to test internal/abi with a cold build cache on my workstation from ~16s to ~0.05s. It somewhat increases the time for 'go test go/internal/gcimporter' with a cold cache, from ~43s to ~54s, presumably due to decreased parallelism in rebuilding the standard library and increased overhead in re-resolving the import map. However, 'go test -short' running time remains stable (~5.5s before and after). Fixes #58248. Change-Id: I9be6b61ae6e28b75b53af85207c281bb93b9346f Reviewed-on: https://go-review.googlesource.com/c/go/+/464736 Run-TryBot: Bryan Mills Reviewed-by: Cherry Mui Reviewed-by: Than McIntosh TryBot-Result: Gopher Robot Auto-Submit: Bryan Mills --- src/cmd/objdump/objdump_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd/objdump/objdump_test.go') diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go index 69b4cf4e21..226e74d81e 100644 --- a/src/cmd/objdump/objdump_test.go +++ b/src/cmd/objdump/objdump_test.go @@ -299,7 +299,7 @@ func TestDisasmGoobj(t *testing.T) { tmp := t.TempDir() importcfgfile := filepath.Join(tmp, "hello.importcfg") - testenv.WriteImportcfg(t, importcfgfile, nil) + testenv.WriteImportcfg(t, importcfgfile, nil, "testdata/fmthello.go") hello := filepath.Join(tmp, "hello.o") args := []string{"tool", "compile", "-p=main", "-importcfg=" + importcfgfile, "-o", hello} -- cgit v1.3