5 \___|\___/|_| \_\_____|
11 1.2 Port numbers used by test servers
14 1.5 Shell startup scripts
23 2.1 Test case numbering
35 ==============================================================================
41 perl (and a unix-style shell)
42 python (and a unix-style shell)
43 diff (when a test fails, a diff is shown)
44 stunnel (for HTTPS and FTPS tests)
45 OpenSSH or SunSSH (for SCP, SFTP and SOCKS4/5 tests)
47 1.2 Port numbers used by test servers
53 - TCP/8994 for HTTP IPv6
54 - TCP/8995 for FTP (2)
55 - TCP/8996 for FTP IPv6
57 - UDP/8998 for TFTP IPv6
58 - TCP/8999 for SCP/SFTP
63 - TCP/9004 for SMTP IPv6
65 - TCP/9006 for RTSP IPv6
67 - TCP/9008 for GOPHER IPv6
68 - TCP/9008 for HTTPS server with TLS-SRP support
72 The test suite runs simple FTP, POP3, IMAP, SMTP, HTTP and TFTP stand-alone
73 servers on the ports listed above to which it makes requests. For SSL tests,
74 it runs stunnel to handle encryption to the regular servers. For SSH, it
75 runs a standard OpenSSH server. For SOCKS4/5 tests SSH is used to perform
76 the SOCKS functionality and requires a SSH client and server.
78 The base port number (8990), which all the individual port numbers are
79 indexed from, can be set explicitly using runtests.pl' -b option to allow
80 running more than one instance of the test suite simultaneously on one
81 machine, or just move the servers in case you have local services on any of
84 The HTTP server supports listening on a Unix domain socket, the default
85 location is 'http.sock'.
89 'make test'. This builds the test suite support code and invokes the
90 'runtests.pl' perl script to run all the tests. Edit the top variables
91 of that script in case you have some specific needs, or run the script
92 manually (after the support code has been built).
94 The script breaks on the first test that doesn't do OK. Use -a to prevent
95 the script from aborting on the first error. Run the script with -v for more
96 verbose output. Use -d to run the test servers with debug output enabled as
97 well. Specifying -k keeps all the log files generated by the test intact.
99 Use -s for shorter output, or pass test numbers to run specific tests only
100 (like "./runtests.pl 3 4" to test 3 and 4 only). It also supports test case
101 ranges with 'to', as in "./runtests 3 to 9" which runs the seven tests from
102 3 to 9. Any test numbers starting with ! are disabled, as are any test
103 numbers found in the file data/DISABLED (one per line).
105 When -s is not present, each successful test will display on one line the
106 test number and description and on the next line a set of flags, the test
107 result, current test sequence, total number of tests to be run and an
108 estimated amount of time to complete the test run. The flags consist of
109 these letters describing what is checked in this test:
120 1.5 Shell startup scripts
122 Tests which use the ssh test server, SCP/SFTP/SOCKS tests, might be badly
123 influenced by the output of system wide or user specific shell startup
124 scripts, .bashrc, .profile, /etc/csh.cshrc, .login, /etc/bashrc, etc. which
125 output text messages or escape sequences on user login. When these shell
126 startup messages or escape sequences are output they might corrupt the
127 expected stream of data which flows to the sftp-server or from the ssh
128 client which can result in bad test behaviour or even prevent the test
131 If the test suite ssh or sftp server fails to start up and logs the message
132 'Received message too long' then you are certainly suffering the unwanted
133 output of a shell startup script. Locate, cleanup or adjust the shell
138 The test script will check that all allocated memory is freed properly IF
139 curl has been built with the CURLDEBUG define set. The script will
140 automatically detect if that is the case, and it will use the
141 'memanalyze.pl' script to analyze the memory debugging output.
143 Also, if you run tests on a machine where valgrind is found, the script will
144 use valgrind to run the test with (unless you use -n) to further verify
147 runtests.pl's -t option will enable torture testing mode, which runs each
148 test many times and makes each different memory allocation fail on each
149 successive run. This tests the out of memory error handling code to ensure
150 that memory leaks do not occur even in those situations. It can help to
151 compile curl with CPPFLAGS=-DMEMDEBUG_LOG_SYNC when using this option, to
152 ensure that the memory log file is properly written even if curl crashes.
156 If a test case fails, you can conveniently get the script to invoke the
157 debugger (gdb) for you with the server running and the exact same command
158 line parameters that failed. Just invoke 'runtests.pl <test number> -g' and
159 then just type 'run' in the debugger to perform the command through the
164 All logs are generated in the logs/ subdirectory (it is emptied first in the
165 runtests.pl script). Use runtests.pl -k to force it to keep the temporary
166 files after the test run since successful runs will clean it up otherwise.
170 All test cases are put in the data/ subdirectory. Each test is stored in the
171 file named according to the test number.
173 See FILEFORMAT for the description of the test case files.
177 gcc provides a tool that can determine the code coverage figures for
178 the test suite. To use it, configure curl with
179 CFLAGS='-fprofile-arcs -ftest-coverage -g -O0'. Make sure you run the normal
180 and torture tests to get more full coverage, i.e. do:
185 The graphical tool ggcov can be used to browse the source and create
186 coverage reports on *NIX hosts:
190 The text mode tool gcov may also be used, but it doesn't handle object files
191 in more than one directory very well.
195 The runtests.pl script provides some hooks to allow curl to be tested on a
196 machine where perl can not be run. The test framework in this case runs on
197 a workstation where perl is available, while curl itself is run on a remote
198 system using ssh or some other remote execution method. See the comments at
199 the beginning of runtests.pl for details.
203 2.1 Test case numbering
210 500 - 599 libcurl source code tests, not using the curl command tool
212 700 - 799 SOCKS4 (even numbers) and SOCK5 (odd numbers)
213 800 - 899 POP3, IMAP, SMTP
214 1000 - 1299 miscellaneous*
215 1300 - 1399 unit tests*
216 1400 - 1499 miscellaneous*
217 1500 - 1599 libcurl source code tests, not using the curl command tool
219 2000 - x multiple sequential protocols per test case*
221 Since 30-apr-2003, there's nothing in the system that requires us to keep
222 within these number series, and those sections marked with * actually
223 contain tests for a variety of protocols. Each test case now specifies its
224 own server requirements, independent of test number.
228 Here's a quick description on writing test cases. We basically have three
229 kinds of tests: the ones that test the curl tool, the ones that build small
230 applications and test libcurl directly and the unit tests that test
231 individual (possibly internal) functions.
235 Each test has a master file that controls all the test data. What to read,
236 what the protocol exchange should look like, what exit code to expect and
237 what command line arguments to use etc.
239 These files are tests/data/test[num] where [num] is described in section 2
240 of this document, and the XML-like file format of them is described in the
241 separate tests/FILEFORMAT document.
245 A test case that runs the curl tool and verifies that it gets the correct
246 data, it sends the correct data, it uses the correct protocol primitives
251 The libcurl tests are identical to the curl ones, except that they use a
252 specific and dedicated custom-built program to run instead of "curl". This
253 tool is built from source code placed in tests/libtest and if you want to
254 make a new libcurl test that is where you add your code.
258 Unit tests are tests in the 13xx sequence and they are placed in tests/unit.
259 There's a tests/unit/README describing the specific set of checks and macros
260 that may be used when writing tests that verify behaviors of specific
261 individual functions.
263 The unit tests depend on curl being built with debug enabled.
269 Add tests for TELNET, LDAP, DICT...
273 SOCKS4/5 test deficiencies - no proxy authentication tests as SSH (the
274 test mechanism) doesn't support them