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