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