aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/dist/test.go
AgeCommit message (Collapse)Author
3 hoursmaps: add All, Keys, Values, Insert, Collectaimuz
Fixed #61900. Change-Id: Ic5962dc92b3102e7448635bef541414a2eaf415e GitHub-Last-Rev: 3c6f74d6173c519ce090e22e724da04efff79022 GitHub-Pull-Request: golang/go#67521 Reviewed-on: https://go-review.googlesource.com/c/go/+/586716 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
11 daysslices: add iterator-related functionsIan Lance Taylor
Fixes #61899 Change-Id: Icbde1ac8293723eefc3251008ae9711e756ed1b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/568477 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-04cmd/dist,internal/platform: temporarily disable race detector on openbsd/amd64Joel Sing
Unfortunately, LLVM TSAN decided to remove OpenBSD support, which means that the syso files cannot currently be regenerated (see #52090). The race_openbsd.syso contains a reference to the syscall symbol, which has been removed from OpenBSD's libc in 7.5. As such, this means that the race detector no longer works on openbsd/amd64 (at least until LLVM TSAN support is reinstated for OpenBSD). Updates #63900 Change-Id: I3474fc43a94e5197815862b7dc420b71d5e08815 Reviewed-on: https://go-review.googlesource.com/c/go/+/582255 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-26all: fix a large number of commentscui fliter
Partial typo corrections, following https://go.dev/wiki/Spelling Change-Id: I2357906ff2ea04305c6357418e4e9556e20375d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/573776 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-03-23cmd/dist: avoid CPU underutilization starting from GOMAXPROCS=2 runtimeqiulaidongfeng
This CL is doing now is: change maxbg to increase test parallelism. adjust test sequence. This CL speeds up the go tool dist test, most of the speed up is due to the fact that the three time-consuming tests cmd/internal/testdir and API check and runtime/race can be done in parallel with the GOMAXPROCS=2 runtime on a machine with enough CPU cores. In windows with an 8-core 16-thread CPU, this CL can complete all other tests before GOMAXPROCS=2 runtime -cpu=1,2,4 -quick completes. Fixes #65164 Change-Id: I56ed7031d58be3bece9f975bfc73e5c834d0a4fa GitHub-Last-Rev: 18cffb770f60399c889ceb40ef8207a2d0c488e5 GitHub-Pull-Request: golang/go#65703 Reviewed-on: https://go-review.googlesource.com/c/go/+/563916 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Commit-Queue: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-16cmd/dist,cmd/link: enable PIE buildmode on openbsd/arm64Joel Sing
The PIE buildmode works correctly on openbsd/arm64, hence enable it. Updates #59866 Change-Id: I2f3c2839893659391539fafa12891d64f867e189 Reviewed-on: https://go-review.googlesource.com/c/go/+/570375 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Joel Sing <joel@sing.id.au>
2024-03-06cmd/dist: fix typo in commentguoguangwu
Change-Id: If8bcde960348ebafec2ced0e22f315685de0bb82 GitHub-Last-Rev: 4477ade97fe831284f78183905ee5222b0d1a7cd GitHub-Pull-Request: golang/go#66124 Reviewed-on: https://go-review.googlesource.com/c/go/+/569278 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-03-04crypto: use and test purego tag consistentlyFilippo Valsorda
Fixes #58636 Updates #23172 Change-Id: I578a5597f467be45a7d6fb7582b24855b2e6512b Reviewed-on: https://go-review.googlesource.com/c/go/+/561935 Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Filippo Valsorda <filippo@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-28cmd/dist: let the three runtime -quick tests run simultaneouslyqiulaidongfeng
For #65164 Change-Id: Ied19cebd113ef91c34f613cafbeb92a335d6420d GitHub-Last-Rev: 8118be6e30ffc4edcd88b8a1d5ee3105e2c760de GitHub-Pull-Request: golang/go#65444 Reviewed-on: https://go-review.googlesource.com/c/go/+/560597 Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2024-01-24src/cmd/relnote, doc/next: add release note checkJonathan Amsterdam
Add a test that every file in api/next has corresponding release note fragments. Vendor in golang.org/x/build/relnote, which brings along some other things. Modify dist/test.go to configure the test to run on some trybots. For #64169. Change-Id: If87d11350ea6b2605bc3ab31c491fa28f1d6ee7d Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/556995 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-12-06iter, runtime: add coroutine supportRuss Cox
The exported API is only available with GOEXPERIMENT=rangefunc. This will let Go 1.22 users who want to experiment with rangefuncs access an efficient implementation of iter.Pull and iter.Pull2. For #61897. Change-Id: I6ef5fa8f117567efe4029b7b8b0f4d9b85697fb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/543319 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-11-21cmd/dist, cmd/link, internal, runtime: implement buildmode=plugin for ↵WANG Xuerui
linux/loong64 According to review, buildmode=shared has unfixed shortcomings and should be considered legacy at this time. So only buildmode=plugin is going to be added for loong64 which is a relatively new platform. Change-Id: Iac0b9f57e4ee01755458e180bb24d1b2a146fdf0 Reviewed-on: https://go-review.googlesource.com/c/go/+/480878 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: WANG Xuerui <git@xen0n.name> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn>
2023-10-06cmd/dist: emphasize when all tests are excludedDmitri Shuralyov
As observed in https://go.dev/issue/61666#issuecomment-1739476954, if a -run flag value matches no tests, dist test output doesn't do much to help users notice that was what happened. It is valid and sometimes intended¹ to match no tests, so I want to reserve failed status with exit code 1 to the actionable outcome where at least 1 test failed. But it seems reasonable to extend the existing "some were excluded" mechanism of reporting partial testing to be more helpful. In non-JSON mode, which is more likely to be used manually by humans, print a special² last line that will hopefully be easier to notice when matching no tests wasn't intended. Change nothing for -json mode since that's likely used by machines and they can make sense of 0 JSON events. The go test command already has this behavior, so this brings dist test closer³ to it. (Slightly unfortunate duplicate maintenance for us, and the need for the rare dist test users to learn its CLI quirks; oh well.) ¹ It might seem counter-intuitive at first: what's the point of calling dist test and asking it to run no tests? One possible answer is that it permits writing code capable of running N intended tests, where N is 0 or higher. That is, it allows for 0 to not be a special case that the caller would have no choice but handle differently. ² I initially considered making it say something like "N of M tests were excluded", but decided to leave it alone since the current coordinator code still has that text hardcoded and I don't want to break it. Hence the new status that I expect only humans will see. And it seems better this way anyway. ³ In particular, the "matched no tests" and "no tests to run" phrases were selected precisely because they're already used in cmd/go output. Change-Id: I6768d9932587195ae6dbc6e2c4742479e265733b Reviewed-on: https://go-review.googlesource.com/c/go/+/532115 Reviewed-by: Austin Clements <austin@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-07-28cmd/dist: update isUnsupportedVMASize test skipDmitri Shuralyov
The dist test name changed from "race" to "flag:race", "net:race", "os:race" and so on in CL 496181, we missed that this skip was checking the exact dist test name, and no builder reported a problem despite the skip becoming inactive. I considered deleting it as obsolete, but it may still be helpful if someone runs race.bash on a linux/arm64 machine configured with something other than the supported 48-bit VMA. So for now apply a simple change to restore the existing skip. Hopefully one day there will be a good way to check for unsupported VMA size and disable the race detector conditionally instead of relying on tests running, failing, and getting marked as skipped in cmd/dist. For #29948. For #37486. Change-Id: I8af6862c92fb0ee538ab27327d43c50921bd1873 Reviewed-on: https://go-review.googlesource.com/c/go/+/512116 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2023-07-28cmd/dist: handle -json flag in runPending (clean up)Dmitri Shuralyov
Document work fields a bit more, and move code that synthesizes JSON-encoded skip events to testjson.go. For #37486. For #61557. Change-Id: Iffc23cf990bc39696e1e3fce8ce5a6790fc44e78 Reviewed-on: https://go-review.googlesource.com/c/go/+/512115 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-07-28cmd/dist: handle -json flag in runPending (minimal)Dmitri Shuralyov
The -json flag is new to Go 1.21, but missed skips in runPending. This CL adds minimal code to fix that. CL 512115 cleans up a bit. For #37486. Fixes (via backport) #61557. Change-Id: I53e426c9a5585b2703f0ff6661a0470e1993f960 Reviewed-on: https://go-review.googlesource.com/c/go/+/512719 TryBot-Result: Gopher Robot <gobot@golang.org> 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>
2023-07-27cmd/dist: skip testing packages without tests in short test modeDmitri Shuralyov
For short all.bash, we can keep the small speedup of 2-10 seconds by skipping 'go test' on packages without tests. This is viable without coverage loss since the Go release process is guaranteed to run long tests for all first class ports. For golang/go#60463. Change-Id: Ib5a6bd357d757141bc8f1c1dec148a6565726587 Reviewed-on: https://go-review.googlesource.com/c/go/+/503115 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-07-27cmd/dist: test all 'std cmd' packages, even ones without _test.go filesDmitri Shuralyov
Remove the optimization added in CL 10492 that skips running 'go test' on Go packages without _test.go files. By now, 'go test' can find real problems even in packages that don't have any custom tests. On my fairly fast laptop, running go test -short on all 164 normal and 96 vendored packages without tests took around 10 seconds on the first run and 2.5 seconds on the second, a small fraction of the total all.bash time. So prioritize gains in the test coverage over those savings in all.bash time. Fixes golang/go#60463. Change-Id: I3d2bec5c367de687e57131e7fd7e6b84fed30187 Reviewed-on: https://go-review.googlesource.com/c/go/+/503095 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2023-07-21cmd/dist: apply timeout scale even if timeout isn't overriddenDmitri Shuralyov
The timeout field is documented as being available so that it's possible to override timeout by setting a non-zero value. If it's left at zero, we don't need to override the default go test timeout, but we still need to apply the timeout scale whenever it's something other than 1. Fixes (via backport) #61468. Change-Id: I63634e9b3ef8c4ec7f334b5a6b4bf3cad121355c Reviewed-on: https://go-review.googlesource.com/c/go/+/511567 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2023-07-21runtime: fix debug non-concurrent sweep mode after activeSweep changesMichael Anthony Knyszek
Currently the GC creates a sweepLocker before restarting the world at the end of the mark phase, so that it can safely flush mcaches without the runtime incorrectly concluding that sweeping is done before that happens. However, with GODEBUG=gcstoptheworld=2, where sweeping happens during that STW phase, creating that sweepLocker will fail, since the runtime will conclude that sweeping is in fact complete (all the queues will be drained). The problem however is that gcSweep, which does the non-concurrent sweeping, doesn't actually flush mcaches. In essence, this failure to create a sweepLocker is indicating a real issue: sweeping is marked as complete, but we haven't flush the mcaches yet! The fix to this is to flush mcaches in gcSweep when in a non-concurrent sweep. Now that gcSweep actually completes a full sweep, it's safe to ignore a failure to create a sweepLocker (and in fact, it *must* fail). While we're here, let's also remove _ConcurrentSweep, the debug flag. There's already an alias for it called concurrentSweep, and there's only one use of it in gcSweep. Lastly, add a dist test for the GODEBUG=gcstoptheworld=2 mode. Fixes #53885. Change-Id: I8a1e5b8f362ed8abd03f76e4950d3211f145ab1f Reviewed-on: https://go-review.googlesource.com/c/go/+/479517 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25cmd/dist: drop wasitest from special listAustin Clements
CL 498255 made runtime/internal/wasitest compatible with all platforms so that "go test std" works again. This means it no longer has to be in the special dist test list. While we're here explain the purpose of this list better and implore people to please not expand it, since almost any addition is a sign that "go test std cmd" no longer works. Change-Id: I31c7fb767787fa587f65c2697aed9ed43e95fb18 Reviewed-on: https://go-review.googlesource.com/c/go/+/498256 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com>
2023-05-25runtime: implement wasip1 netpollChris O'Hara
Implements netpoll using WASI's poll_oneoff system call. This enables non-blocking I/O support for wasip1. Change-Id: Ie395fa49d651c8b8262d485e2847dd65b0a10bc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/493357 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Julien Fabre <ju.pryz@gmail.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-05-24cmd/dist: make two related panic messages more consistentDmitri Shuralyov
In contrast to the HasSuffix argument, there's no need or benefit in having a ":" before the "racebench" variant mentioned in the message. (The variant comes after the colon separator—it doesn't include it.) Change-Id: Ie9948104de9449422037bf39245944255b98f1b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/497735 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2023-05-19cmd/dist: use "pkg[:variant]" as dist test nameDmitri Shuralyov
The work to add the -json flag to the 'dist test' command also cleaned how dist tests are tracked and registered. By now, a pair of (import path, variant) strings is sufficient to uniquely identify every dist test that exists. Some of the custom dist test names have been improved along the way. And since the names are already changing a little anyway, we use this opportunity to make them more uniform and predictable. The mapping from the old dist test names to the new is as follows: - "go_test:pkg" → "pkg" (this is the most common case) - "go_test_bench:pkg" → "pkg:racebench" - all other custom names are now called "pkg:variant", where variant is a description of their test configuration and pkg is the import path of the Go package under test CL 495016 introduced test variants and used variant names for rewriting the Package field in JSON events, and now that same name starts to also be used as the dist test name. Like previously done in CL 494496, registering a test variant involving multiple Go packages creates a "pkg:variant" dist test name for each. In the future we may combine their 'go test' invocation purely as an optimization. We can do this with the support of CL 496190 that keeps the coordinator happy and capable of working with both new and old names. In the end, all dist tests now have a consistent "pkg[:variant]" name. For #37486. For #59990. Change-Id: I7eb02a42792a9831a2f3eeab583ff635d24269e8 Co-authored-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/496181 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-19cmd/dist: remove unused functionalityAustin Clements
The moved_goroot test was the last user of the goroot functionality. Now that it's been deleted, drop this and clean up loose ends. Change-Id: Ie5e95644022dab76b1c06cf37f7729ee6616311f Reviewed-on: https://go-review.googlesource.com/c/go/+/496520 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/dist: delete moved_goroot testAustin Clements
This test is largely obviated by the goroot_executable and list_goroot_symlink cmd/go script tests. It's the last user of several special-case features in cmd/dist and runs only under a fairly constrained set of conditions (including only running on builders, not locally). Delete it. Change-Id: Icc744e3f9f04813bfd0cad2ef3e88e42617ecf5b Reviewed-on: https://go-review.googlesource.com/c/go/+/496519 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com>
2023-05-19cmd/dist: flush incomplete lines in -json modeAustin Clements
Currently, if a test prints an incomplete line and then exits, in JSON mode, the filter we use to rewrite Package lines will keep the last incomplete line in an internal buffer and never print it. In theory this should never happen anyway because the test should only write JSON to stdout, but we try pretty hard to pass through any non-JSON, so it seems inconsistent to swallow incomplete lines. Fix this by adding a testJSONFilter.Flush method and calling it in the right places. Unfortunately this is a bit tricky because the filter is constructed pretty far from where we run the exec.Cmd, so we return the flush function through the various layers in order to route it to the place where we call Cmd.Run. Updates #37486. Change-Id: I38af67e8ad23458598a32fd428779bb0ec21ac3c Reviewed-on: https://go-review.googlesource.com/c/go/+/496516 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/dist: drop remaining conditions on default cgo testsAustin Clements
Currently, dist registers cmd/cgo/internal{test,testtls,testnocgo} specially, so they're opted out of "go test std cmd". It has to register these test packages to run in various non-default build configurations, but at this point they can also run with the default build configuration (and for test and testtls, we intentionally want to test them in the default configuration; this is pointless but harmless for testnocgo). Hence, this CL drops the special registration of their default build configurations from registerCgoTests and lets them be registered as part of registerStdTests. Change-Id: Id283f3cdcdb202955a854648c0ed1e3c4aa554d1 Reviewed-on: https://go-review.googlesource.com/c/go/+/496179 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/cgo/internal/testnocgo: always run in default configurationAustin Clements
This test is actually intended to test that we can build in -static mode even without any cgo. That means it's quite harmless to run in the default build configuration (in addition to running with various other build configurations). Change-Id: Ic6cb5c0eaab83f9bd5718aae57d0fdc69afcb8b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/496178 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19cmd/cgo/internal/testtls: build and run everywhereAustin Clements
This makes testtls build and run on all platforms in the default build configuration (though it will Skip on some). Change-Id: I6aba96a82d618c9798a0d4418b40b2644cfceec9 Reviewed-on: https://go-review.googlesource.com/c/go/+/496177 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/dist: don't pass -linkmode=autoAustin Clements
This is the default value of this flag, so passing it clutters up debugging output. This also makes it clearer which tests are running with a default configuration. Change-Id: If793934829c79f087c7a6e3fa8f64dc33959c213 Reviewed-on: https://go-review.googlesource.com/c/go/+/496176 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19cmd/dist: let several cgo tests run as regular cmd testsAustin Clements
Several cgo tests no longer have any special conditions, so they can just be normal cmd tests. This brings dist's "go_test:.*" tests much closer to what "go test std cmd" runs. Change-Id: I4d09f60628a41081e97e6b6e7dd0d93df47a65bb Reviewed-on: https://go-review.googlesource.com/c/go/+/495919 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/dist: refine test conditions and enable more cgo tests on Android, iOSAustin Clements
This CL moves many cgo test conditions out of dist and into the tests themselves, now that they can use the testenv.Must* helpers. This refines a lot of the conditions, which happens to have the effect of enabling many tests on Android and iOS that are disabled by too-coarse GOOS checks in dist today. Fixes #15919. Change-Id: I2947526b08928d2f7f89f107b5b2403b32092ed8 Reviewed-on: https://go-review.googlesource.com/c/go/+/495918 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> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19cmd/dist: enable more cgo tests if GO_GCFLAGS != ""Austin Clements
Currently, we have several tests disabled if GO_GCFLAGS is non-empty. Long ago, this was critical because many of these tests use "go install" with no -gcflags and would thus overwrite std packages in GOROOT built with -gcflags=$GO_GCFLAGS. Now these packages all live in the build cache, so this is no longer a concern. The other reason for this (the reason given in the code comment), is that these tests will rebuild significant portions of std without flags. While this is still theoretically true, there are many tests that run "go build" with no -gcflags, so these tests don't contribute much overall. Empirically, on my linux/amd64 host, running these tests at all grows the Go build cache by 14%, from 1.899 GB to 2.165 GB. When building with GO_GCFLAGS="-N -l" (the only use case on the builders), enabling them grows the Go build cache by 18%, from 1.424 GB to 1.684 GB. This is only a 4 percentage point difference, and still results in a build cache that's smaller than the default build Given all this, there's little reason to carry the complexity of disabling these tests when GO_GCFLAGS != "". Removing this condition is a step toward running these as regular cmd tests. Change-Id: I2c41be721927c40a742e01476cd9a0f7650d38e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/495917 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-18cmd/dist: tweaks to -json modeAustin Clements
These are some follow-up tweaks to CL 494958. This CL drops a stale and unnecessary check and passes through trailing non-JSON output. Updates #37486. Change-Id: I7cdb73a103f9cd49767d5491812d5ad011ee5c14 Reviewed-on: https://go-review.googlesource.com/c/go/+/496297 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com>
2023-05-17cmd/dist: add -json flagAustin Clements
This enables JSON output for all tests run by dist. Most the complexity here is that, in order to disambiguate JSON records from different package variants, we have to rewrite the JSON stream on the fly to include variant information. We do this by rewriting the Package field to be pkg:variant so existing CI systems will naturally pick up the disambiguated test name. Fixes #37486. Change-Id: I0094e5e27b3a02ffc108534b8258c699ed8c3b87 Reviewed-on: https://go-review.googlesource.com/c/go/+/494958 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-17cmd/dist: refactor rtPreFunc to print skips in only one placeAustin Clements
Currently, all uses of rtPreFunc are to print a message and skip a test. When we move to JSON, the logic to just "print a message" is going to be more complicated, so refactor this so the function returns the skip message and we print it in just one place. We also rename the option to rtSkipFunc to better represent what we use it for. For #37486. Change-Id: Ibd537064fa646a956a1c0f85a5d8c6febd098dde Reviewed-on: https://go-review.googlesource.com/c/go/+/495856 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-17cmd/dist: make it possible to filter output of background commandsAustin Clements
Many of the commands dist test executes are "background" commands run by a work queue system. The work queue allows it to run commands in parallel, but still serialize their output. Currently, the work queue system assumes that exec.Cmd.Stdout and Stderr will be nil and that it can take complete control over them. We're about to inject output filters on many of these commands, so we need a way to interpose on Stdout and Stderr. This CL rearranges responsibilities in the work queue system to make that possible. Now, the thing enqueuing the work item is responsible to constructing the Cmd to write its output to work.out. There's only one place that constructs work objects (there used to be many more), so that's relatively easy, and sets us up to add filters. For #37486. Change-Id: I55ab71ddd456a12fdbf676bb49f698fc08a5689b Reviewed-on: https://go-review.googlesource.com/c/go/+/494957 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-17cmd/dist: simplify work list functionsAustin Clements
There are no uses of addCmd, so delete it. The only use of bgDirCmd is dirCmd, so inline it. Now the only function that interacts with the work queue is registerTest and dist's "background commands" are used exclusively in goTest.bgCommand and registerTest (which calls goTest.bgCommand). For #37486. Change-Id: Iebbb24cf9dbee45f3975fe9504d858493e1cd947 Reviewed-on: https://go-review.googlesource.com/c/go/+/494956 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-16cmd/dist: introduce test variantsAustin Clements
This introduces the concept of test variants in dist, which are different configurations of the same package. The variant of a test is a short string summarizing the configuration. The "variant name" of a test is either the package name if the variant is empty, or package:variant if not. Currently this isn't used for anything, but soon we'll use this as the Package field of the test JSON output so that we can disambiguate output from differently configured runs of the same test package, and naturally flow this through to any test result viewer. The long-term plan is to use variant names as dist's own test names and eliminate the ad hoc names it has right now. Unfortunately, the build coordinator is aware of many of the ad hoc dist test names, so some more work is needed to get to that point. This CL keeps almost all test names the same, with the exception of tests registered by registerCgoTests, where we regularize test names a bit using variants to avoid some unnecessary complexity (I believe nothing depends on the names of these tests). For #37486. Change-Id: I119fec2872e40b12c1973cf2cddc7f413d62a48c Reviewed-on: https://go-review.googlesource.com/c/go/+/495016 Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-16cmd/dist: put cgo tests under a "Testing cgo" headingAustin Clements
Currently the cgo tests mostly use their package name as a heading, which means we get a large number of test sections that each have a single test package in them. Unify them all under "Testing cgo" to reduce output noise. This leaves just the cmd/api test without a heading, so we give it a heading and require that all tests have a heading. Change-Id: I24cd9a96eb35bbc3ff9335ca8a382ec2426306c1 Reviewed-on: https://go-review.googlesource.com/c/go/+/494497 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-16cmd/dist: refactor adding to the test list into a methodAustin Clements
Currently, there are four places that add distTests to the tester.tests list. That means we're already missing a few name uniqueness checks, and we're about to start enforcing some more requirements on tests that would be nice to have in one place. Hence, to prepare for this, this CL refactors the process of adding to the tester.tests list into a method. That also means we can trivially use a map to check name uniqueness rather than an n^2 slice search. For #37486. Change-Id: Ib7b64c7bbf65e5e870c4f4bfaca8c7f70983605c Reviewed-on: https://go-review.googlesource.com/c/go/+/495015 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-12cmd/dist: use registerStdTestSpecially for normal Go tests onlyDmitri Shuralyov
It was my oversight in CL 463276 to skip registerStdTestSpecially packages in the race bench test registration loop. Package testdir has no benchmarks and doesn't need to be skipped. (And if it had benchmarks, it's very unlikely they'd need any special handling.) By now there are more cmd/cgo/internal/... packages that are registered specially, and there isn't a need for their few benchmarks not to be used for the purpose of race bench tests. If the 3 benchmarks in cmd/cgo/internal/test were to require something special, then we can add it to a new registerRaceBenchTestSpecially map with a comment, and do register them specially in registerTests instead of forgetting to. This restores the automatic 'go_test_bench:cmd/cgo/internal/test' registration and reduces prevalence of registerStdTestSpecially a bit. For #37486. For #56844. Change-Id: I1791fe5bf94cb4b4e0859c5fff4e7a3d5a23723e Reviewed-on: https://go-review.googlesource.com/c/go/+/494656 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2023-05-12cmd/cgo/internal/testsanitizers: build on all platformsAustin Clements
This test package uses the Pdeathsig field of syscall.SysProcAttr, which is only available on a few platforms. Currently, dist test checks for compatible platforms and only registers it as part of all.bash on platforms where it can build. But this doesn't help if you're just trying to type check everything in cmd. Make this package pass type checking by moving the condition from dist into build tags on the test package itself. For #60164. Updates #37486. Change-Id: I58b12d547c323cec895320baa5fca1b82e99d1b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/494658 Auto-Submit: Austin Clements <austin@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Austin Clements <austin@google.com>
2023-05-12internal/testdir: move to cmd/internal/testdirDmitri Shuralyov
The effect and motivation is for the test to be selected when doing 'go test cmd' and not when doing 'go test std' since it's primarily about testing the Go compiler and linker. Other than that, it's run by all.bash and 'go test std cmd' as before. For #56844. Fixes #60059. Change-Id: I2d499af013f9d9b8761fdf4573f8d27d80c1fccf Reviewed-on: https://go-review.googlesource.com/c/go/+/493876 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-12cmd/dist: drop goTest.dirAustin Clements
At this point all tests are regular packages in std or cmd, so we no longer need goTest.dir. Change-Id: I46a0c7b4464b0738e9959e41bf840ba1b73e3590 Reviewed-on: https://go-review.googlesource.com/c/go/+/494194 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-05-12test/bench: deleteAustin Clements
Russ added test/bench/go1 in CL 5484071 to have a stable suite of programs to use as benchmarks. For the compiler and runtime we had back then, those were reasonable benchmarks, but the compiler and runtime are now far more sophisticated and these benchmarks no longer have good coverage. We also now have better benchmark suites maintained outside the repo (e.g., golang.org/x/benchmarks). Keeping test/bench/go1 at this point is actively misleading. Indirectly related to #37486, as this also removes the last package dist test runs outside of src/. Change-Id: I2867ef303fe48a02acce58ace4ee682add8acdbf Reviewed-on: https://go-review.googlesource.com/c/go/+/494193 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-12misc/reboot: move to cmd/internal/bootstrap_testAustin Clements
This is the last test run from misc by dist. For #37486. Change-Id: I1a70ded29ba0de548c9a16611ba987a258121e80 Reviewed-on: https://go-review.googlesource.com/c/go/+/493606 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-12cmd/dist: drop host test supportAustin Clements
Host tests are used for emulated builders that use cross-compilation. Today, this is the android-{386,amd64}-emu builders and all wasm builders. These builders run all.bash on a linux/amd64 host to build all packages and most tests for the emulated guest, and then run the resulting test binaries inside the emulated guest. A small number of test packages are “host tests”: these run on the host rather than the guest because they invoke the Go toolchain themselves (which only lives on the host) and run the resulting binaries in the guest. However, this host test mechanism is barely used today, despite being quite complex. This complexity is also causing significant friction to implementing structured all.bash output. As of this CL, the whole host test mechanism runs a total of 10 test cases on a total of two builders (android-{386,amd64}-emu). There are clearly several tests that are incorrectly being skipped, so we could expand it to cover more test cases, but it would still apply to only two builders. Furthermore, the two other Android builders (android-{arm,arm64}-corellium) build the Go toolchain directly inside Android and also have access to a C toolchain, so they are able to get significantly better test coverage without the use of host tests. This suggests that the android-*-emu builders could do the same. All of these tests are cgo-related, so they don't run on the wasm hosts anyway. Given the incredibly low value of host tests today, they are not worth their implementation complexity and the friction they cause. Hence, this CL drops support for host tests. (This was also the last use of rtSequential, so we drop support for sequential tests, too.) Fixes #59999. Change-Id: I3eaca853a8907abc8247709f15a0d19a872dd22d Reviewed-on: https://go-review.googlesource.com/c/go/+/492986 Reviewed-by: Bryan Mills <bcmills@google.com> 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>
2023-05-12cmd/dist,internal/testdir: more cooperative host test mechanismAustin Clements
On cross-compiling builder machines, we run internal/testdir on the host, where it can access the Go toolchain to build binaries for the guest and run them through an exec wrapper. Currently this uses dist test's existing host test mechanism, which is quite complicated and we are planning to eliminate (#59999). Switch internal/testdir to use a more cooperative mechanism. With this CL, dist still understands that it has to build and run the test using the host GOOS/GOARCH, but rather than doing complicated manipulation of environment variables itself, it passes the guest GOOS/GOARCH to the test, which can easily inject it into its environment. This means dist test can use "go test" directly, rather than having to split up the build and run steps. For #37486. Change-Id: I556938c0b641960bb778b88b13f2b26256edc7c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/492985 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>