1 The test suite's file format is very simple and extensible, closely
2 resembling XML. All data for a single test case resides in a single
3 ASCII file. Labels mark the beginning and the end of all sections, and each
4 label must be written in its own line. Comments are either XML-style
5 (enclosed with <!-- and -->) or C-style (beginning with #) and must appear
6 on their own lines and not alongside actual test data. Most test data files
7 are syntactically valid XML, although a few files are not (lack of
8 support for character entities and the preservation of CR/LF characters at
9 the end of lines are the biggest differences).
11 The file begins with a 'testcase' tag, which encompasses the remainder of
16 Each file is split up in three main sections: reply, client and verify. The
17 reply section is used for the server to know what to send as a reply for the
18 requests curl sends, the client section defines how the client should behave
19 while the verify section defines how to verify that the data stored after a
20 command has been run ended up correctly.
22 Each main section has a number of available subsections that can be
23 specified, that will be checked/used if specified. This document includes all
24 the subsections currently supported.
26 Main sections are 'info', 'reply', 'client' and 'verify'.
30 A newline-separated list of keywords describing what this test case uses and
31 tests. Try to use an already used keyword. These keywords will be used for
32 statistical/informational purposes and for choosing or skipping classes
33 of tests. "Keywords" must begin with an alphabetic character, "-", "["
34 or "{" and may actually consist of multiple words separated by spaces
35 which are treated together as a single identifier.
40 <data [nocheck="1"] [sendzero="yes"] [base64="yes"]>
41 data to be sent to the client on its request and later verified that it arrived
42 safely. Set nocheck="1" to prevent the test script from verifying the arrival
45 If the data contains 'swsclose' anywhere within the start and end tag, and
46 this is a HTTP test, then the connection will be closed by the server after
47 this response is sent. If not, the connection will be kept persistent.
49 If the data contains 'swsbounce' anywhere within the start and end tag, the
50 HTTP server will detect if this is a second request using the same test and
51 part number and will then increase the part number with one. This is useful
52 for auth tests and similar.
54 'sendzero' set to yes means that the (FTP) server will "send" the data even if
55 the size is zero bytes. Used to verify curl's behaviour on zero bytes
58 'base64' set to yes means that the data provided in the test-file is a chunk
59 of data encoded with base64. It is the only way a test case can contain binary
60 data. (This attribute can in fact be used on any section, but it doesn't make
61 much sense for other sections than "data").
64 Send back this contents instead of the <data> one. The num is set by:
65 A) The test number in the request line is >10000 and this is the remainder
66 of [test case number]%10000.
67 B) The request was HTTP and included digest details, which adds 1000 to NUM
68 C) If a HTTP request is NTLM type-1, it adds 1001 to num
69 D) If a HTTP request is NTLM type-3, it adds 1002 to num
71 <datacheck [nonewline="yes"]>
72 if the data is sent but this is what should be checked afterwards. If
73 'nonewline' is set, we will cut off the trailing newline of this given data
74 before comparing with the one actually received by the client
77 number to return on a ftp SIZE command (set to -1 to make this command fail)
80 what to send back if the client sends a (FTP) MDTM command, set to -1 to
81 have it return that the file doesn't exist
84 special purpose server-command to control its behavior *after* the
86 For HTTP/HTTPS, these are supported:
89 - Pause for the given time
92 Special-commands for the server.
93 For FTP, these are supported:
95 REPLY [command] [return value] [response string]
96 - Changes how the server responds to the [command]. [response string] is
97 evaluated as a perl string, so it can contain embedded \r\n, for example.
99 - Do the REPLY change for [command] only [num] times and then go back to the
101 DELAY [command] [secs]
102 - Delay responding to this command for the given time
104 - Enable the "weirdo" RETR case when multiple response lines appear at once
105 when a file is transfered
107 - Make sure the RETR response doesn't contain the size of the file
109 - Don't actually save what is received
111 - Send FTP responses with 0.1 sec delay between each byte
113 - makes PASV send back an illegal IP in its 227 response
116 auth_required if this is set and a POST/PUT is made without auth, the
117 server will NOT wait for the full request body to get sent
118 idle do nothing after receiving the request, just "sit idle"
119 stream continuously send data to the client, never-ending
120 pipe: [num] tell the server to expect this many HTTP requests before
121 sending back anything, to allow pipelining tests
122 skip: [num] instructs the server to ignore reading this many bytes from a PUT
130 What server(s) this test case requires/uses:
145 Give only one per line. This subsection is mandatory.
149 A list of features that MUST be present in the client/library for this test to
150 be able to run (if these features are not present, the test will be
151 SKIPPED). Features testable here are:
165 as well as each protocol that curl supports. A protocol only needs to be
166 specified if it is different from the server (useful when the server
171 Using the same syntax as in <server> but when mentioned here these servers
172 are explicitly KILLED when this test case is completed. Only use this if there
173 is no other alternatives. Using this of course requires subsequent tests to
178 A command line that if set gets run by the test script before the test. If an
179 output is displayed by the command, the test will be skipped and the
180 (single-line) output will be displayed as reason for not running the test.
181 Variables are substituted as in the <command> section.
185 A command line that if set gets run by the test script after the test. If
186 the command exists with a non-zero status code, the test will be considered
187 to have failed. Variables are substituted as in the <command> section.
191 Name of tool to use instead of "curl". This tool must be built and exist
192 in the libtest/ directory.
196 test case description
203 Set the given environment variables to the specified value before the actual
204 command is run. They are cleared again after the command has been run.
205 Variables are first substituted as in the <command> section.
208 <command [option="no-output"] [timeout="secs"] [delay="secs"]>
209 command line to run, there's a bunch of %variables that get replaced
212 Note that the URL that gets passed to the server actually controls what data
213 that is returned. The last slash in the URL must be followed by a number. That
214 number (N) will be used by the test-server to load test case N and return the
215 data that is defined within the <reply><data></data></reply> section.
217 If a CONNECT is used to the server (to emulate HTTPS etc over proxy), the port
218 number given in the CONNECT request will be used to identify which test that
219 is being run, if the proxy host name is said to start with 'test'.
221 Set option="no-output" to prevent the test script to slap on the --output
222 argument that directs the output to a file. The --output is also not added if
223 the verify/stdout section is used.
225 Set timeout="secs" to override default server logs advisor read lock timeout.
226 This timeout is used by the test harness, once that the command has completed
227 execution, to wait for the test server to write out server side log files and
228 remove the lock that advised not to read them. The "secs" parameter is the not
229 negative integer number of seconds for the timeout. This 'timeout' attribute
230 is documented for completeness sake, but is deep test harness stuff and only
231 needed for very singular and specific test cases. Avoid using it.
233 Set delay="secs" to introduce a time delay once that the command has completed
234 execution and before the <postcheck> section runs. The "secs" parameter is the
235 not negative integer number of seconds for the delay. This 'delay' attribute
236 is intended for very specific test cases, and normally not needed.
238 Available substitute variables include:
239 %CLIENTIP - IPv4 address of the client running curl
240 %CLIENT6IP - IPv6 address of the client running curl
241 %HOSTIP - IPv4 address of the host running this test
242 %HOSTPORT - Port number of the HTTP server
243 %HOST6IP - IPv6 address of the host running this test
244 %HOST6PORT - IPv6 port number of the HTTP server
245 %HTTPSPORT - Port number of the HTTPS server
246 %FTPPORT - Port number of the FTP server
247 %FTP6PORT - IPv6 port number of the FTP server
248 %FTPSPORT - Port number of the FTPS server
249 %FTP2PORT - Port number of the FTP server 2
250 %FTPTIME2 - Timeout in seconds that should be just sufficient to receive
251 a response from the test FTP server
252 %TFTPPORT - Port number of the TFTP server
253 %TFTP6PORT - IPv6 port number of the TFTP server
254 %SSHPORT - Port number of the SCP/SFTP server
255 %SOCKSPORT - Port number of the SOCKS4/5 server
256 %SRCDIR - Full path to the source dir
257 %PWD - Current directory
258 %CURL - Path to the curl executable
259 %USER - Login ID of the user running the test
262 <file name="log/filename">
263 This creates the named file with this content before the test case is run,
264 which is useful if the test case needs a file to act on.
265 Variables are substituted on the contents of the file as in the <command>
270 Pass this given data on stdin to the tool.
277 numerical error code curl is supposed to return. Specify a list of accepted
278 error codes by separating multiple numbers with comma. See test 237 for an
282 One regex per line that is removed from the protocol dumps before the
283 comparison is made. This is very useful to remove dependencies on dynamically
284 changing protocol data such as port numbers or user-agent strings.
287 One perl op per line that operates on the protocol dump. This is pretty
288 advanced. Example: "s/^EPRT .*/EPRT stripped/"
290 <protocol [nonewline="yes"]>
291 the protocol dump curl should transmit, if 'nonewline' is set, we will cut
292 off the trailing newline of this given data before comparing with the one
293 actually sent by the client
294 Variables are substituted as in the <command> section.
296 <stdout [mode="text"] [nonewline="yes"]>
297 This verifies that this data was passed to stdout. Variables are
298 substituted as in the <command> section.
300 Use the mode="text" attribute if the output is in text mode on platforms that
301 have a text/binary difference.
303 If 'nonewline' is set, we will cut off the trailing newline of this given data
304 before comparing with the one actually received by the client
306 <file name="log/filename" [mode="text"]>
307 The file's contents must be identical to this after the test is complete.
308 Use the mode="text" attribute if the output is in text mode on platforms that
309 have a text/binary difference.
310 Variables are substituted as in the <command> section.
313 One perl op per line that operates on the file before being compared. This is
314 pretty advanced. Example: "s/^EPRT .*/EPRT stripped/"
317 the contents of the upload data curl should have sent
320 disable - disables the valgrind log check for this test