Git init
[external/curl.git] / tests / README
1                                   _   _ ____  _
2                               ___| | | |  _ \| |
3                              / __| | | | |_) | |
4                             | (__| |_| |  _ <| |___
5                              \___|\___/|_| \_\_____|
6
7 The cURL Test Suite
8
9 Requires:
10   perl (and a unix-style shell)
11   diff (when a test fails, a diff is shown)
12   stunnel (for HTTPS and FTPS tests)
13   OpenSSH or SunSSH (for SCP, SFTP and SOCKS4/5 tests)
14
15 Ports used by default:
16
17   - TCP/8990 for HTTP
18   - TCP/8991 for HTTPS
19   - TCP/8992 for FTP
20   - TCP/8993 for FTPS
21   - TCP/8994 for HTTP IPv6
22   - TCP/8995 for FTP (2)
23   - TCP/8996 for FTP IPv6
24   - UDP/8997 for TFTP
25   - UDP/8998 for TFTP IPv6
26   - TCP/8999 for SCP/SFTP
27   - TCP/9000 for SOCKS
28   - TCP/9001 for POP3
29   - TCP/9002 for IMAP
30   - TCP/9003 for SMTP
31
32   The test suite runs simple FTP, POP3, IMAP, SMTP, HTTP and TFTP stand-alone
33   servers on these ports to which it makes requests.  For SSL tests, it runs
34   stunnel to handle encryption to the regular servers. For SSH, it runs a
35   standard OpenSSH server. For SOCKS4/5 tests SSH is used to perform the SOCKS
36   functionality and requires a SSH client and server.
37
38   The base port number shown above can be changed using runtests' -b option
39   to allow running more than one instance of the test suite simultaneously
40   on one machine.
41
42 Run:
43   'make test'. This builds the test suite support code and invokes the
44   'runtests.pl' perl script to run all the tests. Edit the top variables
45   of that script in case you have some specific needs, or run the script
46   manually (after the support code has been built).
47
48   The script breaks on the first test that doesn't do OK. Use -a to prevent
49   the script from abort on the first error. Run the script with -v for more
50   verbose output. Use -d to run the test servers with debug output enabled as
51   well. Specifying -k keeps all the log files generated by the test intact.
52
53   Use -s for shorter output, or pass test numbers to run specific tests only
54   (like "./runtests.pl 3 4" to test 3 and 4 only). It also supports test case
55   ranges with 'to', as in "./runtests 3 to 9" which runs the seven tests from
56   3 to 9. Any test numbers starting with ! are disabled, as are any test
57   numbers found in the file data/DISABLED (one per line).
58
59 Shell startup scripts:
60   Tests which use the ssh test server, SCP/SFTP/SOCKS tests, might be badly
61   influenced by the output of system wide or user specific shell startup
62   scripts, .bashrc, .profile, /etc/csh.cshrc, .login, /etc/bashrc, etc. which
63   output text messages or escape sequences on user login.  When these shell
64   startup messages or escape sequences are output they might corrupt the
65   expected stream of data which flows to the sftp-server or from the ssh
66   client which can result in bad test behaviour or even prevent the test
67   server from running.
68
69   If the test suite ssh or sftp server fails to start up and logs the message
70   'Received message too long' then you are certainly suffering the unwanted
71   output of a shell startup script.  Locate, cleanup or adjust the shell
72   script.
73
74 Memory:
75   The test script will check that all allocated memory is freed properly IF
76   curl has been built with the CURLDEBUG define set. The script will
77   automatically detect if that is the case, and it will use the ../memanalyze
78   script to analyze the memory debugging output.
79
80   The -t option will enable torture testing mode, which runs each test
81   many times but causes a different memory allocation to fail on each
82   successive run.  This tests the out of memory error handling code to
83   ensure that memory leaks do not occur even in those situations.
84
85 Debug:
86   If a test case fails, you can conveniently get the script to invoke the
87   debugger (gdb) for you with the server running and the exact same command
88   line parameters that failed. Just invoke 'runtests.pl <test number> -g' and
89   then just type 'run' in the debugger to perform the command through the
90   debugger.
91
92   If a test case causes a core dump, analyze it by running gdb like:
93
94           # gdb ../curl/src core
95
96   ... and get a stack trace with the gdb command:
97
98           (gdb) where
99
100 Logs:
101   All logs are generated in the logs/ subdirectory (it is emptied first
102   in the runtests.pl script). Use runtests.pl -k to keep the temporary files
103   after the test run.
104
105 Data:
106   All test cases are put in the data/ subdirectory. Each test is stored in the
107   file named according to the test number.
108
109   See FILEFORMAT for the description of the test case files.
110
111 Code coverage:
112   gcc provides a tool that can determine the code coverage figures for
113   the test suite.  To use it, configure curl with
114   CFLAGS='-fprofile-arcs -ftest-coverage -g -O0'.  Make sure you run the normal
115   and torture tests to get more full coverage, i.e. do:
116
117     make test
118     make test-torture
119
120   The graphical tool ggcov can be used to browse the source and create
121   coverage reports on *NIX hosts:
122
123     ggcov -r lib src
124
125   The text mode tool gcov may also be used, but it doesn't handle object files
126   in more than one directory very well.
127
128 Remote testing:
129   The runtests.pl script provides some hooks to allow curl to be tested on a
130   machine where perl can not be run.  The test framework in this case runs on
131   a workstation where perl is available, while curl itself is run on a remote
132   system using ssh or some other remote execution method.  See the comments at
133   the beginning of runtests.pl for details.
134
135 TEST CASE NUMBERS
136
137  So far, we've used this system:
138
139  1   -  99   HTTP
140  100 - 199   FTP*
141  200 - 299   FILE*
142  300 - 399   HTTPS
143  400 - 499   FTPS
144  500 - 599   libcurl source code tests, not using the curl command tool
145  600 - 699   SCP/SFTP
146  700 - 799   SOCKS4 (even numbers) and SOCK5 (odd numbers)
147  800 - 899   POP3, IMAP, SMTP
148  1000 - 1999 miscellaneous*
149  2000 - x    multiple sequential protocols per test case*
150
151  Since 30-apr-2003, there's nothing in the system that requires us to keep
152  within these number series, and those sections marked with * actually
153  contain tests for a variety of protocols. Each test case now specifies
154  its own server requirements, independent of test number.
155
156 TODO:
157
158   * Add tests for TELNET, LDAP, DICT...
159   * SOCKS4/5 test deficiencies - no proxy authentication tests as SSH (the
160     test mechanism) doesn't support them