fixed the valgrind log check and make it possible to disable it for a specific
[platform/upstream/curl.git] / tests / FILEFORMAT
1  The file format of the test suite is a very simple and extendable format. All
2 data for a single test case resides in a single ASCII file. Labels mark the
3 beginning and the end of all sections. Each label must be written in its own
4 line and is resembling XML/HTML.
5
6  Each file is split up in three main sections: reply, client and verify. The
7 reply section is used for the server to know what to send as a reply for the
8 requests curl sends, the client section defines how the client should behave
9 while the verify section defines how to verify that the data stored after a
10 command has been run ended up correctly.
11
12  Each main section has a number of available subsections that can be
13 specified, that will be checked/used if specified. This document includes all
14 the subsections currently supported.
15
16 <reply>
17 <data [nocheck=1] [sendzero=yes] [base64=yes]>
18 §data to sent to the client on its request and later verified that it arrived
19 safely. Set the nocheck=1 to prevent the test script to verify the arrival
20 of this data.
21
22 If the data contains 'swsclose' anywhere within the start and end tag, and
23 this is a HTTP test, then the connection will be closed by the server after
24 this response is sent. If not, the connection will be kept persistant.
25
26 If the data contains 'swsbounce' anywhere within the start and end tag, the
27 HTTP server will detect if this is a second request using the same test and
28 part number and will then increase the part number with one. This is useful
29 for auth tests and similar.
30
31 'sendzero' set to yes means that the (FTP) server will "send" the data even if
32 the size is zero bytes. Used to verify curl's behaviour on zero bytes
33 transfers.
34
35 'base64' set to yes means that the data provided in the test-file is a chunk
36 of data encoded with base64. It is the only way a test case can contain binary
37 data. (This attribute can in fact be used on any section, but it doesn't make
38 much sense for other sections than "data").
39 </data>
40 <dataNUM>
41 Send back this contents instead of the <data> one. The num is set by:
42 A) The test number in the request line is >10000 and this is the remainder
43 of [test case number]%10000.
44 B) The request was HTTP and included digest details, which adds 1000 to NUM
45 C) If a HTTP request is NTLM type-1, it adds 1001 to num
46 D) If a HTTP request is NTLM type-3, it adds 1002 to num
47 </dataNUM>
48 <datacheck [nonewline=yes]>
49 if the data is sent but this is what should be checked afterwards. If
50 'nonewline' is set, we will cut off the trailing newline of this given data
51 before comparing with the one actually received by the client
52 </datacheck>
53 <size>
54 number to return on a ftp SIZE command (set to -1 to make this command fail)
55 </size>
56 <mdtm>
57 what to send back if the client sends a (FTP) MDTM command, set to -1 to
58 have it return that the file doesn't exist
59 </mdtm>
60 <servercmd>
61 special purpose server-command to control its behavior *before* the
62 reply is sent:
63
64 auth_required - server fails if no auth is provided
65 </servercmd>
66 <postcmd>
67 special purpose server-command to control its behavior *after* the
68 reply is sent
69 </postcmd>
70 <servercmd>
71  equivalent to <cmd> but for HTTP, one specified command is supported:
72  "auth_required" - if this is set and a POST/PUT is made without auth, the
73  server will NOT wait for the full request body to get sent
74 </servercmd>
75 </reply>
76
77 <client>
78
79 <server>
80 What server(s) this test case requires/uses:
81 'http' 'ftp', 'https', 'ftps', 'http-ipv6'. Give only one per line.
82 </server>
83
84 <features>
85 A list of features that MUST be present in the client/library for this test to
86 be able to run (if these features are not present, the test will be
87 SKIPPED). Features testable here are:
88
89 SSL
90 netrc_debug
91 large_file
92 idn
93 getrlimit
94 ipv6
95 libz
96 </features>
97
98 <killserver>
99 Using the same syntax as in <server> but when mentioned here these servers
100 are explicitly KILLED when this test case is completed. Only use this if there
101 is no other alternatives. Using this of course requires subsequent tests to
102 restart servers.
103 </killserver>
104
105 <precheck>
106 A command line that if set gets run by the test script before the test. If an
107 output is displayed by the command line, the test will be skipped and the
108 (single-line) output will be displayed as reason for not running the test.
109 </precheck>
110
111 <tool>
112 Name of tool to use instead of "curl". This tool must be built and exist
113 in the libtest/ directory.
114 </tool>
115
116 <name>
117 test case description
118 </name>
119
120 <setenv>
121 variable1=contents1
122 variable2=contents2
123
124 Set the given environment variables to the specified value before the actual
125 command is run, they are cleared again after the command has been run.
126 </setenv>
127
128 <command [option=no-output]>
129 command line to run, there's a bunch of %variables that get replaced
130 accordingly.
131
132 Note that the URL that gets passed to the server actually controls what data
133 that is returned. The last slash in the URL must be followed by a number. That
134 number (N) will be used by the test-server to load test case N and return the
135 data that is defined within the <reply><data></data></reply> section.
136
137 If a CONNECT is used to the server (to emulate HTTPS etc over proxy), the port
138 number given in the CONNECT request will be used to identify which test that
139 is being run, if the proxy host name is said to start with 'test'.
140
141 Set 'option=no-output' to prevent the test script to slap on the --output
142 argument that directs the output to a file. The --output is also not added if
143 the client/stdout section is used.
144
145 Available substitute variables include:
146 %HOSTIP    - IP address of the host running this test
147 %HOSTPORT  - Port number of the HTTP server
148 %HTTPSPORT - Port number of the HTTPS server
149 %FTPPORT   - Port number of the FTP server
150 %FTPSPORT  - Port number of the FTPS server
151 %SRCDIR    - Full path to the source dir
152 %PWD       - Current directory
153 </command>
154
155 <file name="log/filename">
156 this creates the named file with this content before the test case is run
157 which is useful if the test case needs a file to act on.
158 </file>
159
160 <stdin>
161 Pass this given data on stdin to the tool.
162 </stdin>
163
164 </client>
165
166 <verify>
167 <errorcode>
168 numerical error code curl is supposed to return
169 </errorcode>
170 <strip>
171 One regex per line that is removed from the protocol dumps before the
172 comparison is made. This is very useful to remove dependencies on dynamicly
173 changing protocol data such as port numbers or user-agent strings.
174 </strip>
175 <strippart>
176 One perl op per line that operates on the protocol dump. This is pretty
177 advanced. Example: "s/^EPRT .*/EPRT stripped/"
178 </strippart>
179 <protocol [nonewline=yes]>
180 the protocol dump curl should transmit, if 'nonewline' is set, we will cut
181 off the trailing newline of this given data before comparing with the one
182 actually sent by the client
183 </protocol>
184 <stdout>
185 This verfies that this data was passed to stdout.
186 </stdout>
187 <file name="log/filename">
188 the file's contents must be identical to this
189 </file>
190 <upload>
191 the contents of the upload data curl should have sent
192 </upload>
193 <valgrind>
194 disable - disables the valgrind log check for this test
195 </valgrind>
196 </verify>