summaryrefslogtreecommitdiff
path: root/src/cmd/go/internal/script/cmds.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/go/internal/script: retry ETXTBSY errors in scriptsBryan C. Mills2023-01-311-15/+31
| | | | | | | | | | | Fixes #58019. Change-Id: Ib25d668bfede6e87a3786f44bdc0db1027e3ebec Reviewed-on: https://go-review.googlesource.com/c/go/+/463748 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
* cmd/go: use Join functions instead of adding path separators to stringsBryan C. Mills2023-01-311-3/+15
| | | | | | | | | | | | | | | | | | | | | Adding a file path separator is incorrect for a file path that may be the root directory on a Unix platform (such as in a container or chroot). Adding a path separator is incorrect for a package path prefix that may be the empty string (as in the "std" module in GOROOT/src). And in both cases, a Join function is arguably clearer and simpler anyway. Fixes #51506 (maybe). Change-Id: Id816930811ad5e4d1fbd206cddf219ecd4ad39a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/463178 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>
* all: fix problematic commentscui fliter2022-11-111-1/+1
| | | | | | | | | | | Change-Id: Ib6ea1bd04d9b06542ed2b0f453c718115417c62c Reviewed-on: https://go-review.googlesource.com/c/go/+/449755 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com>
* cmd/go/internal/script: Cmp() should not perform environment substitutionsqmuntal2022-11-031-1/+1
| | | | | | | | | | | | | | | This is an oversight from https://go-review.googlesource.com/c/go/+/419875, where script commands were refactored and factored out to a new package. For #27494. Change-Id: Ie606cab39f60859ee1da5165dcc94c8470c94325 Reviewed-on: https://go-review.googlesource.com/c/go/+/447575 Run-TryBot: Quim Muntal <quimmuntal@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
* cmd/go/internal/script: use the Cancel and WaitDelay fields for subprocessesBryan C. Mills2022-10-261-78/+15
| | | | | | | | | | | | | | | | | | | The Cancel and WaitDelay fields recently added to exec.Cmd are intended to support exactly the sort of cancellation behavior that we need for script tests. Use them, and simplify the cmd/go tests accordingly. The more robust implementation may also help to diagose recurring test hangs (#50187). For #50187. Updates #27494. Change-Id: I7817fca0dd9a18e18984a252d3116f6a5275a401 Reviewed-on: https://go-review.googlesource.com/c/go/+/445357 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* cmd/go: replace the 'addcrlf' script command with a more general 'replace' ↵Bryan C. Mills2022-10-241-0/+38
| | | | | | | | | | | | | | | | | 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>
* cmd/go/internal/script: remove special-case escaping logic for $WORKBryan C. Mills2022-10-241-3/+0
| | | | | | | | | | | | | | | | | | Previously, the script engine implicitly escaped the path in the $WORK environment variable to be the literal string '$WORK', which produces somewhat better error messages in case of failure. However, for a general-purpose script engine that implicit behavior is surprising, and it isn't really necessary. For #27494. Change-Id: Ic1d5b8801bbd068157315685539e7cc2795b3aa5 Reviewed-on: https://go-review.googlesource.com/c/go/+/426854 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>
* cmd/go: extract the TestScript engine into a standalone packageBryan C. Mills2022-10-241-0/+1125
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>