runtests.1 8.1 KB

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