ctest_test.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ctest_test
  2. ----------
  3. Perform the :ref:`CTest Test Step` as a :ref:`Dashboard Client`.
  4. ::
  5. ctest_test([BUILD <build-dir>] [APPEND]
  6. [START <start-number>]
  7. [END <end-number>]
  8. [STRIDE <stride-number>]
  9. [EXCLUDE <exclude-regex>]
  10. [INCLUDE <include-regex>]
  11. [EXCLUDE_LABEL <label-exclude-regex>]
  12. [INCLUDE_LABEL <label-include-regex>]
  13. [EXCLUDE_FIXTURE <regex>]
  14. [EXCLUDE_FIXTURE_SETUP <regex>]
  15. [EXCLUDE_FIXTURE_CLEANUP <regex>]
  16. [PARALLEL_LEVEL <level>]
  17. [TEST_LOAD <threshold>]
  18. [SCHEDULE_RANDOM <ON|OFF>]
  19. [STOP_TIME <time-of-day>]
  20. [RETURN_VALUE <result-var>]
  21. [CAPTURE_CMAKE_ERROR <result-var>]
  22. [QUIET]
  23. )
  24. Run tests in the project build tree and store results in
  25. ``Test.xml`` for submission with the :command:`ctest_submit` command.
  26. The options are:
  27. ``BUILD <build-dir>``
  28. Specify the top-level build directory. If not given, the
  29. :variable:`CTEST_BINARY_DIRECTORY` variable is used.
  30. ``APPEND``
  31. Mark ``Test.xml`` for append to results previously submitted to a
  32. dashboard server since the last :command:`ctest_start` call.
  33. Append semantics are defined by the dashboard server in use.
  34. This does *not* cause results to be appended to a ``.xml`` file
  35. produced by a previous call to this command.
  36. ``START <start-number>``
  37. Specify the beginning of a range of test numbers.
  38. ``END <end-number>``
  39. Specify the end of a range of test numbers.
  40. ``STRIDE <stride-number>``
  41. Specify the stride by which to step across a range of test numbers.
  42. ``EXCLUDE <exclude-regex>``
  43. Specify a regular expression matching test names to exclude.
  44. ``INCLUDE <include-regex>``
  45. Specify a regular expression matching test names to include.
  46. Tests not matching this expression are excluded.
  47. ``EXCLUDE_LABEL <label-exclude-regex>``
  48. Specify a regular expression matching test labels to exclude.
  49. ``INCLUDE_LABEL <label-include-regex>``
  50. Specify a regular expression matching test labels to include.
  51. Tests not matching this expression are excluded.
  52. ``EXCLUDE_FIXTURE <regex>``
  53. If a test in the set of tests to be executed requires a particular fixture,
  54. that fixture's setup and cleanup tests would normally be added to the test
  55. set automatically. This option prevents adding setup or cleanup tests for
  56. fixtures matching the ``<regex>``. Note that all other fixture behavior is
  57. retained, including test dependencies and skipping tests that have fixture
  58. setup tests that fail.
  59. ``EXCLUDE_FIXTURE_SETUP <regex>``
  60. Same as ``EXCLUDE_FIXTURE`` except only matching setup tests are excluded.
  61. ``EXCLUDE_FIXTURE_CLEANUP <regex>``
  62. Same as ``EXCLUDE_FIXTURE`` except only matching cleanup tests are excluded.
  63. ``PARALLEL_LEVEL <level>``
  64. Specify a positive number representing the number of tests to
  65. be run in parallel.
  66. ``TEST_LOAD <threshold>``
  67. While running tests in parallel, try not to start tests when they
  68. may cause the CPU load to pass above a given threshold. If not
  69. specified the :variable:`CTEST_TEST_LOAD` variable will be checked,
  70. and then the ``--test-load`` command-line argument to :manual:`ctest(1)`.
  71. See also the ``TestLoad`` setting in the :ref:`CTest Test Step`.
  72. ``SCHEDULE_RANDOM <ON|OFF>``
  73. Launch tests in a random order. This may be useful for detecting
  74. implicit test dependencies.
  75. ``STOP_TIME <time-of-day>``
  76. Specify a time of day at which the tests should all stop running.
  77. ``RETURN_VALUE <result-var>``
  78. Store in the ``<result-var>`` variable ``0`` if all tests passed.
  79. Store non-zero if anything went wrong.
  80. ``CAPTURE_CMAKE_ERROR <result-var>``
  81. Store in the ``<result-var>`` variable -1 if there are any errors running
  82. the command and prevent ctest from returning non-zero if an error occurs.
  83. ``QUIET``
  84. Suppress any CTest-specific non-error messages that would have otherwise
  85. been printed to the console. Output from the underlying test command is not
  86. affected. Summary info detailing the percentage of passing tests is also
  87. unaffected by the ``QUIET`` option.
  88. See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE`
  89. and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables.