regression.html 9.5 KB

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