run_test.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>run_test</title>
  5. <link rel="stylesheet" href="../../../boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../../index.html" title="Boost.Test">
  8. <link rel="up" href="../rt_param_reference.html" title="Runtime parameters reference">
  9. <link rel="prev" href="result_code.html" title="result_code">
  10. <link rel="next" href="save_pattern.html" title="save_pattern">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="result_code.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rt_param_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="save_pattern.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h4 class="title">
  27. <a name="boost_test.utf_reference.rt_param_reference.run_test"></a><a class="link" href="run_test.html" title="run_test"><code class="computeroutput"><span class="identifier">run_test</span></code></a>
  28. </h4></div></div></div>
  29. <p>
  30. Parameter <span class="emphasis"><em>run_test</em></span> allows to filter which test units
  31. to execute during testing. The <span class="emphasis"><em>Unit Test Framework</em></span>
  32. supports both "selection filters", which allow to select which
  33. test units to enable from the set of available test units, and "disabler
  34. filters", which allow to disable some test units. The <span class="emphasis"><em>Unit
  35. Test Framework</em></span> also supports enabling/disabling test units at
  36. compile time. These settings identify the default set of test units to
  37. run. Parameter <span class="emphasis"><em>run_test</em></span> is used to change this default.
  38. This parameter is repeatable, so you can specify more than one filter if
  39. necessary. It is also possible to use the ':' for separating each filter
  40. which can be used for filtering the tests with the environment variable
  41. <code class="computeroutput"><span class="identifier">BOOST_TEST_RUN_FILTERS</span></code>
  42. (as it cannot be repeated like <code class="computeroutput"><span class="special">--</span><span class="identifier">run_test</span></code>).
  43. </p>
  44. <p>
  45. More details about practical application of this parameter resides in
  46. <a class="link" href="../../runtime_config/test_unit_filtering.html" title="Test unit filtering">test unit
  47. filtering</a> section.
  48. </p>
  49. <h5>
  50. <a name="boost_test.utf_reference.rt_param_reference.run_test.h0"></a>
  51. <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.run_test.acceptable_values"></a></span><a class="link" href="run_test.html#boost_test.utf_reference.rt_param_reference.run_test.acceptable_values">Acceptable
  52. values</a>
  53. </h5>
  54. <p>
  55. <a class="link" href="../rt_param_reference.html#regular_param_value">String</a> value representing single
  56. filter or a set of filters separated by ':'. The following grammar productions
  57. describe the syntax of filters:
  58. </p>
  59. <pre class="programlisting"><span class="identifier">filter_set</span> <span class="special">::=</span> <span class="special">(</span><span class="identifier">filter</span> <span class="char">':'</span><span class="special">)*</span> <span class="identifier">filter</span>
  60. <span class="identifier">filter</span> <span class="special">::=</span> <span class="identifier">relative_spec</span><span class="special">?</span> <span class="identifier">test_set</span>
  61. <span class="identifier">relative_spec</span> <span class="special">::=</span> <span class="char">'+'</span> <span class="special">|</span> <span class="char">'!'</span>
  62. <span class="identifier">test_set</span> <span class="special">::=</span> <span class="identifier">label</span> <span class="special">|</span> <span class="identifier">path</span>
  63. <span class="identifier">label</span> <span class="special">::=</span> <span class="char">'@'</span> <span class="identifier">identifier</span>
  64. <span class="identifier">path</span> <span class="special">::=</span> <span class="special">(</span><span class="identifier">suite</span> <span class="char">'/'</span><span class="special">)?</span> <span class="identifier">pattern_list</span>
  65. <span class="identifier">pattern_list</span> <span class="special">::=</span> <span class="special">(</span><span class="identifier">pattern</span> <span class="char">','</span><span class="special">)*</span> <span class="identifier">pattern</span>
  66. <span class="identifier">suite</span> <span class="special">::=</span> <span class="special">(</span><span class="identifier">pattern</span> <span class="char">'/'</span><span class="special">)*</span> <span class="identifier">pattern</span>
  67. <span class="identifier">pattern</span> <span class="special">::=</span> <span class="char">'*'</span><span class="special">?</span> <span class="identifier">identifier</span> <span class="char">'*'</span><span class="special">?</span>
  68. </pre>
  69. <div class="caution"><table border="0" summary="Caution">
  70. <tr>
  71. <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td>
  72. <th align="left">Caution</th>
  73. </tr>
  74. <tr><td align="left" valign="top"><p>
  75. the <code class="computeroutput"><span class="identifier">pattern_list</span></code> above
  76. indicates test unit inside the same test suite given by <code class="computeroutput"><span class="identifier">suite</span></code>. This means that the syntax "<code class="computeroutput"><span class="special">--</span><span class="identifier">run_test</span><span class="special">=</span><span class="identifier">suite1</span><span class="special">/</span><span class="identifier">suite2</span><span class="special">/</span><span class="identifier">A</span><span class="special">,</span><span class="identifier">B</span><span class="special">,</span><span class="identifier">C</span></code>"
  77. runs the test cases <code class="computeroutput"><span class="identifier">A</span></code>,
  78. <code class="computeroutput"><span class="identifier">B</span></code> and <code class="computeroutput"><span class="identifier">C</span></code>
  79. that are <span class="bold"><strong>inside</strong></span> <code class="computeroutput"><span class="identifier">suite1</span><span class="special">/</span><span class="identifier">suite2</span></code>.
  80. In order to indicate several test units that are not siblings, either
  81. repeat the <code class="computeroutput"><span class="special">--</span><span class="identifier">run_test</span></code>
  82. or use <code class="computeroutput"><span class="special">:</span></code> to separate the
  83. filters.
  84. </p></td></tr>
  85. </table></div>
  86. <p>
  87. Regarding the meaning of these values <a class="link" href="../../runtime_config/test_unit_filtering.html#ref_command_line_control">see
  88. here</a>.
  89. </p>
  90. <h5>
  91. <a name="boost_test.utf_reference.rt_param_reference.run_test.h1"></a>
  92. <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.run_test.command_line_syntax"></a></span><a class="link" href="run_test.html#boost_test.utf_reference.rt_param_reference.run_test.command_line_syntax">Command
  93. line syntax</a>
  94. </h5>
  95. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  96. <li class="listitem">
  97. <code class="computeroutput"><span class="special">--</span><span class="identifier">run_test</span><span class="special">=&lt;</span><span class="identifier">test</span>
  98. <span class="identifier">unit</span> <span class="identifier">filter</span>
  99. <span class="identifier">spec</span><span class="special">&gt;</span></code>
  100. </li>
  101. <li class="listitem">
  102. <code class="computeroutput"><span class="special">-</span><span class="identifier">t</span>
  103. <span class="special">&lt;</span><span class="identifier">test</span>
  104. <span class="identifier">unit</span> <span class="identifier">filter</span>
  105. <span class="identifier">spec</span><span class="special">&gt;</span></code>
  106. </li>
  107. </ul></div>
  108. <h5>
  109. <a name="boost_test.utf_reference.rt_param_reference.run_test.h2"></a>
  110. <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.run_test.environment_variable"></a></span><a class="link" href="run_test.html#boost_test.utf_reference.rt_param_reference.run_test.environment_variable">Environment
  111. variable</a>
  112. </h5>
  113. <pre class="programlisting"><span class="identifier">BOOST_TEST_RUN_FILTERS</span>
  114. </pre>
  115. </div>
  116. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  117. <td align="left"></td>
  118. <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2019 Boost.Test
  119. contributors<p>
  120. Distributed under the Boost Software License, Version 1.0. (See accompanying
  121. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  122. </p>
  123. </div></td>
  124. </tr></table>
  125. <hr>
  126. <div class="spirit-nav">
  127. <a accesskey="p" href="result_code.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rt_param_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="save_pattern.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  128. </div>
  129. </body>
  130. </html>