aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist
AgeCommit message (Collapse)Author
2023-02-13cmd/dist: use a copy of platform.BuildModeSupportedIan Lance Taylor
The dist tool already includes a similar duplicate of BuildModeSupported. Replace it with an exact copy, to make it easier to maintain going forward. Change-Id: Id14a6c5a48f92d843e02218d87cc62c6b001923b Reviewed-on: https://go-review.googlesource.com/c/go/+/467495 Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-02-10cmd/dist: remove windows-amd64-2008 code pathqmuntal
`windows-amd64-2008` builder does no longer exist on go1.20, so it is safe to remove conditions checking for that name. Updates #57003 Closes #56904 Change-Id: I941ccc64cda0af3b9356996c4b581700afa81987 Reviewed-on: https://go-review.googlesource.com/c/go/+/467175 Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
2023-02-03cmd/dist: do not include runtime/internal/sys in cmd staleness checksBryan C. Mills
Since CL 454836, cmd/dist has built the packages in 'cmd' with different settings than those in 'std': namely, for' cmd' we disable the use of cgo, and (since CL 463740) if GO_BUILDER_NAME is non-empty or the VERSION file indicates a release version we also set GOFLAGS=-trimpath. However, since at least CL 73212 the staleness checks performed by cmd/dist for the “toolchain” targets (a subset of 'cmd') have included the package "runtime/internal/sys" (which is in 'std', not 'cmd'). At that time, cmd/go did not have a separate build cache, so it would not have been possible to check staleness for a 'cmd' build differently from 'std'. However, now that is possible, and most of the time "runtime/internal/sys" lives *only* in the build cache (and so is essentially never stale after building anything that imports it). But there is one more wrinkle: if GODEBUG=installgoroot=all is set, the packages in 'std' are still installed to GOROOT/pkg, and can once again become stale. Since the install with the 'std' configuration does not match the configuration used to build 'cmd', the staleness check fails for "runtime/internal/sys" under the 'cmd' configuration. Since we intentionally build the toolchain with a different "runtime/internal/sys" stored only in the build cache, there is no longer a point in checking that package for staleness: if it is stale, then the toolchain itself will be reported as stale anyway. So we can simply remove the package from that staleness check, and unbreak bootstrapping with GODEBUG=installgoroot=all. I tested this manually using the sequence: export GODEBUG=installgoroot=all export GO_BUILDER_NAME=linux-amd64-bcmills ./make.bash It fails the staleness check before this change, and successfully builds after. For #24904. Change-Id: I376e93e35129694a093c6675e20905a097a8b64b Reviewed-on: https://go-review.googlesource.com/c/go/+/465155 Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-02-01cmd/dist,internal/platform: reenable the c-archive build mode on iosBryan C. Mills
Also fix misc/cgo/testcarchive to provide a missing CoreFoundation dependency at link time. Fixes #58221. Updates #58172. Updates #58225. Change-Id: Ib8b6e52ed2914596615da4c427df2fe984722de6 Reviewed-on: https://go-review.googlesource.com/c/go/+/463752 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-02-01cmd/dist, internal/platform: remove some target modes that failIan Lance Taylor
Before CL 463992 there were some cases that cmd/dist did not test but that platform.BuildModeSupport permitted. In CL 463992 those conflicts were resolved in favor of platform.BuildModeSupport. However, further testing has uncovered some cases that do not in fact work. Adjust those in both cmd/dist and internal/platform. In particular, mark android-arm and android-arm64 as not supporting plugin mode. Sample failure: https://build.golang.org/log/ebba858ea9f94f076966d8cfd42348a0e9345095 Mark ios as not supporting c-archive mode. Sample failure: https://build.golang.org/log/e78a58189d94b90dc6d4b2e01a1b4a0b35d63792 Fixes #58170 Fixes #58172 Change-Id: Ic1bd18e36382cac0779aad48cb6e7b1de8eeb10d Reviewed-on: https://go-review.googlesource.com/c/go/+/464339 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-31cmd/dist, internal/platform: test agreement on supported build modesIan Lance Taylor
This synchronizes the supported build modes between cmd/dist and internal/platform, and adds a test to keep them in synch. In order to do that, this has several changes to cmd/dist, and one change to internal/platform. If the build dashboard is green after this is submitted, we can probably make the functions identical. Change-Id: Ia78ce76b193399058fde79e38dd9f23818e566a1 Reviewed-on: https://go-review.googlesource.com/c/go/+/463992 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-01-31cmd/link, cmd/dist, internal/platform: consolidate c-archive supportIan Lance Taylor
Make all the tests for whether -buildmode=c-archive is supported consistent. Base this on the historical code, on whether cmd/compile supports -shared, and whether cmd/link permits the mode. Change-Id: Ib996546906f698ade4c32b8e6c705838e4ad4b90 Reviewed-on: https://go-review.googlesource.com/c/go/+/463984 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-31cmd/dist: test goos, not gohostos, in tester.extLinkIan Lance Taylor
This error dates back to when the method was introduced in CL 6531. It only matters for the rare case of building tests on one GOOS and running them on another, and only makes a difference for the rare case where one GOOS supports external linking and another does not. Change-Id: I1a7abfb0a5bbec49ddbcd9c1a4f5c0ec43a8095c Reviewed-on: https://go-review.googlesource.com/c/go/+/463991 Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-01-31cmd/dist: set GOFLAGS=-trimpath when building cmd for releasesBryan C. Mills
Also set it on the Go builders, so that the builders more closely match releases. It looks like this change was intended to be included in CL 454836, but was commented out at some point — perhaps during debugging? — before that change was merged. For #24904. Change-Id: Ib501274520c5de366d4e9d87a1bd3c6ba2d2413f Reviewed-on: https://go-review.googlesource.com/c/go/+/463740 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-01-31cmd/dist: leave cgo enabled if external linking is requiredBryan C. Mills
Certain ios and android configurations do not yet support internal linking. On ios, attempting to build without cgo causes tests to fail on essentially every run (#57961). On android, it produces a lot of warning spam from the linker, obscuring real problems. Since external linking makes the result of `go install` depend on the installed C toolchain either way, the reproducibility benefit of disabling cgo seems minimal on these platforms anyway. Fixes #57961. For #24904. Updates #57007. Change-Id: Ied2454804e958dd670467db3d5e9ab50a40bb899 Reviewed-on: https://go-review.googlesource.com/c/go/+/463739 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Bypass: Bryan Mills <bcmills@google.com>
2023-01-30cmd/dist: keep flag list sortedRuss Cox
force before no-* Change-Id: Ia1273cd676f8fe7d116e84db2d33728561e7b17e Reviewed-on: https://go-review.googlesource.com/c/go/+/464136 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Russ Cox <rsc@golang.org>
2023-01-30cmd/dist: skip building std for the host when cross-compilingBryan C. Mills
The purpose of building the host toolchain is so that we can use it to build and test the target configuration. The host configuration should already be tested separately (with its own builder), so we do not need to build the parts of that configuration that are not relevant to the task of building and testing the target configuration. Updates #47257. Change-Id: I814778d2d65b1f2887c9419232b5bfd4068f58af Reviewed-on: https://go-review.googlesource.com/c/go/+/461676 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2023-01-30cmd/dist: skip rebuilding packages during builder testingBryan C. Mills
Since packages in "std" no longer have install targets, checking them for staleness is somewhat meaningless: if they are not cached they will be rebuilt anyway, and without installed archives against which we can compare them the staleness check will not detect builder skew. It would still be meaningful to check "cmd" for staleness, but (especially on sharded VM-based builders) that is a fairly expensive operation relative to its benefit. If we are really interested in detecting builder skew and/or build reproducibility, we could instead add a "misc" test (similar to "misc/reboot", or perhaps even a part of that test) that verifies that bootstrapped binaries are reproducible. For #57734. Updates #47257. Updates #56896. Change-Id: I8683ee81aefe8fb59cce9484453df9729bdc587c Reviewed-on: https://go-review.googlesource.com/c/go/+/452775 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Austin Clements <austin@google.com>
2023-01-27cmd/dist: remove dead code for META_BUILDLET_HOST_TYPEBryan C. Mills
This environment variable appears to never be used; according to https://cs.opensource.google/search?q=META_BUILDLET_HOST_TYPE&ss=go&ssfr=1 this is the only reference to it in the whole Go project. Change-Id: I6426a1d9e16441358c0e88daf4358112e659b2a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/463741 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-26cmd/dist: restore the original GOCACHE before building std and cmdBryan C. Mills
The user is likely to run other commands that need these libraries immediately after they are built. For #57734. Updates #56889. Change-Id: I2a1a234e6031d85f017ee692ea1ace8c6e0e7355 Reviewed-on: https://go-review.googlesource.com/c/go/+/452679 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2023-01-26cmd/dist: require absolute path to executable in flattenCommandLineBryan C. Mills
This should help to prevent bugs from unintended use of system tools, especially the system or bootstrap "go" command. (Suggested by Austin on CL 452678.) Updates #31567. Change-Id: I71809ee30d06eda4b5ff8f90656d4f1a462d35dd Reviewed-on: https://go-review.googlesource.com/c/go/+/452776 Reviewed-by: Austin Clements <austin@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-01-26cmd/dist: consistently use $GOROOT/bin/go instead of just "go"Bryan C. Mills
Also remove existing special cases that transform "go" into gorootBinGo, because they make debugging and code-reviews more difficult: log messages that don't include the full path can mask bugs like #31567, and the reader of the code has to trace through the various call chains to verify that the correct "go" is being used. Instead, we can make the use of the correct "go" command plainly obvious in the code by using one consistent name for it. (Prior to this CL, we had three different names for it: gorootBinGo, "go", and cmdGo. Now we have only one. Updates #31567. Change-Id: Ia9ff27e5e800c79af5a4e9f2803c9ea5ccafbf35 Reviewed-on: https://go-review.googlesource.com/c/go/+/452678 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-01-24all: fix some commentscui fliter
Change-Id: I3e9f05d221990b1ae464545d6d8b2e22c35bca21 Reviewed-on: https://go-review.googlesource.com/c/go/+/463077 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-23internal/abi,runtime: refactor map constants into one placeDavid Chase
Previously TryBot-tested with bucket bits = 4. Also tested locally with bucket bits = 5. This makes it much easier to change the size of map buckets, and hopefully provides pointers to all the code that in some way depends on details of map layout. Change-Id: I9f6669d1eadd02f182d0bc3f959dc5f385fa1683 Reviewed-on: https://go-review.googlesource.com/c/go/+/462115 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Austin Clements <austin@google.com>
2023-01-20cmd/dist: mark linux/sparc64 as a broken port, remove incomplete mapDmitri Shuralyov
The linux/sparc64 port is incomplete—it doesn't work, and it doesn't have a builder. Now that dist supports broken ports, mark it as such. The incomplete map was created to hide ports that aren't functional from dist list output. Now that we have the broken port concept, it seems largely redundant, so remove it for now. For #56679. Updates #28944. Change-Id: I34bd23e913ed6d786a4d0aa8d2852f2b926fe4b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/458516 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-01-20cmd/dist: add map of broken ports and -force flagDmitri Shuralyov
It's empty so far. The next CL adds linux/sparc64. Also add -force flag to the bootstrap.bash script so that it's possible to use it with broken ports. For #56679. Change-Id: I09c733d0df0a68df34fb808eae29be010a6da461 Reviewed-on: https://go-review.googlesource.com/c/go/+/458515 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-20cmd/dist: remove GOTESTONLY environment variableDmitri Shuralyov
This hook was added for the Go build system (x/build) to be able to set the run flag value, but it's no longer used anywhere. Remove it for now. Updates #46054. Change-Id: I64e7d68d2b270303f3bd54f73079600f209e350a Reviewed-on: https://go-review.googlesource.com/c/go/+/455519 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Austin Clements <austin@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-20cmd/dist: remove hardcoded timeout scale for arm and mips{,le,64,64le}Dmitri Shuralyov
Fixes #57117. Change-Id: If36da5b138a5e92e27688719ffc1c4dafd590957 Reviewed-on: https://go-review.googlesource.com/c/go/+/455518 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-17cmd/dist: make toolchain build reproducibleRuss Cox
- Build cmd with CGO_ENABLED=0. Doing so removes the C compiler toolchain from the reproducibility perimeter and also results in cmd/go and cmd/pprof binaries that are statically linked, so that they will run on a wider variety of systems. In particular the Linux versions will run on Alpine and NixOS without needing a simulation of libc.so.6. The potential downside of disabling cgo is that cmd/go and cmd/pprof use the pure Go network resolver instead of the host resolver on Unix systems. This means they will not be able to use non-DNS resolver mechanisms that may be specified in /etc/resolv.conf, such as mDNS. Neither program seems likely to need non-DNS names like those, however. macOS and Windows systems still use the host resolver, which they access without cgo. - Build cmd with -trimpath when building a release. Doing so removes $GOPATH from the file name prefixes stored in the binary, so that the build directory does not leak into the final artifacts. - When CC and CXX are empty, do not pick values to hard-code into the source tree and binaries. Instead, emit code that makes the right decision at runtime. In addition to reproducibility, this makes cross-compiled toolchains work better. A macOS toolchain cross-compiled on Linux will now correctly look for clang, instead of looking for gcc because it was built on Linux. - Convert \ to / in file names stored in .a files. These are converted to / in the final binaries, but the hashes of the .a files affect the final build ID of the binaries. Without this change, builds of a Windows toolchain on Windows and non-Windows machines produce identical binaries except for the input hash part of the build ID. - Due to the conversion of \ to / in .a files, convert back when reading inline bodies on Windows to preserve output file names in error messages. Combined, these four changes (along with Go 1.20's removal of installed pkg/**.a files and conversion of macOS net away from cgo) make the output of make.bash fully reproducible, even when cross-compiling: a released macOS toolchain built on Linux or Windows will contain exactly the same bits as a released macOS toolchain built on macOS. The word "released" in the previous sentence is important. For the build IDs in the binaries to work out the same on both systems, a VERSION file must exist to provide a consistent compiler build ID (instead of using a content hash of the binary). For #24904. Fixes #57007. Change-Id: I665e1ef4ff207d6ff469452347dca5bfc81050e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/454836 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-17time/tzdata: generate zip constant during cmd/distRuss Cox
We have a make.bash-time generation capability, so use it to generate the embedded zip file for time/tzdata. This is one less file to try to review in CLs like CL 455356. For #22487. Fixes #43350. Change-Id: I2fcd0665fa0b1c830baec5fb4cd714483fea25a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/455357 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-12-06run.bash, cmd/dist: document GO_TEST_SHORT and GO_TEST_TIMEOUT_SCALEDmitri Shuralyov
These environment variables affect cmd/dist, and in turn run.bash. They exist primarily for the Go build system, but are still needed sometimes when investigating problems. Document them in one place. Fixes #46054. Change-Id: I5dea2ac79b0d203d2f3c9ec2980382f62bead5cd Reviewed-on: https://go-review.googlesource.com/c/go/+/455517 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2022-12-01cmd/dist: remove pkg/$GOOS_$GOARCH and pkg/obj at exitMichael Matloob
pkg/obj will be empty, so just remove it. pkg/$GOOS_$GOARCH will be empty unless the user has specified GODEBUG=installgoroot=all, so check if it's empty, and if so, delete it. Also remove xreaddirfiles, which is unused. Also remove the copy of pkg/$GOOS_$GOARCH in the cmd/go test TestNewReleaseRebuildsStalePackagesInGOPATH. The directory is empty so copying it has no effect. For #47257 Change-Id: Ief90b882d157bd16078cd5d2b83a915bfc831f9a Reviewed-on: https://go-review.googlesource.com/c/go/+/453496 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-11-28cmd/api: rewrite as package testRuss Cox
No one ever runs 'go tool api', because the invocation has gotten unwieldy enough that it's not practical. And we don't support it as a standalone tool for other packages - it's not even in the distribution. Making it an ordinary package test lets us invoke it more easily from cmd/dist (as go test cmd/api -check) and avoids the increasingly baroque code in run.go to build a command line. Left in cmd/api even though it's no longer a command because (1) it uses a package from cmd/vendor and (2) it uses internal/testenv. Otherwise it could be misc/api. Fixes #56845. Change-Id: I00a13d9c19b1e259fa0e6bb93d1a4dca25f0e8c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/453258 Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Russ Cox <rsc@golang.org>
2022-11-22cmd/dist: revise skip sequence added in CL 452763Than McIntosh
Revise the code added in CL 452763 that skips some of the -race tests on older windows builders. The old-style skip was doing a log.Printf, which wound up being interpreted in "-list" mode. Fix is to pass in a special rtPreFunc when registering the test (thanks Austin for the fix suggestion). Updates #56904. Change-Id: Ia6ea31fb7f011b539173f47357ab3bf7389f256d Reviewed-on: https://go-review.googlesource.com/c/go/+/452769 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Than McIntosh <thanm@google.com>
2022-11-22cmd/dist: skip -race w/ external linkage on windows 2008Than McIntosh
Add a skip for the external-linkage part of the race detector test for elderly versions of windows, until the underlying cause for the problem can be determined. Updates #56904. Change-Id: I3e8650ff66f34efefabcd6bc343d57124539901b Reviewed-on: https://go-review.googlesource.com/c/go/+/452763 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> Auto-Submit: Than McIntosh <thanm@google.com>
2022-11-22cmd/dist: skip the staleness check for 'cmd' when testing on aix-ppc64Bryan C. Mills
The gcc toolchain on the aix-ppc64 builder apparently does not achieve reproducible builds for packages that use cgo, which causes the binaries in cmd that use package "net" (cmd/go, cmd/pprof, and cmd/trace) to appear stale whenever the Go build cache is cleared. For now, we work around the staleness by rebuilding std and simply not checking whether cmd is stale. For #56896. Updates #47257. Change-Id: I15f86e72dee53904b881710d5d5d613872361510 Reviewed-on: https://go-review.googlesource.com/c/go/+/452680 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ayappan Perumal <ayappanec@gmail.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-21cmd/dist: add serial/small build option for GOMAXPROCS=1David Chase
If GOMAXPROCS=1, force serial execution, which is better for debugging build problems and also minimizes footprint, if that happens to matter. This wasn't good when the bootstrap was 1.4 because there default GOMAXPROCS=1, but that is no longer the bootstrap version. Change-Id: I637e25c8acb4758795fceef63921eda359a7be29 Reviewed-on: https://go-review.googlesource.com/c/go/+/452556 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-21cmd/dist: stop trying to access runtime/internal/sys.a in debug modeCherry Mui
Now that we don't install the .a files, the installed runtime/internal/sys.a no longer exists. Stop trying to access it. Change-Id: Ic437e7ad95be6109d0b2fcfb81e840f5cb476be8 Reviewed-on: https://go-review.googlesource.com/c/go/+/451360 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-11-21cmd/dist: update to assume Go 1.17.13 as minimal Go bootstrap versionMartin Möhrmann
Replace explicit Go version names where possible with generic reference to Go bootstrap version. Updates #44505 Change-Id: I4a6439576efd40e72acd26fcc1472a1a8b0b06e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/344330 Auto-Submit: Martin Möhrmann <martin@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Martin Möhrmann <moehrmann@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-18all: add missing periods in commentscui fliter
Change-Id: I69065f8adf101fdb28682c55997f503013a50e29 Reviewed-on: https://go-review.googlesource.com/c/go/+/449757 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joedian Reid <joedian@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-17cmd/dist: skip non-race testsAustin Clements
In -race mode, the dist test command only registers the std, race, osusergo, and amd64ios tests before returning early from (*tester).registerTests. Prior to CL 450018, the osusergo and amd64ios tests weren't even affected by -race mode, so it seems their inclusion was unintentional. CL 450018 lifted the logic to run tests in race mode, which means these tests went from running without -race to running with -race. Unfortunately, amd64ios is not compatible with -race, so it is now failing on the darwin-amd64-race builder. Fix this by omitting the osusergo and amd64ios tests from -race mode, since it seems like they were really intended to be included anyway. This should fix the darwin-amd64-race builder. Updates #37486. Change-Id: I554bb60bc729dbb6f1bc926f1ea329768b0d6d81 Reviewed-on: https://go-review.googlesource.com/c/go/+/451437 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com>
2022-11-16cmd/dist: simplify old codeAustin Clements
Now that all uses of "go test" have been converted over to the new abstraction, we can delete the old helpers for building "go test" commands and simplify some code that's only used by the new abstraction now. For #37486. Change-Id: I770cd457e018160d694abcc0b6ac80f7dc2e8425 Reviewed-on: https://go-review.googlesource.com/c/go/+/450020 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com>
2022-11-16cmd/dist: convert host tests to use goTestAustin Clements
This adds support for host tests to goTest and registerTest and modifies all uses of registerHostTest to use goTest and registerTest. This eliminates the last case where go test command lines are constructed by hand. Next we'll clean up all of the infrastructure support for that. I traced all exec calls from cmd/dist on linux/amd64 and this makes only no-op changes (such as re-arranging the order of flags). Preparation for #37486. Change-Id: Icb7ec8efdac72bdb819ae24b2f585375d9d9d5b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/450019 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-11-16cmd/dist: convert most remaining tests to use goTestAustin Clements
This converts most of the remaining manual "go test" command line construction in cmd/dist to use the goTest abstraction and registerTest. At this point, the only remaining place that directly constructs go test command lines is runHostTest. This fixes a bug in the "nolibgcc:os/user" test. It was clearly supposed to pass "-run=^Test[^CS]", but the logic to override the "-run" flag for "nolibgcc:net" caused "nolibgcc:os/user" to pass *both* "-run=^Test[^CS]" and "-run=". This was then rewritten into just "-run=" by flattenCmdline, which caused all os/user tests to run, and not actually skip the expensive tests as intended. (This is a great example of why the new abstraction is much more robust than command line construction.) I traced all exec calls from cmd/dist on linux/amd64 and, other than the fix to nolibgcc:os/user, this makes only no-op changes (such as re-arranging the order of flags). For #37486. Change-Id: Ie8546bacc56640ea39f2804a87795c14a3fe4c7d Reviewed-on: https://go-review.googlesource.com/c/go/+/450018 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-11-16cmd/dist: restructure cgo_testAustin Clements
Currently, dist test has a single test called "cgo_test" that runs a large number of different "go test"s. This commit restructures cgo_test into several individual tests, each of which runs a single "go test" that can be described by a goTest object and registered with registerTest. Since this lets us raise the abstraction level of constructing these tests and these tests are mostly covering the Cartesian product of a small number of orthogonal dimensions, we pull the common logic for constructing these tests into a helper function. For consistency, we now pass -tags=static to the static testtls and nocgo tests, but this tag doesn't affect the build of these tests at all. I traced all exec calls from cmd/dist on linux/amd64 and this is the only non-trivial change. For #37486. Change-Id: I53c1efa1c38d785dc71968f05e8d7d636b553e96 Reviewed-on: https://go-review.googlesource.com/c/go/+/450017 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/dist: make registerTest take a goTestAustin Clements
The overall goal is to make registerTest the primary entry point for adding dist tests and to convert nearly all dist tests to be represented by a goTest, registered via registerTest. This will centralize the logic for creating dist tests corresponding to go tool tests. I traced all exec calls from cmd/dist on linux/amd64 and this makes only no-op changes (such as re-arranging the order of flags). For #37486. Change-Id: I4749e6f3666134d3259b54ee6055d76a4235c60c Reviewed-on: https://go-review.googlesource.com/c/go/+/450016 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/dist: use goTest for manual go test invocationsAustin Clements
This CL rewrites everywhere in dist that manually constructs an exec.Cmd to run "go test" to use the goTest abstraction. All remaining invocations of "go test" after this CL construct the command line manually, but ultimately use addCmd to execute it. I traced all exec calls from cmd/dist on linux/amd64 and this makes only no-op changes (such as re-arranging the order of flags). For #37486. Change-Id: Idc7497e39bac04def7ddaf2010881c9623e76fd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/450015 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Austin Clements <austin@google.com>
2022-11-16cmd/dist: introduce "go test" abstractionAustin Clements
This introduces an abstraction for constructing and running "go test" commands. Currently, dist test is basically a shell script written in Go syntax: it mostly just invokes lots of subprocesses, almost all of which are "go test" invocations, and it constructs those command lines directly from strings all over the place. This CL raises the level of abstraction of invoking go test. The current level of abstraction is not serving us very well: it's conveniently terse, but the actual logic for constructing a command line is typically so spread out that it's difficult to predict what command will actually run. For example, the `gotest` function constructs the basic command, but many tests want to override at least some of these flags, so flattenCmdLine has logic specific to `go test` for eliminating duplicate flags that `go test` itself would reject. At the same time, the logic for constructing many common flags is conditional, leading to a bevy of helpers for constructing flags like `-short` and `-timeout` and `-run` that are scattered throughout test.go and very easy to forget to call. This CL centralizes and flattens all of this knowledge into a new `goTest` type. This type gives dist a single, unified point where we can change anything about how it invokes "go test". There's currently some "unnecessary" abstraction in the implementation of the goTest type to separate "build" and "run" flags. This will become important later when we convert host tests and to do separate build and run steps. The following CLs will convert dist test to use this type rather than directly constructing "go test" command lines. Finally, we'll strip out the scattered helper logic for building command lines. For #37486. Change-Id: I9f1633fe6c0921696419ce8127ed2ca7b7a4e01b Reviewed-on: https://go-review.googlesource.com/c/go/+/448802 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/go: make testterminal18153 a normal testAustin Clements
Currently, cmd/go's testterminal18153 is implemented as a special test that doesn't run as part of cmd/go's regular tests. Because the test requires stdout and stderr to be a terminal, it is currently run directly by "dist test" so it can inherit the terminal of all.bash. This has a few problems. It's yet another special case in dist test. dist test also has to be careful to not apply its own buffering to this test, so it can't run in parallel and it limits dist test's own scheduler. It doesn't run as part of regular "go test", which means it usually only gets coverage from running all.bash. And since we have to skip it if all.bash wasn't run at a terminal, I'm sure it often gets skipped even when running all.bash. Fix all of this by rewriting this test to create its own PTY and re-exec "go test" to check that PTY passes through go test. This makes the test self-contained, so it can be a regular cmd/go test, we can drop it from dist test, and it's not sensitive to the environment of all.bash. Preparation for #37486. Updates #18153. Change-Id: I6493dbb0143348e299718f6e311ac8a63f5d69c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/449503 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/dist: eliminate "time" special caseAustin Clements
The registerTest function has a special case for commands that start with "time", but we don't use this case anywhere. Delete this special case and its support code. Preparation for #37486. Change-Id: Ica180417e7aa4e4fc260cb97467942bae972fdb6 Reviewed-on: https://go-review.googlesource.com/c/go/+/448801 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/dist: eliminate registerSeqTestAustin Clements
This is unused, and eliminating it lets us simplify the whole registerTest mechanism. Preparation for #37486. Change-Id: Ia6221e48192cd17775a5d662bdb389d67a9265bc Reviewed-on: https://go-review.googlesource.com/c/go/+/448800 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-16cmd/dist: add doc comments to some functionsAustin Clements
I keep having to reconstruct how dist test's command system works. This CL documents the main functions to help with this. Change-Id: Ic1102496d3c7f356e73f3fa2ea76498251f525d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/448799 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-11-16cmd/dist: add curiously missing GOOS/GOARCH combinationsAustin Clements
The cmd/dist cgo_test enumerates a large number of platforms in various special cases. Some combinations are suspiciously absent. This CL completes the combinations. I've confirmed using trybots that the newly-enabled tests pass on android/* (this is not surprising because the gohostos is never "android" anyway), windows/arm64, linux/ppc64 (no cgo), linux/loong64 (except for one test, filed #56623), linux/mips*, netbsd/arm (except for one test, filed #56629), and netbsd/arm64. The windows/arm builder is out to lunch, so I'm assuming that works. Since netbsd/arm and arm64 mostly passed these tests, I've also enabled them on netbsd/386 and netbsd/amd64, where they seem to work fine as well. Preparation for #37486. Change-Id: I04c3348e4f422d74d51e714647ca3db379e6e919 Reviewed-on: https://go-review.googlesource.com/c/go/+/448016 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-10cmd/dist: define GOPPC64_{cpu} for PPC64 targetsPaul E. Murphy
This can be used to provide better instruction selection for assembly implementations without having to implement two variants and dynamic runtime selections when a newer GOPPC64 value is used. Change-Id: I4331037d57b128137280aa7904d08d362391f81e Reviewed-on: https://go-review.googlesource.com/c/go/+/449115 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-11-09all: add missing copyright headercui fliter
Change-Id: Ia5a090953d324f0f8aa9c1808c88125ad5eb6f98 Reviewed-on: https://go-review.googlesource.com/c/go/+/448955 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>