xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame] | 1 | .\" ************************************************************************** |
| 2 | .\" * _ _ ____ _ |
| 3 | .\" * Project ___| | | | _ \| | |
| 4 | .\" * / __| | | | |_) | | |
| 5 | .\" * | (__| |_| | _ <| |___ |
| 6 | .\" * \___|\___/|_| \_\_____| |
| 7 | .\" * |
| 8 | .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al. |
| 9 | .\" * |
| 10 | .\" * This software is licensed as described in the file COPYING, which |
| 11 | .\" * you should have received as part of this distribution. The terms |
| 12 | .\" * are also available at https://curl.se/docs/copyright.html. |
| 13 | .\" * |
| 14 | .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 15 | .\" * copies of the Software, and permit persons to whom the Software is |
| 16 | .\" * furnished to do so, under the terms of the COPYING file. |
| 17 | .\" * |
| 18 | .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 19 | .\" * KIND, either express or implied. |
| 20 | .\" * |
| 21 | .\" * SPDX-License-Identifier: curl |
| 22 | .\" * |
| 23 | .\" ************************************************************************** |
| 24 | .\" |
| 25 | .TH runtests.pl 1 "September 02, 2022" "Curl 7.86.0" "runtests" |
| 26 | |
| 27 | .SH NAME |
| 28 | runtests.pl \- run one or more test cases |
| 29 | .SH SYNOPSIS |
| 30 | .B runtests.pl [options] [tests] |
| 31 | .SH DESCRIPTION |
| 32 | \fIruntests.pl\fP runs one, several or all the existing test cases in curl's |
| 33 | test suite. It is often called from the root Makefile of the curl package with |
| 34 | \&'make test'. |
| 35 | .SH "TESTS" |
| 36 | Specify which test(s) to run by specifying test numbers or keywords. |
| 37 | |
| 38 | If no test number or keyword is given, all existing tests that the script can |
| 39 | find will be considered for running. You can specify single test cases to run |
| 40 | by specifying test numbers space-separated, like "1 3 5 7 11", and you can |
| 41 | specify a range of tests like "45 to 67". |
| 42 | |
| 43 | Specify tests to not run with a leading exclamation point, like "!66", which |
| 44 | runs all available tests except number 66. |
| 45 | |
| 46 | Prefix a test number with a tilde (~) to still run it, but ignore the results. |
| 47 | |
| 48 | It is also possible to specify tests based on a keyword describing the test(s) |
| 49 | to run, like "FTPS". The keywords are strings used in the individual tests. |
| 50 | |
| 51 | You can also specify keywords with a leading exclamation point and the keyword |
| 52 | or phrase, like "!HTTP NTLM auth" to run all tests \fBexcept\fP those using |
| 53 | this keyword. Remember that the exclamation marks and spaces will need to be |
| 54 | quoted somehow when entered at many command shells. |
| 55 | |
| 56 | Prefix a keyword with a tilde (~) to still run it, but ignore the results. |
| 57 | .SH OPTIONS |
| 58 | .IP "-a" |
| 59 | Continue running the rest of the test cases even if one test fails. By |
| 60 | default, the test script stops as soon as an error is detected. |
| 61 | .IP "-c <curl>" |
| 62 | Provide a path to a custom curl binary to run the tests with. Default is the |
| 63 | curl executable in the build tree. |
| 64 | .IP "-d" |
| 65 | Enable protocol debug: have the servers display protocol output. |
| 66 | .IP "-E <exclude_file>" |
| 67 | Load the \fBexclude_file\fP with additional reasons why certain tests |
| 68 | should be skipped. Useful when testing with external HTTP proxies in |
| 69 | which case some of the tests aren't appropriate. |
| 70 | The file contains colon-delimited lines. The first field contains the |
| 71 | type of exclusion, the second field contains a pattern and the final |
| 72 | field contains the reason why matching tests should be skipped. |
| 73 | The exclusion types are \fkeyword\fP, \ftest\fP, and \ftool\fP. |
| 74 | .IP "-e" |
| 75 | Run the test event-based (if possible). This will make runtests invoke curl |
| 76 | with --test-event option. This option only works if both curl and libcurl were |
| 77 | built debug-enabled. |
| 78 | .IP "-f" |
| 79 | Force the test to run even if mentioned in DISABLED. |
| 80 | .IP "-g" |
| 81 | Run the given test(s) with gdb. This is best used on a single test case and |
| 82 | curl built --disable-shared. This then fires up gdb with command line set to |
| 83 | run the specified test case. Simply (set a break-point and) type 'run' to |
| 84 | start. |
| 85 | .IP "-h" |
| 86 | Displays a help text about this program's command line options. |
| 87 | .IP "-k" |
| 88 | Keep output and log files in log/ after a test run, even if no error was |
| 89 | detected. Useful for debugging. |
| 90 | .IP "-L <file>" |
| 91 | Load and execute the specified file which should contain perl code. |
| 92 | This option allows one to change \fIruntests.pl\fP behaviour by overwriting |
| 93 | functions and variables and is useful when testing external proxies |
| 94 | using curl's regression test suite. |
| 95 | .IP "-l" |
| 96 | Lists all test case names. |
| 97 | .IP "-n" |
| 98 | Disable the check for and use of valgrind. |
| 99 | .IP "-o <variablename=value>" |
| 100 | Overwrite the specified internal \fBvariable\fP with \fBvalue\fP. |
| 101 | Useful to change variables that didn't get a dedicated flag to change them. |
| 102 | Check the source to see which variables are available. |
| 103 | .IP "-P <proxy>" |
| 104 | Use the specified HTTP proxy when executing tests, even if the tests |
| 105 | themselves don't specify a proxy. This option allows one to test external |
| 106 | proxies using curl's regression test suite. |
| 107 | .IP "-p" |
| 108 | Prints out all files in "log/" to stdout when a test case fails. Very |
| 109 | practical when used in the automated and distributed tests since then the |
| 110 | people checking the failures and the reasons for them might not have physical |
| 111 | access to the machine and logs. |
| 112 | .IP "-R" |
| 113 | Run the tests in a scrambled, or randomized, order instead of sequentially. |
| 114 | |
| 115 | The random seed initially set for this is fixed per month and can be set with |
| 116 | \fI--seed\fP. |
| 117 | .IP "-r" |
| 118 | Display run time statistics. (Requires Perl Time::HiRes module) |
| 119 | .IP "-rf" |
| 120 | Display full run time statistics. (Requires Perl Time::HiRes module) |
| 121 | .IP "-rm" |
| 122 | Force removal of files by killing locking processes. (Windows only, |
| 123 | requires Sysinternals handle[64].exe to be on PATH) |
| 124 | .IP "--repeat=[num]" |
| 125 | This will repeat the given set of test numbers this many times. If no test |
| 126 | numbers are given, it will repeat ALL tests this many times. It iteratively |
| 127 | adds the new sequence at the end of the initially given one. |
| 128 | |
| 129 | If \fB-R\fP is also used, the scrambling is done after the repeats have |
| 130 | extended the test sequence. |
| 131 | .IP "-s" |
| 132 | Shorter output. Speaks less than default. |
| 133 | .IP "--seed=[num]" |
| 134 | When using \fI--shallow\fP or \fI-R\rP that random certain aspects of the |
| 135 | behavior, this option can set the initial seed. If not set, the random seed |
| 136 | will be set based on the currently set local year and month and the first line |
| 137 | of the "curl -V" output. |
| 138 | .IP "--shallow=[num]" |
| 139 | Used together with \fB-t\fP. This limits the number of tests to fail in |
| 140 | torture mode to no more than 'num' per test case. If this reduces the amount, |
| 141 | the script will randomly discard entries to fail until the amount is 'num'. |
| 142 | |
| 143 | The random seed initially set for this is fixed per month and can be set with |
| 144 | \fI--seed\fP. |
| 145 | .IP "-t[num]" |
| 146 | Selects a \fBtorture\fP test for the given tests. This makes runtests.pl first |
| 147 | run the tests once and count the number of memory allocations made. It then |
| 148 | reruns the test that number of times, each time forcing one of the allocations |
| 149 | to fail until all allocs have been tested. By setting \fInum\fP you can force |
| 150 | the allocation with that number to be set to fail at once instead of looping |
| 151 | through everyone, which is very handy when debugging and then often in |
| 152 | combination with \fI-g\fP. |
| 153 | .IP "-u" |
| 154 | Error instead of warning on server unexpectedly alive. |
| 155 | .IP "-v" |
| 156 | Enable verbose output. Speaks more than default. |
| 157 | .IP "-vc <curl>" |
| 158 | Provide a path to a custom curl binary to run when verifying that the servers |
| 159 | running are indeed our test servers. Default is the curl executable in the |
| 160 | build tree. |
| 161 | .SH "RUNNING TESTS" |
| 162 | Many tests have conditions that must be met before the test case can run |
| 163 | fine. They could depend on built-in features in libcurl or features present in |
| 164 | the operating system or even in third-party libraries that curl may or may not |
| 165 | use. |
| 166 | .P |
| 167 | The test script checks most of these by itself to determine when it is |
| 168 | safe to attempt to run each test. Those which cannot be run due to |
| 169 | failed requirements will simply be skipped and listed at the completion |
| 170 | of all test cases. In some unusual configurations, the test script |
| 171 | cannot make the correct determination for all tests. In these cases, |
| 172 | the problematic tests can be skipped using the "!keyword" skip feature |
| 173 | documented earlier. |
| 174 | .SH "WRITING TESTS" |
| 175 | The simplest way to write test cases is to start with a similar existing test, |
| 176 | save it with a new number and then adjust it to fit. There's an attempt to |
| 177 | document the test case file format in the tests/FILEFORMAT. |