aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/README
AgeCommit message (Collapse)Author
2024-02-21cmd: remove support for GOROOT_FINALConstantin Konstantinidis
Fixes #62047 Change-Id: If7811c1eb9073fb09b7006076998f8b2e1810bfb Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/539975 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-02-05cmd/go: fix tests that fail when running a cross-compiled GOARCHBryan C. Mills
In CL 356611 I changed cmd/go to run most of its tests (instead of skipping them all) when cross-compiled, such as with GOARCH=386 on an amd64 host. Unfortunately, since we don't have a CI builder that runs long tests in a cross-compiled configuration, some of the tests have rotted since then. This fixes 'GOARCH=386 go test cmd/go' on my workstation. For #64963. Updates #53936. Change-Id: If7f4bc8e8d1ace7d36010d7a1b652fc7b2ceb276 Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-windows-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/560782 Auto-Submit: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2023-07-17cmd/go: fix tests when go.env sets GOPROXY=direct GOSUMDB=offBryan C. Mills
Tested locally by changing GOROOT/go.env. At some point perhaps we should also set up a builder that runs with some common expected modifications to go.env (such as GOTOOLCHAIN=local GOPROXY=direct GOSUMDB=off). Fixes #61358. Updates #61359. Change-Id: I365ec536bec86370e302fb726fa897400ab42cf3 Reviewed-on: https://go-review.googlesource.com/c/go/+/509637 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-05-04cmd/go: fix short tests on iosBryan C. Mills
As of CL 488076, many cmd/go tests can run on the ios-arm64-corellium builder. Some of them had made erroneous assumptions about cmd/go's use of the C toolchain. Change-Id: Ib59d9858ef3930de2b412daa4462b72065f69cfd Reviewed-on: https://go-review.googlesource.com/c/go/+/492597 Reviewed-by: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2023-04-24cmd/go: declare net hosts in script testsBryan C. Mills
Although we aren't precise about enforcing the hosts just yet, we can eventually use the declared hostnames to selectively skip tests (for example, if an external service has an outage while a Go release is being tested). Also relax the constraint to [short] in tests that require only vcs-test.golang.org, which has redirected to an in-process server since around CL 427914. Also enforce that tests that use the network actually use the [net] constraint, by setting TESTGONETWORK=panic in the test environment until the condition is evaluated. For #52545. For #54503. Updates #27494. Change-Id: I13be6b42a9beee97657eb45424882e787ac164c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/473276 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Bypass: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com>
2023-03-14cmd/go,cmd/link: prefer external linking when strange cgo flags seenThan McIntosh
This patch changes the Go command to examine the set of compiler flags feeding into the C compiler when packages that use cgo are built. If any of a specific set of strange/dangerous flags are in use, then the Go command generates a token file ("preferlinkext") and embeds it into the compiled package's archive. When the Go linker reads the archives of the packages feeding into the link and detects a "preferlinkext" token, it will then use external linking for the program by default (although this default can be overridden with an explicit "-linkmode" flag). The intent here is to avoid having to teach the Go linker's host object reader to grok/understand the various odd symbols/sections/types that can result from boutique flag use, but rather to just boot the objects in question over to the C linker instead. Updates #58619. Updates #58620. Updates #58848. Change-Id: I56382dd305de8dac3841a7a7e664277826061eaa Reviewed-on: https://go-review.googlesource.com/c/go/+/475375 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-17cmd/go: disable cgo by default if DefaultCC is absolute and doesn't existBryan C. Mills
Also fix the autocgo test from CL 450739 when DefaultCC is absolute. Change-Id: Ie282a42a1334660225e88680b63b18b7c1ecba2c Reviewed-on: https://go-review.googlesource.com/c/go/+/451219 Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2022-10-24cmd/go: replace the 'addcrlf' script command with a more general 'replace' ↵Bryan C. Mills
command This allows the "reuse_git" test to avoid depending on exact JSON blobs, which will be important when the URLs start referring to test-local vcweb servers. For #27494. Change-Id: I22fde5110b3267b8fb9fb9c59fabc3b8a8b492c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/427094 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>
2022-10-24cmd/go/internal/script: define GOOS, GOARCH, and compiler conditions using ↵Bryan C. Mills
suffixes This replaces a large set of individual GOOS and GOARCH conditions with a smaller set of more verbose conditions. On balance, the more uniform structure and more concise documentation seem worth the verbosity. For #27494. Change-Id: I73fdf9e7180a92cb1baf5d4631aeecb26ce15181 Reviewed-on: https://go-review.googlesource.com/c/go/+/420054 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2022-10-24cmd/go: replace the '[exec:git]' condition with a '[git]' conditionBryan C. Mills
This makes it more obvious that the condition is testing for something beyond just the existence of a 'git' executable. For #27494. Change-Id: I7608b6c84f9f373292687b3a2066b0ded7deb6e1 Reviewed-on: https://go-review.googlesource.com/c/go/+/421454 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>
2022-10-24cmd/go: extract the TestScript engine into a standalone packageBryan C. Mills
This change decouples the script engine from both cmd/go and the testing package; I intend to reuse it in the replacement for the vcs-test.golang.org server. This change also adds a few new script commands: - 'echo' echoes its arguments, useful for verifying argument expansion. - 'cat' prints the contents of files, useful for debugging failing script tests. - 'help' displays information about script commands and conditions, reducing the toil of maintaining lists in the README file. The 'cmp' and 'cmpenv' commands now use internal/diff instead of their own separate diff implementation. The 'env' command now writes to the script log instead of the stdout buffer. (This makes it more consistent with the behavior of other synchronous builtins.) The 'stale' command no longer logs output when a target is unexpectedly non-stale. (However, the ouput of the 'stale' command is not usually very useful anyway.) The 'grep', 'stdout', and 'stderr' commands now display matching lines (like Unix 'grep'), making their negation behavior more consistent with running real commands on a command-line. Likewise, the 'cmp' command now always displays differences. That makes it useful with the '?' prefix to produce diffs for informational purposes while debugging. For #27494. Change-Id: If49fd81d9b922d07c20618a8e2cef908191f9ef6 Reviewed-on: https://go-review.googlesource.com/c/go/+/419875 Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-28cmd/go: support new hybrid coverage instrumentationThan McIntosh
If GOEXPERIMENT=coverageredesign is in effect, introduce a new top-level '-cover' option to "go build" to turn on new-style hybrid code coverage instrumentation. Similarly, use the new instrumentation for "go test -cover". The main effects of "-cover" under the hood are to instrument files at the package level using cmd/cover and to pass additional options to the compiler when building instrumented packages. The previous workflow for "go tool -cover mypkg" would expand to a series of "go tool cover" commands (one per file) followed by a single package compilation command to build the rewritten sources. With the new workflow, the Go command will pass all of the Go files in a package to the cover tool as a chunk (along with a config file containing other parameters), then the cover tool will write instrumented versions of the sources along with another "output" config with info on coverage variable names for the the compiler. The Go command will then kick off the compiler on the modified source files, also passing in the config file generated by cmd/cover. Updates #51430. Change-Id: Id65621ff6a8c70a30168c1412c2d6f805ff3b9e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/355452 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-28cmd/go: add hook to check for GOEXPERIMENT in script testsThan McIntosh
Add a new hook to allow script tests to check whether a specific GOEXPERIMENT is enabled. Updates #51430. Change-Id: Icdf39f845ff2c8b10c634d49e9c27bc90e7984f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/402174 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-08cmd/go: avoid setting variables for '/' and ':' in TestScript subprocess ↵Bryan C. Mills
environments Also simplify platform-dependent handling of the PATH variable, to make it more like the existing platform-dependent handling for HOME and TMPDIR. Fixes #53671. Change-Id: Ica2665d3f61988c66fb6982b9feb61ca48eced79 Reviewed-on: https://go-review.googlesource.com/c/go/+/416554 Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-30cmd/go: add a 'sleep' command for script testsBryan C. Mills
Due to mtime skew we don't index mutable packages with an mtime younger than 2 seconds. In order to test indexed packages reliably, we want to be able to sleep long enough for the files in the package to be cached. (As an alternative we could instead use os.Chtimes to fake old enough timestamps, but sleeping keeps the tests more realistic.) For #53586. Change-Id: I1873f47c55a72d928451593b8c989f0092a557db Reviewed-on: https://go-review.googlesource.com/c/go/+/415474 Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-12cmd/go: fix TestScript/build_trimpath_goroot when built with a mismatched ↵Bryan C. Mills
GOROOT_FINAL Fixes #52236. Updates #51461. Change-Id: Ie91e0256afd45e9bbd60fd8cdc696363027ab696 Reviewed-on: https://go-review.googlesource.com/c/go/+/399156 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-16internal/txtar: bring back to main repo, for tests in stdRuss Cox
This used to be cmd/go/internal/txtar, and then it was moved to golang.org/x/tools/txtar and revendored from there into cmd/vendor/golang.org/x/tools/txtar. We have a use for txtar in a new test in the standard library, which cannot access cmd/vendor. But we also don't really want to vendor it into the standard library as is, because that would be the first vendoring of x/tools in std, and it would be better to keep std separate from x/tools, even for testing. Instead, since a little copying is better than a little dependency, just make a copy in internal/txtar. The package does not change. Having done that, replace the uses in cmd/go so that there's only one copy in the main repo. Change-Id: I70b5cc05da3f6ebcc0fd9052ebcb3d369fb57956 Reviewed-on: https://go-review.googlesource.com/c/go/+/384254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-01-26cmd/go: add mv and support "! cmp" in script testsBryan C. Mills
For #50183 Change-Id: Ie384333fb7a69d0d2cfaba0cfc4eb7afba2fd745 Reviewed-on: https://go-review.googlesource.com/c/go/+/380916 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2021-10-28cmd/go: consolidate fuzz-support checksBryan C. Mills
We had been repeating conditions for specific platforms and architectures to gate fuzzing tests, but the more of those tests we add the more we will have to update if the set of supported platforms and archictures expands over time. We also ought to provide a friendlier error message when 'go test -fuzz' is used on non-supported platforms. This change adds predicates in cmd/internal/sys, which already contains similar predicates for related functionality (such as the race detector), and uses those predicates in 'go test' and TestScript. For #48495 Change-Id: If24c3997aeb4d201258e21e5b6cf4f7c08fbadd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/359481 Trust: Bryan C. Mills <bcmills@google.com> Trust: Katie Hockman <katie@golang.org> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Katie Hockman <katie@golang.org>
2021-10-26cmd/go: add -asan optionFannie Zhang
The -asan option compiles Go code to use the address sanitizer. This is intended for use when linking with C/C++ code compiled with -fsanitize=address. When memory blocks are passed back and forth between C/C++ and Go, code in both languages will agree as to whether the memory is validly allocated or not, and will report errors for any use of invalid memory. Updates #44853. Change-Id: I0209002ef795cc1c823daae557fb80c906158db3 Reviewed-on: https://go-review.googlesource.com/c/go/+/298612 Trust: fannie zhang <Fannie.Zhang@arm.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-05-14cmd/go: fix a portability issue in the cd script commandManlio Perillo
Currently all script tests use the UNIX path separator with the cd command, causing the PWD environment variable to have the incorrect path separator on Windows. Call filepath.FromSlash on the cd command argument. Update the testdata/script/README to document that the cd argument must use slashes. Add a regression test. To reproduce this issue, a test must use the cd command followed by a stdout or stderr command containing the pattern $PWD. Change-Id: Ib2dc5f185cc2476451402787996d14df91f7dddb Reviewed-on: https://go-review.googlesource.com/c/go/+/319311 Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org>
2021-04-19cmd/go: drop GOEXPERIMENT in script testsAustin Clements
TestScript sets the GOEXPERIMENT environment variable to the value of buildcfg.GOEXPERIMENT() with the intent that tests can use this to inspect the value of buildcfg.GOEXPERIMENT. This has the unfortunate side-effect of also affecting the experiments enabled for all builds done by TestScript. For the most part this is harmless, but GOEXPERIMENT can be GOOS/GOARCH-sensitive, so if a test changes GOOS or GOARCH, it will continue to use the GOEXPERIMENT from the host GOOS/GOARCH rather than what makes sense (or is even allowed) in the test's GOOS/GOARCH. In fact, prior to CL 307819, TestScript set GOEXPSTRING instead of GOEXPERIMENT because it previously captured objabi.Expstring(), so the captured value didn't affect the build. There's only one experiment that actually uses TestScript's GOEXPERIMENT and there's a much better way to write that test now such that it doesn't need to read GOEXPERIMENT at all. Hence, this CL rewrites this test and drops GOEXPERIMENT from TestScript. This should fix the *-regabi builders. Change-Id: I3fcbf1f21e1b471ebc0e953c31333645553ea24c Reviewed-on: https://go-review.googlesource.com/c/go/+/310969 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2021-04-08cmd/internal/objabi: make GOEXPERIMENT be a diff from default experimentsAustin Clements
Right now the rules around handling default-on experiments are complicated and a bit inconsistent. Notably, objabi.GOEXPERIMENT is set to a comma-separated list of enabled experiments, but this may not be the string a user should set the GOEXPERIMENT environment variable to get that list of experiments: if an experiment is enabled by default but gets turned off by GOEXPERIMENT, then the string we report needs to include "no"+experiment to capture that default override. This complication also seeps into the version string we print for "go tool compile -V", etc. This logic is further complicated by the fact that it only wants to include an experiment string if the set of experiments varies from the default. This CL rethinks how we handle default-on experiments. Now that experiment state is all captured in a struct, we can simplify a lot of this logic. objabi.GOEXPERIMENT will be set based on the delta from the default set of experiments, which reflects what a user would actually need to pass on the command line. Likewise, we include this delta in the "-V" output, which simplifies this logic because if there's nothing to show in the version string, the delta will be empty. Change-Id: I7ed307329541fc2c9f90edd463fbaf8e0cc9e8ee Reviewed-on: https://go-review.googlesource.com/c/go/+/307819 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2020-08-21cmd/go/testdata/script: make list_case_collision's behavior more clearMichael Matloob
Implementing the suggestion made by bcmills on a comment on golang.org/cl/228783. Change-Id: I314a24a002c65b582ea51610dcc1a54a69afbb8c Reviewed-on: https://go-review.googlesource.com/c/go/+/229705 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-06-09cmd/dist: do not unset GOROOT_FINAL prior to running testsBryan C. Mills
Also do not unset it by default in the tests for cmd/go. GOROOT_FINAL affects the GOROOT value embedded in binaries, such as 'cmd/cgo'. If its value changes and a build command is performed that depends on one of those binaries, the binary would be spuriously rebuilt. Instead, only unset it in the specific tests that make assumptions about the GOROOT paths embedded in specific compiled binaries. That may cause those tests to do a little extra rebuilding when GOROOT_FINAL is set, but that little bit of extra rebuilding seems preferable to spuriously-stale binaries. Fixes #39385 Change-Id: I7c87b1519bb5bcff64babf1505fd1033ffa4f4fb Reviewed-on: https://go-review.googlesource.com/c/go/+/236819 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-05-14cmd/go: terminate TestScript commands more aggressively when the test times outBryan C. Mills
- Avoid starting subprocesses when the test is already very close to timing out. The overhead of starting and stopping processes may cause the test to exceed its deadline even if each individual process is signaled soon after it is started. - If a command does not shut down quickly enough after receiving os.Interrupt, send it os.Kill using the same style of grace period as in CL 228438. - Fail the test if a background command whose exit status is not ignored is left running at the end of the test. We have no reliable way to distinguish a failure due to the termination signal from an unexpected failure, and the termination signal varies across platforms (so may cause failure on one platform but success on another). For #38797 Change-Id: I767898cf551dca45579bf01a9d1bb312e12d6193 Reviewed-on: https://go-review.googlesource.com/c/go/+/233526 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-03-27cmd/go/internal/work: disallow testgo binary from installing to GOROOTBryan C. Mills
Installing to GOROOT makes tests non-parallelizable, since each test depends on the installed contents of GOROOT already being up-to-date and may reasonably assume that those contents do not change over the course of the test. Fixes #37573 Updates #30316 Change-Id: I2afe95ad11347bee3bb7c2d77a657db6d691cf05 Reviewed-on: https://go-review.googlesource.com/c/go/+/225897 Reviewed-by: Michael Matloob <matloob@golang.org>
2020-03-23cmd/go: define a build tag for any GOEXPERIMENT which is enabled.Dan Scales
For each experiment that has been enabled in the toolchain, define a build tag with the same name (but prefixed by "goexperiment.") which can be used for compiling alternative files for the experiment. This allows changes for the experiment, like extra struct fields in the runtime, without affecting the base non-experiment code at all. I use this capability in my CL for static lock ranking (https://go-review.googlesource.com/c/go/+/207619), so that static lock ranking can be fully enabled as a GOEXPERIMENT, but there is no overhead in the runtime when the experiment is not enabled. I added a test in cmd/go/testdata/scripts to make sure the build tags are being defined properly. In order to implement the test, I needed to provide environment variable GOEXPSTRING to the test scripts (with its value set from objabi.Expstring(), so that it can determine the experiments baked into the toolchain. I filed https://github.com/golang/go/issues/37937 to make a builder with GOEXPERIMENT set to 'staticlockranking'. This builder will ensure another variant of GOEXPERIMENT is being tested regularly for this change, as well as checking static lock ranking in the runtime. Change-Id: Ieb4b86107238febd105558c1e639d30cfe57ab5c Reviewed-on: https://go-review.googlesource.com/c/go/+/222925 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-03-18cmd/go: add a "don't care about success" operator to script_testBryan C. Mills
Use that operator to make test_race_install_cgo agnostic to whether GOROOT/pkg is writable. Updates #37573 Updates #30316 Change-Id: I018c63b3c369209345069f917bbb3a52179e2b58 Reviewed-on: https://go-review.googlesource.com/c/go/+/223746 Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-03-11cmd/go: extract module zip files in placeJay Conrod
Previously, we extracted module zip files to temporary directories with random names, then renamed them to their final locations. This failed with ERROR_ACCESS_DENIED on Windows if any file in the temporary was open. Antivirus programs did this occasionally. Retrying the rename did not work (CL 220978). With this change, we extract module zip files in place. We create a .partial file alongside the .lock file to indicate a directory is not fully populated, and we delete this at the end of the process. Updates #36568 Change-Id: I75c09df879a602841f3459322c021896292b2fdb Reviewed-on: https://go-review.googlesource.com/c/go/+/221157 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2020-02-19cmd/go: convert some coverage tests to the script frameworkMichael Matloob
This change converts TestCoverageFunc, TestCoverageDashC, TestCoverageSyncAtomicImport, TestCoverageErrorLine, TestCoverageDepLoop, TestCoverageDotImport, and TestTestBuildFailureOutput to the script framework. It adds a -exec modifier to the script framework's [exists] check to check that a file is executable. Updates #17751 Change-Id: Idc1e36c3702c94918631936f637510a6679d18a0 Reviewed-on: https://go-review.googlesource.com/c/go/+/212624 Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-01-06cmd/go: convert some testcases to the script frameworkMichael Matloob
This change converts TestFatalInBenchmarkCauseNonZeroExitStatus, TestBenchmarkLabels and TestWildCardsDoNotLookInUselessDirectories to the script framework so they can run in parallel. These tests used the testdata directory so they didn't call tg.parallel, because they couldn't be sure the testdata directory wasn't being modified while they were being run. The tests are converted to the script framework instead of being modified because the script framework tests are easier to read and are self-contained. Also remove the directory src/cmd/go/testdata/src/badc. The testcase that used it, "TestDisallowedCSourceFiles" was deleted in golang.org/cl/19613. Updates #17751 Change-Id: I0b9b417ae1a9b148067a3e5f8531229f3414f104 Reviewed-on: https://go-review.googlesource.com/c/go/+/212620 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-22cmd/go: add a 'buildmode' condition for script testsBryan C. Mills
In CL 208233 I am fixing a panic that occurs only with a specific build mode. I want that test to run on all platforms that support that build mode, but the logic for determining support is somewhat involved. For now, I am duplicating that logic into the cmd/internal/sys package, which already reports platform support for other build flags. We can refactor cmd/go/internal/work to use the extracted function in a followup CL. Updates #35759 Change-Id: Ibbaedde4d1e8f683c650beedd10849bc27e7a6e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/208457 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-18cmd/go: convert TestInstallIntoGOPATH to a script testBryan C. Mills
Also convert associated tests of GOPATH and 'go install' so that we can remove the corresponding source file from testdata/src. Updates #28387 Updates #30316 Change-Id: Id8c2fde4dc88954b29aefe71c9fa7e974a2ca932 Reviewed-on: https://go-review.googlesource.com/c/go/+/207605 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-11-12cmd/go: convert TestCacheVet to a scriptBryan C. Mills
This test was failing when GOROOT was read-only. (I'm not sure why that was the case, but it's simpler to convert to to a script than to try to debug the non-script test.) Updates #28387 Change-Id: I9943e28d990e5d8b01da10e70531f3ab99e319a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/206897 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-21cmd/go: add a flag to avoid creating unwritable directories in the module cacheBryan C. Mills
This change adds the '-modcacherw' build flag, which leaves newly-created directories (but not the files!) in the module cache read-write instead of making them unwritable. Fixes #31481 Change-Id: I7c21a53dd145676627c3b51096914ce797991d99 Reviewed-on: https://go-review.googlesource.com/c/go/+/202079 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-10-09cmd/go: document multiple conditions in TestScriptJay Conrod
This functionality already exists but was undocumented. Related to comments in CL 198797. Change-Id: Icce40bd7c362423e6ed9c20673ce3de1311e5fd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/200040 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-06-10cmd/go: in TestScript, set $GOEXE instead of $exeBryan C. Mills
$GOEXE exists and is documented in 'go env', so $exe is redundant and a bit confusing. Notably, mod_modinfo.txt already assumes that GOEXE is set (even though it isn't), and thus fails on Windows. After this CL, `go test cmd/go/...` passes on a windows-amd64-2016 builder. However, given that the $PATH on the builder is very minimal (#32430) and network access is limited, tests that rely on binaries (such as 'git') or external networking may still be broken. Updates #25300 Change-Id: I9d80f2a0fbaa8bc35fa2205b6898aeccecda4e94 Reviewed-on: https://go-review.googlesource.com/c/go/+/181542 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-24cmd/go: add -trimpath build flagRuss Cox
"go build -trimpath" trims the recorded file paths in the resulting packages and executables to avoid recording the names of any local directories. Instead, the files appear to be stored in directories named either "go/src/..." (for the standard library) or named after the module or package in which the files appear. Fixes #16860. Change-Id: I433afeeb1fdeea641286b21693fee5e0a66d607e Reviewed-on: https://go-review.googlesource.com/c/go/+/173345 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-02-26cmd/go: allow "stdout" and "stderr" as inputs to script_test "cp" commandBryan C. Mills
Updates #30241 Change-Id: I543d8914faf810835d3327baa3c84b3dff124156 Reviewed-on: https://go-review.googlesource.com/c/163519 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-15cmd/link: fix in-package syso linkingShenghou Ma
CL 146297 ignored archive members with short names that don't have the .o suffix, however, it also ignored .syso files as well. This change restores the original .syso behavior and adds a test. As the test is basically following a shell script, we make use of the existing cmd/go/testdata/script framework. To support running C compiler in the script, we added a `cc` command, which runs the C compiler along with correct platform specific arguments. Fixes #29253. Change-Id: If8520151c4d6a74ab9fe84d34bff9a4480688815 Reviewed-on: https://go-review.googlesource.com/c/154109 Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2018-12-11cmd/go: add a [root] condition to script_testBryan C. Mills
[root] reports whether the current effective user ID is 0. Updates #29127 Change-Id: I9ef42f1271ea669689011e7ceff4d918c0cecb6b Reviewed-on: https://go-review.googlesource.com/c/153637 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-11cmd/go: add a chmod command to script_testBryan C. Mills
Change-Id: I5d4f65553f6c368d101be59aae9440f5ec9573b7 Reviewed-on: https://go-review.googlesource.com/c/153461 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-08cmd/go: add goversion environment variable to testing script languageIan Lance Taylor
Updates #28221 Change-Id: I8a1e352cd9122bce200d45c6b19955cb50308d71 Reviewed-on: https://go-review.googlesource.com/c/147280 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-11-08cmd/go: add cmpenv command to testing script languageIan Lance Taylor
This will be used by later commits in this sequence. Updates #28221 Change-Id: I2b22b9f88a0183636cde9509606f03f079eb33f1 Reviewed-on: https://go-review.googlesource.com/c/147277 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-29cmd/go: support background processes in TestScriptBryan C. Mills
This will be used to test fixes for bugs in concurrent 'go' command invocations, such as #26794. See the README changes for a description of the semantics. Updates #26794 Change-Id: I897e7b2d11ff4549a4711002eadd6a54f033ce0b Reviewed-on: https://go-review.googlesource.com/c/141218 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2018-07-19cmd/go: fix TestScript on Plan 9David du Colombier
CL 123577 added TestScript. The install_rebuild_gopath test was failing on Plan 9 because it defines a GOPATH using the ':' separator, while Plan 9 expects the '\000' separator in environment variables. This change fixes the script engine by defining a new ":" environment variable set to OS-specific path list separator. The install_rebuild_gopath test has been updated to use "${:}" instead of ":". Fixes #26421. Change-Id: I58a97f882cdb48cc0836398b0d98a80ea58041ba Reviewed-on: https://go-review.googlesource.com/124435 Run-TryBot: David du Colombier <0intro@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-19cmd/go: convert final module tests to scriptsRuss Cox
Change-Id: Iba68b3aaf4a132bd4ca44edf4912a46549d2ef8f Reviewed-on: https://go-review.googlesource.com/124700 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19cmd/go: convert more module tests to scriptsRuss Cox
Change-Id: I8a36fad061bdf9a19f40531511f3f5717db13b60 Reviewed-on: https://go-review.googlesource.com/124697 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-07-19cmd/go: convert module tests to scriptsRuss Cox
Change-Id: If0976d15027db795f1383ef709c49c838cbb6953 Reviewed-on: https://go-review.googlesource.com/124696 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>