@@ -100,16 +100,16 @@ commands support this prefix. They are indicated below by [!] in the synopsis.
100100The command prefix [cond] indicates that the command on the rest of the line
101101should only run when the condition is satisfied. The predefined conditions are:
102102
103- - [short] for testing.Short()
104- - [net] for whether the external network can be used
105- - [link] for whether the OS has hard link support
106- - [symlink] for whether the OS has symbolic link support
107- - [exec:prog] for whether prog is available for execution (found by exec.LookPath)
108- - [gc] for whether Go was built with gc
109- - [gccgo] for whether Go was built with gccgo
110- - [go1.x] for whether the Go version is 1.x or later
111- - [unix] for whether the OS is Unix-like (that is, would match the 'unix' build
112- constraint)
103+ - [short] for testing.Short()
104+ - [net] for whether the external network can be used
105+ - [link] for whether the OS has hard link support
106+ - [symlink] for whether the OS has symbolic link support
107+ - [exec:prog] for whether prog is available for execution (found by exec.LookPath)
108+ - [gc] for whether Go was built with gc
109+ - [gccgo] for whether Go was built with gccgo
110+ - [go1.x] for whether the Go version is 1.x or later
111+ - [unix] for whether the OS is Unix-like (that is, would match the 'unix' build
112+ constraint)
113113
114114Any known values of GOOS and GOARCH can also be used as conditions. They will be
115115satisfied if the target OS or architecture match the specified value. For example,
@@ -122,102 +122,107 @@ Additional conditions can be added by passing a function to Params.Condition.
122122
123123The predefined commands are:
124124
125- - cd dir
126- Change to the given directory for future commands.
127-
128- - chmod perm path...
129- Change the permissions of the files or directories named by the path arguments
130- to the given octal mode (000 to 777).
131-
132- - cmp file1 file2
133- Check that the named files have the same content.
134- By convention, file1 is the actual data and file2 the expected data.
135- File1 can be "stdout" or "stderr" to use the standard output or standard error
136- from the most recent exec or wait command.
137- (If the files have differing content, the failure prints a diff.)
138-
139- - cmpenv file1 file2
140- Like cmp, but environment variables in file2 are substituted before the
141- comparison. For example, $GOOS is replaced by the target GOOS.
142-
143- - cp src... dst
144- Copy the listed files to the target file or existing directory.
145- src can include "stdout" or "stderr" to use the standard output or standard error
146- from the most recent exec or go command.
147-
148- - env [key=value...]
149- With no arguments, print the environment (useful for debugging).
150- Otherwise add the listed key=value pairs to the environment.
151-
152- - [!] exec program [args...] [&]
153- Run the given executable program with the arguments.
154- It must (or must not) succeed.
155- Note that 'exec' does not terminate the script (unlike in Unix shells).
156-
157- If the last token is '&', the program executes in the background. The standard
158- output and standard error of the previous command is cleared, but the output
159- of the background process is buffered — and checking of its exit status is
160- delayed — until the next call to 'wait', 'skip', or 'stop' or the end of the
161- test. At the end of the test, any remaining background processes are
162- terminated using os.Interrupt (if supported) or os.Kill.
163-
164- If the last token is '&word&` (where "word" is alphanumeric), the
165- command runs in the background but has a name, and can be waited
166- for specifically by passing the word to 'wait'.
167-
168- Standard input can be provided using the stdin command; this will be
169- cleared after exec has been called.
170-
171- - [!] exists [-readonly] file...
172- Each of the listed files or directories must (or must not) exist.
173- If -readonly is given, the files or directories must be unwritable.
174-
175- - [!] grep [-count=N] pattern file
176- The file's content must (or must not) match the regular expression pattern.
177- For positive matches, -count=N specifies an exact number of matches to require.
178-
179- - mkdir path...
180- Create the listed directories, if they do not already exists.
181-
182- - unquote file...
183- Rewrite each file by replacing any leading ">" characters from
184- each line. This enables a file to contain substrings that look like
185- txtar file markers.
186- See also https://godoc.org/github.com/rogpeppe/go-internal/txtar#Unquote
187-
188- - rm file...
189- Remove the listed files or directories.
190-
191- - skip [message]
192- Mark the test skipped, including the message if given.
193-
194- - stdin file
195- Set the standard input for the next exec command to the contents of the given file.
196- File can be "stdout" or "stderr" to use the standard output or standard error
197- from the most recent exec or wait command.
198-
199- - [!] stderr [-count=N] pattern
200- Apply the grep command (see above) to the standard error
201- from the most recent exec or wait command.
202-
203- - [!] stdout [-count=N] pattern
204- Apply the grep command (see above) to the standard output
205- from the most recent exec or wait command.
206-
207- - stop [message]
208- Stop the test early (marking it as passing), including the message if given.
209-
210- - symlink file -> target
211- Create file as a symlink to target. The -> (like in ls -l output) is required.
212-
213- - wait [command]
214- Wait for all 'exec' and 'go' commands started in the background (with the '&'
215- token) to exit, and display success or failure status for them.
216- After a call to wait, the 'stderr' and 'stdout' commands will apply to the
217- concatenation of the corresponding streams of the background commands,
218- in the order in which those commands were started.
219-
220- If an argument is specified, it waits for just that command.
125+ - cd dir
126+ Change to the given directory for future commands.
127+
128+ - chmod perm path...
129+ Change the permissions of the files or directories named by the path arguments
130+ to the given octal mode (000 to 777).
131+
132+ - [!] cmp file1 file2
133+ Check that the named files have (or do not have) the same content.
134+ By convention, file1 is the actual data and file2 the expected data.
135+ File1 can be "stdout" or "stderr" to use the standard output or standard error
136+ from the most recent exec or wait command.
137+ (If the files have differing content and the command is not negated,
138+ the failure prints a diff.)
139+
140+ - [!] cmpenv file1 file2
141+ Like cmp, but environment variables in file2 are substituted before the
142+ comparison. For example, $GOOS is replaced by the target GOOS.
143+
144+ - cp src... dst
145+ Copy the listed files to the target file or existing directory.
146+ src can include "stdout" or "stderr" to use the standard output or standard error
147+ from the most recent exec or go command.
148+
149+ - env [key=value...]
150+ With no arguments, print the environment (useful for debugging).
151+ Otherwise add the listed key=value pairs to the environment.
152+
153+ - [!] exec program [args...] [&]
154+ Run the given executable program with the arguments.
155+ It must (or must not) succeed.
156+ Note that 'exec' does not terminate the script (unlike in Unix shells).
157+
158+ If the last token is '&', the program executes in the background. The standard
159+ output and standard error of the previous command is cleared, but the output
160+ of the background process is buffered — and checking of its exit status is
161+ delayed — until the next call to 'wait', 'skip', or 'stop' or the end of the
162+ test. At the end of the test, any remaining background processes are
163+ terminated using os.Interrupt (if supported) or os.Kill.
164+
165+ If the last token is '&word&` (where "word" is alphanumeric), the
166+ command runs in the background but has a name, and can be waited
167+ for specifically by passing the word to 'wait'.
168+
169+ Standard input can be provided using the stdin command; this will be
170+ cleared after exec has been called.
171+
172+ - [!] exists [-readonly] file...
173+ Each of the listed files or directories must (or must not) exist.
174+ If -readonly is given, the files or directories must be unwritable.
175+
176+ - [!] grep [-count=N] pattern file
177+ The file's content must (or must not) match the regular expression pattern.
178+ For positive matches, -count=N specifies an exact number of matches to require.
179+
180+ - mkdir path...
181+ Create the listed directories, if they do not already exists.
182+
183+ - mv path1 path2
184+ Rename path1 to path2. OS-specific restrictions may apply when path1 and path2
185+ are in different directories.
186+
187+ - rm file...
188+ Remove the listed files or directories.
189+
190+ - skip [message]
191+ Mark the test skipped, including the message if given.
192+
193+ - [!] stderr [-count=N] pattern
194+ Apply the grep command (see above) to the standard error
195+ from the most recent exec or wait command.
196+
197+ - stdin file
198+ Set the standard input for the next exec command to the contents of the given file.
199+ File can be "stdout" or "stderr" to use the standard output or standard error
200+ from the most recent exec or wait command.
201+
202+ - [!] stdout [-count=N] pattern
203+ Apply the grep command (see above) to the standard output
204+ from the most recent exec or wait command.
205+
206+ - stop [message]
207+ Stop the test early (marking it as passing), including the message if given.
208+
209+ - symlink file -> target
210+ Create file as a symlink to target. The -> (like in ls -l output) is required.
211+
212+ - unquote file...
213+ Rewrite each file by replacing any leading ">" characters from
214+ each line. This enables a file to contain substrings that look like
215+ txtar file markers.
216+ See also https://godoc.org/github.com/rogpeppe/go-internal/txtar#Unquote
217+
218+ - wait [command]
219+ Wait for all 'exec' and 'go' commands started in the background (with the '&'
220+ token) to exit, and display success or failure status for them.
221+ After a call to wait, the 'stderr' and 'stdout' commands will apply to the
222+ concatenation of the corresponding streams of the background commands,
223+ in the order in which those commands were started.
224+
225+ If an argument is specified, it waits for just that command.
221226
222227When TestScript runs a script and the script fails, by default TestScript shows
223228the execution of the most recent phase of the script (since the last # comment)
0 commit comments