regression.html 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <title>Boost Internal Regression Test Suite</title>
  5. </head>
  6. <body bgcolor="#FFFFFF" text="#000000">
  7. <table border="1" bgcolor="#007F7F" cellpadding="2">
  8. <tr>
  9. <td bgcolor="#FFFFFF"><img src="../c++boost.gif" alt="c++boost.gif (8819 bytes)" width="277" height="86"></td>
  10. <td><a href="../index.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>Home</big></font></a></td>
  11. <td><a href="../libs/libraries.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>Libraries</big></font></a></td>
  12. <td><a href="../people/people.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>People</big></font></a></td>
  13. <td><a href="../more/faq.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>FAQ</big></font></a></td>
  14. <td><a href="../more/index.htm"><font face="Arial,Helvetica" color="#FFFFFF"><big>More</big></font></a></td>
  15. </tr>
  16. </table>
  17. <h1>Internal Regression Test Suite</h1>
  18. Boost's internal regression test suite produces the
  19. <a href="../status/compiler_status.html">compiler status tables</a>.
  20. <h2>Requirements</h2>
  21. The test suite has been design according to the following requirements.
  22. <ul>
  23. <li>Pure ISO C++, no tools required except a C++ compiler.
  24. <li>Support for tests which expect an error
  25. <li>Flexible configuration
  26. <li>HTML output
  27. </ul>
  28. These requirements rule out any script-based approach such as dejagnu
  29. (requires Tcl and expect) or even shell scripts.
  30. <h2>Running Regression Tests</h2>
  31. The implementation is provided in a single source file named
  32. <a href="../status/regression.cpp">regression.cpp</a>.
  33. <p>
  34. You should be able to compile and link this file using whatever C++
  35. compiler is at your disposition. However, you may need to configure
  36. both the compiler and the standard library to use "strict" ISO
  37. compliance mode. Also, you need to extend the search path for include
  38. files with the main boost directory so that the header file
  39. <a href="../boost/config.hpp">boost/config.hpp</a>
  40. can be found. This header file is required to work around compiler
  41. deficiencies.
  42. <p>
  43. You can then start the resulting executable to run regression tests.
  44. By default, the regression test program reads the file "compiler.cfg"
  45. in the current directory to determine the list of compilers and their
  46. invocation syntax. After that, it reads the file "regression.cfg" in
  47. the current directory to determine the regression tests to run. The
  48. results of the regression tests are written in an HTML formatted text
  49. file. This file is by default named "cs-OS.html" in the current
  50. directory, where "OS" is a placeholder for the name of the operating
  51. system (e.g., "linux" or "win32").
  52. <p>
  53. To generate the
  54. <a href="../status/compiler_status.html">compiler status tables</a>,
  55. boost uses the files
  56. <a href="../status/compiler.cfg">status/compiler.cfg</a>
  57. and
  58. <a href="../status/regression.cfg">status/regression.cfg</a>.
  59. <p>
  60. The regression test program accepts some command-line options to alter
  61. its behavior.
  62. <p>
  63. <table border="1">
  64. <tr>
  65. <td>-h <em>or</em> --help</td>
  66. <td>prints a help message
  67. </tr>
  68. <tr>
  69. <td>--config <em>file</em></td>
  70. <td>Use <em>file</em> instead of "compiler.cfg" as the compiler
  71. configuration file. This allows for private compiler setups.</td>
  72. </tr>
  73. <tr>
  74. <td>--tests <em>file</em></td>
  75. <td>Use <em>file</em> instead of "regression.cfg" as the tests
  76. configuration file. This allows individual libraries to specify
  77. additional tests not to be published in the main
  78. <a href="../status/compiler_status.html">compiler status tables</a>.
  79. </td>
  80. </tr>
  81. <tr>
  82. <td>--boost <em>path</em></td>
  83. <td>Use <em>path</em> as the filesystem path to the main boost
  84. directory. The default is "..", i.e. the parent directory.</td>
  85. </tr>
  86. <tr>
  87. <td>--output <em>file</em><br>-o <em>file</em></td>
  88. <td>Write the HTML output to <em>file</em> instead of the default
  89. "cs-OS.html".</td>
  90. </tr>
  91. <tr>
  92. <td>--compiler <em>name</em></td>
  93. <td>Run the tests only with compiler <em>name</em>. The <em>name</em>
  94. must be defined in the second line of an applicable compiler
  95. configuration (see below). The default is to run the tests with all
  96. compilers suitable for the platform.</td>
  97. </tr>
  98. <tr>
  99. <td>--diff</td>
  100. <td>Read the HTML output file before writing it. In the HTML output,
  101. highlight differences in test outcomes compared to the previous
  102. run.</td>
  103. </tr>
  104. <tr>
  105. <td><em>test</em></td>
  106. <td>Run only the named test. The syntax is the same as in the
  107. configuration file (see below).</td>
  108. </tr>
  109. </table>
  110. <p>
  111. When running only a selected test, you must also provide an alternate
  112. HTML output filename with "--output" so that the full test output is
  113. not accidentally overwritten.
  114. <p>
  115. You should redirect the output (<code>std::cout</code>) and error
  116. (<code>std::cerr</code>) channels to a suitable log file for later
  117. inspection.
  118. <h2>Configuration Files</h2>
  119. In both configuration files, single-line comments starting with "//"
  120. at the leftmost column are ignored.
  121. <h3>Compiler Configuration</h3>
  122. The compiler configuration file can contain descriptions for an
  123. arbitrary number of compilers. Each compiler is configured by a block
  124. of six consecutive text lines.
  125. <ol>
  126. <li>Name of the operating system for which the entry is applicable
  127. (e.g., "linux" or "win32").
  128. <li>Name of the compiler; should be unique within one operating
  129. system. The name of the compiler should not contain the version
  130. number, because it is expected that regression tests are always run
  131. with the most recent compiler version available.
  132. <li>Name and version number of the compiler. This is printed on
  133. <code>std::cout</code> prior to running a test with that compiler.
  134. <li>Command-line invocation of the compiler to compile a single source
  135. file to an object file.
  136. <li>Command-line invocation of the compiler to compile a single source
  137. file to an executable.
  138. <li>Identification of the compiler for inclusion in the HTML output;
  139. may contain HTML tags such as &lt;br>.
  140. </ol>
  141. The two command-lines are subject to the following substitutions:
  142. <ul>
  143. <li>Any string starting with a dollar symbol "$", then containing an
  144. arbitrary number of underscores, digits, or uppercase letters, is
  145. replaced by the value of the associated environment variable.
  146. <li>%include is replaced by the path given by the "--boost" command
  147. line option (".." by default). This should be used to extend the
  148. search path of your compiler so that the boost header files are found.
  149. <li>%source is the name of the source file to be compiled, qualified
  150. with the path given by the "--boost" command-line option (".." by
  151. default).
  152. </ul>
  153. <h3>Test Configuration</h3>
  154. The test configuration file can contain descriptions for an arbitrary
  155. number of tests. Each test is described by a single line. The first
  156. word (up to the first space) is the type of the test, the next word
  157. gives the filename of the test relative the directory to be given by the
  158. "--boost" command-line option. Optionally, additional words are
  159. passed on as command-line arguments when the test is executed (only
  160. for types "run" and "run-fail"). In these arguments, "%boost" is
  161. replaced by the path given by the "--boost" command-line option (".."
  162. by default).
  163. <p>
  164. The following test types are available:
  165. <ul>
  166. <li>compile: The given test file should compile successfully.
  167. Otherwise, the test fails.
  168. <li>compile-fail: The given test file should not compile successfully,
  169. but instead the compiler should give an error message. If the test
  170. does compile successfully, the test fails.
  171. <li>link: The given test file should compile and link successfully.
  172. Otherwise, the test fails. In particular, a <code>main</code>
  173. function must be present in the test file.
  174. <li>link-fail: The given test file should not compile and link
  175. successfully. It is not specified whether the compile or the link
  176. should not succeed. If the test does compile and link successfully,
  177. the test fails.
  178. <li>run: The given test file should compile and link successfully.
  179. After that, the resulting executable is invoked and should return a
  180. zero exit code. If any of these steps fail, the test fails.
  181. <li>run-fail: The given test file is compiled, linked, and, if an
  182. executable was successfully generated, it is invoked. Either
  183. compiling or linking should fail or the resulting executable should
  184. return a non-zero exit code. If compiling and linking succeeds and
  185. the resulting executable returns a zero exit code, the test fails.
  186. </ul>
  187. <h2>Adapting for a New Platform</h2>
  188. In order to adapt the regression test suite for a new platform, a few
  189. changes to the <a href="../status/regression.cpp">regression.cpp</a>
  190. are required.
  191. <ul>
  192. <li>Add an appropriate check for your platform in
  193. <code>get_host()</code> and return a unique string identifying the
  194. platform (this string is used to filter the compile configuration
  195. file).
  196. <li>Verify that <code>get_system_configuration()</code> is
  197. appropriately defined for your platform. For a Unix platform, it most
  198. likely is. The function may return a verbose HTML string describing
  199. the platform.
  200. </ul>
  201. You also need to configure the compilers available on your platform in
  202. "compiler.cfg" as described above.
  203. <p>
  204. <hr>
  205. 2001-01-30<br>
  206. <a href="../people/jens_maurer.htm">Jens Maurer</a>
  207. </body>
  208. </html>
粤ICP备19079148号