aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/README
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2018-10-10 16:37:00 -0400
committerBryan C. Mills <bcmills@google.com>2018-10-29 17:20:06 +0000
commitd76b1cdf286551a81fd4c1012cbf8686d344cc32 (patch)
tree03c5e32e019c387b6e754c5ce898d2663957f0bd /src/cmd/go/testdata/script/README
parent4c8b09e9183390d6ab80d3f53a9fe5f6ace92f06 (diff)
downloadgo-d76b1cdf286551a81fd4c1012cbf8686d344cc32.tar.gz
go-d76b1cdf286551a81fd4c1012cbf8686d344cc32.zip
cmd/go: support background processes in TestScript
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>
Diffstat (limited to 'src/cmd/go/testdata/script/README')
-rw-r--r--src/cmd/go/testdata/script/README22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README
index a80233b8c3..f28f1b87ed 100644
--- a/src/cmd/go/testdata/script/README
+++ b/src/cmd/go/testdata/script/README
@@ -99,16 +99,23 @@ The commands are:
With no arguments, print the environment (useful for debugging).
Otherwise add the listed key=value pairs to the environment.
-- [!] exec program [args...]
+- [!] exec program [args...] [&]
Run the given executable program with the arguments.
It must (or must not) succeed.
Note that 'exec' does not terminate the script (unlike in Unix shells).
+ If the last token is '&', the program executes in the background. The standard
+ output and standard error of the previous command is cleared, but the output
+ of the background process is buffered — and checking of its exit status is
+ delayed — until the next call to 'wait', 'skip', or 'stop' or the end of the
+ test. At the end of the test, any remaining background processes are
+ terminated using os.Interrupt (if supported) or os.Kill.
+
- [!] exists [-readonly] file...
Each of the listed files or directories must (or must not) exist.
If -readonly is given, the files or directories must be unwritable.
-- [!] go args...
+- [!] go args... [&]
Run the (test copy of the) go command with the given arguments.
It must (or must not) succeed.
@@ -131,11 +138,11 @@ The commands are:
- [!] stderr [-count=N] pattern
Apply the grep command (see above) to the standard error
- from the most recent exec or go command.
+ from the most recent exec, go, or wait command.
- [!] stdout [-count=N] pattern
Apply the grep command (see above) to the standard output
- from the most recent exec or go command.
+ from the most recent exec, go, or wait command.
- stop [message]
Stop the test early (marking it as passing), including the message if given.
@@ -143,6 +150,13 @@ The commands are:
- symlink file -> target
Create file as a symlink to target. The -> (like in ls -l output) is required.
+- wait
+ Wait for all 'exec' and 'go' commands started in the background (with the '&'
+ token) to exit, and display success or failure status for them.
+ After a call to wait, the 'stderr' and 'stdout' commands will apply to the
+ concatenation of the corresponding streams of the background commands,
+ in the order in which those commands were started.
+
When TestScript runs a script and the script fails, by default TestScript shows
the execution of the most recent phase of the script (since the last # comment)
and only shows the # comments for earlier phases. For example, here is a