David Phillips fix for test 518 and my extension to make it not run on
[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]>
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 </data>
35 <dataNUM>
36 Send back this contents instead of the <data> one. The num is set by:
37 A) The test number in the request line is >10000 and this is the remainder
38 of [test case number]%10000.
39 B) The request was HTTP and included digest details, which adds 1000 to NUM
40 C) If a HTTP request is NTLM type-1, it adds 1001 to num
41 D) If a HTTP request is NTLM type-3, it adds 1002 to num
42 </dateNUM>
43 <datacheck [nonewline=yes]>
44 if the data is sent but this is what should be checked afterwards. If
45 'nonewline' is set, we will cut off the trailing newline of this given data
46 before comparing with the one actually received by the client
47 </datacheck>
48 <size>
49 number to return on a ftp SIZE command (set to -1 to make this command fail)
50 </size>
51 <mdtm>
52 what to send back if the client sends a (FTP) MDTM command, set to -1 to
53 have it return that the file doesn't exist
54 </mdtm>
55 <servercmd>
56 special purpose server-command to control its behavior *before* the
57 reply is sent:
58
59 auth_required - server fails if no auth is provided
60 </servercmd>
61 <postcmd>
62 special purpose server-command to control its behavior *after* the
63 reply is sent
64 </postcmd>
65 <servercmd>
66  equivalent to <cmd> but for HTTP, one specified command is supported:
67  "auth_required" - if this is set and a POST/PUT is made without auth, the
68  server will NOT wait for the full request body to get sent
69 </servercmd>
70 </reply>
71
72 <client>
73
74 <server>
75 protocols as in 'http' 'ftp' etc. Give only one per line. Used for test cases
76 500+ (at this point) to specify which servers the test case requires. In the
77 future all test cases should use this. Makes us independent of the test
78 case number.
79 </server>
80
81 <features>
82 A list of features that must be present in the client/library for this test
83 to be able to run. Features testable here are:
84 SSL
85 netrc_debug
86 large_file
87 idn
88 getrlimit
89 </features>
90
91 <killserver>
92 Using the same syntax as in <server> but when mentioned here these servers
93 are explicitly KILLED when this test case is completed. Only use this if there
94 is no other alternatives. Using this of course requires subsequent tests to
95 restart servers.
96 </killserver>
97
98 <tool>
99 Name of tool to use instead of "curl". This tool must be built and exist
100 in the libtest/ directory.
101 </tool>
102
103 <name>
104 test case description
105 </name>
106
107 <setenv>
108 variable1=contents1
109 variable2=contents2
110
111 Set the given environment variables to the specified value before the actual
112 command is run, they are cleared again after the command has been run.
113 </setenv>
114
115 <command [option=no-output]>
116 command line to run, there's a bunch of %variables that get replaced
117 accordingly.
118
119 Note that the URL that gets passed to the server actually controls what data
120 that is returned. The last slash in the URL must be followed by a number. That
121 number (N) will be used by the test-server to load test case N and return the
122 data that is defined within the <reply><data></data></reply> section.
123
124 If a CONNECT is used to the server (to emulate HTTPS etc over proxy), the port
125 number given in the CONNECT request will be used to identify which test that
126 is being run, if the proxy host name is said to start with 'test'.
127
128 Set 'option=no-output' to prevent the test script to slap on the --output
129 argument that directs the output to a file. The --output is also not added if
130 the client/stdout section is used.
131
132 Available substitute variables include:
133 %HOSTIP    - IP address of the host running this test
134 %HOSTPORT  - Port number of the HTTP server
135 %HTTPSPORT - Port number of the HTTPS server
136 %FTPPORT   - Port number of the FTP server
137 %FTPSPORT  - Port number of the FTPS server
138 %SRCDIR    - Full path to the source dir
139 %PWD       - Current directory
140 </command>
141
142 <file name="log/filename">
143 this creates the named file with this content before the test case is run
144 which is useful if the test case needs a file to act on.
145 </file>
146
147 <stdin>
148 Pass this given data on stdin to the tool.
149 </stdin>
150
151 </client>
152
153 <verify>
154 <errorcode>
155 numerical error code curl is supposed to return
156 </errorcode>
157 <strip>
158 One regex per line that is removed from the protocol dumps before the
159 comparison is made. This is very useful to remove dependencies on dynamicly
160 changing protocol data such as port numbers or user-agent strings.
161 </strip>
162 <protocol [nonewline=yes]>
163 the protocol dump curl should transmit, if 'nonewline' is set, we will cut
164 off the trailing newline of this given data before comparing with the one
165 actually sent by the client
166 </protocol>
167 <stdout>
168 This verfies that this data was passed to stdout.
169 </stdout>
170 <file name="log/filename">
171 the file's contents must be identical to this
172 </file>
173 <upload>
174 the contents of the upload data curl should have sent
175 </upload>
176 </verify>