ctest.1.rst 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668
  1. .. cmake-manual-description: CTest Command-Line Reference
  2. ctest(1)
  3. ********
  4. .. contents::
  5. Synopsis
  6. ========
  7. .. parsed-literal::
  8. ctest [<options>]
  9. ctest --build-and-test <path-to-source> <path-to-build>
  10. --build-generator <generator> [<options>...]
  11. [--build-options <opts>...] [--test-command <command> [<args>...]]
  12. ctest {-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>}
  13. [-- <dashboard-options>...]
  14. Description
  15. ===========
  16. The **ctest** executable is the CMake test driver program.
  17. CMake-generated build trees created for projects that use the
  18. :command:`enable_testing` and :command:`add_test` commands have testing support.
  19. This program will run the tests and report results.
  20. .. _`CTest Options`:
  21. Options
  22. =======
  23. ``--preset <preset>``, ``--preset=<preset>``
  24. Use a test preset to specify test options. The project binary directory
  25. is inferred from the ``configurePreset`` key. The current working directory
  26. must contain CMake preset files.
  27. See :manual:`preset <cmake-presets(7)>` for more details.
  28. ``--list-presets``
  29. Lists the available test presets. The current working directory must contain
  30. CMake preset files.
  31. ``-C <cfg>, --build-config <cfg>``
  32. Choose configuration to test.
  33. Some CMake-generated build trees can have multiple build
  34. configurations in the same tree. This option can be used to specify
  35. which one should be tested. Example configurations are ``Debug`` and
  36. ``Release``.
  37. ``--progress``
  38. Enable short progress output from tests.
  39. When the output of **ctest** is being sent directly to a terminal, the
  40. progress through the set of tests is reported by updating the same line
  41. rather than printing start and end messages for each test on new lines.
  42. This can significantly reduce the verbosity of the test output.
  43. Test completion messages are still output on their own line for failed
  44. tests and the final test summary will also still be logged.
  45. This option can also be enabled by setting the environment variable
  46. :envvar:`CTEST_PROGRESS_OUTPUT`.
  47. ``-V,--verbose``
  48. Enable verbose output from tests.
  49. Test output is normally suppressed and only summary information is
  50. displayed. This option will show all test output.
  51. ``-VV,--extra-verbose``
  52. Enable more verbose output from tests.
  53. Test output is normally suppressed and only summary information is
  54. displayed. This option will show even more test output.
  55. ``--debug``
  56. Displaying more verbose internals of CTest.
  57. This feature will result in a large number of output that is mostly
  58. useful for debugging dashboard problems.
  59. ``--output-on-failure``
  60. Output anything outputted by the test program if the test should fail.
  61. This option can also be enabled by setting the
  62. :envvar:`CTEST_OUTPUT_ON_FAILURE` environment variable
  63. ``--stop-on-failure``
  64. Stop running the tests when the first failure happens.
  65. ``-F``
  66. Enable failover.
  67. This option allows CTest to resume a test set execution that was
  68. previously interrupted. If no interruption occurred, the ``-F`` option
  69. will have no effect.
  70. ``-j <jobs>, --parallel <jobs>``
  71. Run the tests in parallel using the given number of jobs.
  72. This option tells CTest to run the tests in parallel using given
  73. number of jobs. This option can also be set by setting the
  74. :envvar:`CTEST_PARALLEL_LEVEL` environment variable.
  75. This option can be used with the :prop_test:`PROCESSORS` test property.
  76. See `Label and Subproject Summary`_.
  77. ``--resource-spec-file <file>``
  78. Run CTest with :ref:`resource allocation <ctest-resource-allocation>` enabled,
  79. using the
  80. :ref:`resource specification file <ctest-resource-specification-file>`
  81. specified in ``<file>``.
  82. When ``ctest`` is run as a `Dashboard Client`_ this sets the
  83. ``ResourceSpecFile`` option of the `CTest Test Step`_.
  84. ``--test-load <level>``
  85. While running tests in parallel (e.g. with ``-j``), try not to start
  86. tests when they may cause the CPU load to pass above a given threshold.
  87. When ``ctest`` is run as a `Dashboard Client`_ this sets the
  88. ``TestLoad`` option of the `CTest Test Step`_.
  89. ``-Q,--quiet``
  90. Make CTest quiet.
  91. This option will suppress all the output. The output log file will
  92. still be generated if the ``--output-log`` is specified. Options such
  93. as ``--verbose``, ``--extra-verbose``, and ``--debug`` are ignored
  94. if ``--quiet`` is specified.
  95. ``-O <file>, --output-log <file>``
  96. Output to log file.
  97. This option tells CTest to write all its output to a ``<file>`` log file.
  98. ``-N,--show-only[=<format>]``
  99. Disable actual execution of tests.
  100. This option tells CTest to list the tests that would be run but not
  101. actually run them. Useful in conjunction with the ``-R`` and ``-E``
  102. options.
  103. ``<format>`` can be one of the following values.
  104. ``human``
  105. Human-friendly output. This is not guaranteed to be stable.
  106. This is the default.
  107. ``json-v1``
  108. Dump the test information in JSON format.
  109. See `Show as JSON Object Model`_.
  110. ``-L <regex>, --label-regex <regex>``
  111. Run tests with labels matching regular expression.
  112. This option tells CTest to run only the tests whose labels match the
  113. given regular expression. When more than one ``-L`` option is given,
  114. a test will only be run if each regular expression matches at least one
  115. of the test's labels (i.e. the multiple ``-L`` labels form an ``AND``
  116. relationship). See `Label Matching`_.
  117. ``-R <regex>, --tests-regex <regex>``
  118. Run tests matching regular expression.
  119. This option tells CTest to run only the tests whose names match the
  120. given regular expression.
  121. ``-E <regex>, --exclude-regex <regex>``
  122. Exclude tests matching regular expression.
  123. This option tells CTest to NOT run the tests whose names match the
  124. given regular expression.
  125. ``-LE <regex>, --label-exclude <regex>``
  126. Exclude tests with labels matching regular expression.
  127. This option tells CTest to NOT run the tests whose labels match the
  128. given regular expression. When more than one ``-LE`` option is given,
  129. a test will only be excluded if each regular expression matches at least one
  130. of the test's labels (i.e. the multiple ``-LE`` labels form an ``AND``
  131. relationship). See `Label Matching`_.
  132. ``-FA <regex>, --fixture-exclude-any <regex>``
  133. Exclude fixtures matching ``<regex>`` from automatically adding any tests to
  134. the test set.
  135. If a test in the set of tests to be executed requires a particular fixture,
  136. that fixture's setup and cleanup tests would normally be added to the test set
  137. automatically. This option prevents adding setup or cleanup tests for fixtures
  138. matching the ``<regex>``. Note that all other fixture behavior is retained,
  139. including test dependencies and skipping tests that have fixture setup tests
  140. that fail.
  141. ``-FS <regex>, --fixture-exclude-setup <regex>``
  142. Same as ``-FA`` except only matching setup tests are excluded.
  143. ``-FC <regex>, --fixture-exclude-cleanup <regex>``
  144. Same as ``-FA`` except only matching cleanup tests are excluded.
  145. ``-D <dashboard>, --dashboard <dashboard>``
  146. Execute dashboard test.
  147. This option tells CTest to act as a CDash client and perform a
  148. dashboard test. All tests are ``<Mode><Test>``, where ``<Mode>`` can be
  149. ``Experimental``, ``Nightly``, and ``Continuous``, and ``<Test>`` can be
  150. ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``,
  151. ``Coverage``, and ``Submit``.
  152. See `Dashboard Client`_.
  153. ``-D <var>:<type>=<value>``
  154. Define a variable for script mode.
  155. Pass in variable values on the command line. Use in conjunction
  156. with ``-S`` to pass variable values to a dashboard script. Parsing ``-D``
  157. arguments as variable values is only attempted if the value
  158. following ``-D`` does not match any of the known dashboard types.
  159. ``-M <model>, --test-model <model>``
  160. Sets the model for a dashboard.
  161. This option tells CTest to act as a CDash client where the ``<model>``
  162. can be ``Experimental``, ``Nightly``, and ``Continuous``.
  163. Combining ``-M`` and ``-T`` is similar to ``-D``.
  164. See `Dashboard Client`_.
  165. ``-T <action>, --test-action <action>``
  166. Sets the dashboard action to perform.
  167. This option tells CTest to act as a CDash client and perform some
  168. action such as ``start``, ``build``, ``test`` etc. See
  169. `Dashboard Client Steps`_ for the full list of actions.
  170. Combining ``-M`` and ``-T`` is similar to ``-D``.
  171. See `Dashboard Client`_.
  172. ``-S <script>, --script <script>``
  173. Execute a dashboard for a configuration.
  174. This option tells CTest to load in a configuration script which sets
  175. a number of parameters such as the binary and source directories.
  176. Then CTest will do what is required to create and run a dashboard.
  177. This option basically sets up a dashboard and then runs ``ctest -D``
  178. with the appropriate options.
  179. See `Dashboard Client`_.
  180. ``-SP <script>, --script-new-process <script>``
  181. Execute a dashboard for a configuration.
  182. This option does the same operations as ``-S`` but it will do them in a
  183. separate process. This is primarily useful in cases where the
  184. script may modify the environment and you do not want the modified
  185. environment to impact other ``-S`` scripts.
  186. See `Dashboard Client`_.
  187. ``-I [Start,End,Stride,test#,test#|Test file], --tests-information``
  188. Run a specific number of tests by number.
  189. This option causes CTest to run tests starting at number ``Start``,
  190. ending at number ``End``, and incrementing by ``Stride``. Any additional
  191. numbers after ``Stride`` are considered individual test numbers. ``Start``,
  192. ``End``, or ``Stride`` can be empty. Optionally a file can be given that
  193. contains the same syntax as the command line.
  194. ``-U, --union``
  195. Take the Union of ``-I`` and ``-R``.
  196. When both ``-R`` and ``-I`` are specified by default the intersection of
  197. tests are run. By specifying ``-U`` the union of tests is run instead.
  198. ``--rerun-failed``
  199. Run only the tests that failed previously.
  200. This option tells CTest to perform only the tests that failed during
  201. its previous run. When this option is specified, CTest ignores all
  202. other options intended to modify the list of tests to run (``-L``, ``-R``,
  203. ``-E``, ``-LE``, ``-I``, etc). In the event that CTest runs and no tests
  204. fail, subsequent calls to CTest with the ``--rerun-failed`` option will run
  205. the set of tests that most recently failed (if any).
  206. ``--repeat <mode>:<n>``
  207. Run tests repeatedly based on the given ``<mode>`` up to ``<n>`` times.
  208. The modes are:
  209. ``until-fail``
  210. Require each test to run ``<n>`` times without failing in order to pass.
  211. This is useful in finding sporadic failures in test cases.
  212. ``until-pass``
  213. Allow each test to run up to ``<n>`` times in order to pass.
  214. Repeats tests if they fail for any reason.
  215. This is useful in tolerating sporadic failures in test cases.
  216. ``after-timeout``
  217. Allow each test to run up to ``<n>`` times in order to pass.
  218. Repeats tests only if they timeout.
  219. This is useful in tolerating sporadic timeouts in test cases
  220. on busy machines.
  221. ``--repeat-until-fail <n>``
  222. Equivalent to ``--repeat until-fail:<n>``.
  223. ``--max-width <width>``
  224. Set the max width for a test name to output.
  225. Set the maximum width for each test name to show in the output.
  226. This allows the user to widen the output to avoid clipping the test
  227. name which can be very annoying.
  228. ``--interactive-debug-mode [0|1]``
  229. Set the interactive mode to ``0`` or ``1``.
  230. This option causes CTest to run tests in either an interactive mode
  231. or a non-interactive mode. On Windows this means that in
  232. non-interactive mode, all system debug pop up windows are blocked.
  233. In dashboard mode (``Experimental``, ``Nightly``, ``Continuous``), the default
  234. is non-interactive. When just running tests not for a dashboard the
  235. default is to allow popups and interactive debugging.
  236. ``--no-label-summary``
  237. Disable timing summary information for labels.
  238. This option tells CTest not to print summary information for each
  239. label associated with the tests run. If there are no labels on the
  240. tests, nothing extra is printed.
  241. See `Label and Subproject Summary`_.
  242. ``--no-subproject-summary``
  243. Disable timing summary information for subprojects.
  244. This option tells CTest not to print summary information for each
  245. subproject associated with the tests run. If there are no subprojects on the
  246. tests, nothing extra is printed.
  247. See `Label and Subproject Summary`_.
  248. ``--build-and-test``
  249. See `Build and Test Mode`_.
  250. ``--test-dir <dir>``
  251. Specify the directory in which to look for tests.
  252. ``--test-output-size-passed <size>``
  253. Limit the output for passed tests to ``<size>`` bytes.
  254. ``--test-output-size-failed <size>``
  255. Limit the output for failed tests to ``<size>`` bytes.
  256. ``--overwrite``
  257. Overwrite CTest configuration option.
  258. By default CTest uses configuration options from configuration file.
  259. This option will overwrite the configuration option.
  260. ``--force-new-ctest-process``
  261. Run child CTest instances as new processes.
  262. By default CTest will run child CTest instances within the same
  263. process. If this behavior is not desired, this argument will
  264. enforce new processes for child CTest processes.
  265. ``--schedule-random``
  266. Use a random order for scheduling tests.
  267. This option will run the tests in a random order. It is commonly
  268. used to detect implicit dependencies in a test suite.
  269. ``--submit-index``
  270. Legacy option for old Dart2 dashboard server feature.
  271. Do not use.
  272. ``--timeout <seconds>``
  273. Set the default test timeout.
  274. This option effectively sets a timeout on all tests that do not
  275. already have a timeout set on them via the :prop_test:`TIMEOUT`
  276. property.
  277. ``--stop-time <time>``
  278. Set a time at which all tests should stop running.
  279. Set a real time of day at which all tests should timeout. Example:
  280. ``7:00:00 -0400``. Any time format understood by the curl date parser
  281. is accepted. Local time is assumed if no timezone is specified.
  282. ``--print-labels``
  283. Print all available test labels.
  284. This option will not run any tests, it will simply print the list of
  285. all labels associated with the test set.
  286. ``--no-tests=<[error|ignore]>``
  287. Regard no tests found either as error or ignore it.
  288. If no tests were found, the default behavior of CTest is to always log an
  289. error message but to return an error code in script mode only. This option
  290. unifies the behavior of CTest by either returning an error code if no tests
  291. were found or by ignoring it.
  292. .. include:: OPTIONS_HELP.txt
  293. .. _`Label Matching`:
  294. Label Matching
  295. ==============
  296. Tests may have labels attached to them. Tests may be included
  297. or excluded from a test run by filtering on the labels.
  298. Each individual filter is a regular expression applied to
  299. the labels attached to a test.
  300. When ``-L`` is used, in order for a test to be included in a
  301. test run, each regular expression must match at least one
  302. label. Using more than one ``-L`` option means "match **all**
  303. of these".
  304. The ``-LE`` option works just like ``-L``, but excludes tests
  305. rather than including them. A test is excluded if each regular
  306. expression matches at least one label.
  307. If a test has no labels attached to it, then ``-L`` will never
  308. include that test, and ``-LE`` will never exclude that test.
  309. As an example of tests with labels, consider five tests,
  310. with the following labels:
  311. * *test1* has labels *tuesday* and *production*
  312. * *test2* has labels *tuesday* and *test*
  313. * *test3* has labels *wednesday* and *production*
  314. * *test4* has label *wednesday*
  315. * *test5* has labels *friday* and *test*
  316. Running ``ctest`` with ``-L tuesday -L test`` will select *test2*, which has
  317. both labels. Running CTest with ``-L test`` will select *test2* and
  318. *test5*, because both of them have a label that matches that regular
  319. expression.
  320. Because the matching works with regular expressions, take note that
  321. running CTest with ``-L es`` will match all five tests.
  322. To select the *tuesday* and *wednesday* tests together, use a single
  323. regular expression that matches either of them, like ``-L "tue|wed"``.
  324. .. _`Label and Subproject Summary`:
  325. Label and Subproject Summary
  326. ============================
  327. CTest prints timing summary information for each ``LABEL`` and subproject
  328. associated with the tests run. The label time summary will not include labels
  329. that are mapped to subprojects.
  330. When the :prop_test:`PROCESSORS` test property is set, CTest will display a
  331. weighted test timing result in label and subproject summaries. The time is
  332. reported with `sec*proc` instead of just `sec`.
  333. The weighted time summary reported for each label or subproject ``j``
  334. is computed as::
  335. Weighted Time Summary for Label/Subproject j =
  336. sum(raw_test_time[j,i] * num_processors[j,i], i=1...num_tests[j])
  337. for labels/subprojects j=1...total
  338. where:
  339. * ``raw_test_time[j,i]``: Wall-clock time for the ``i`` test
  340. for the ``j`` label or subproject
  341. * ``num_processors[j,i]``: Value of the CTest :prop_test:`PROCESSORS` property
  342. for the ``i`` test for the ``j`` label or subproject
  343. * ``num_tests[j]``: Number of tests associated with the ``j`` label or subproject
  344. * ``total``: Total number of labels or subprojects that have at least one test run
  345. Therefore, the weighted time summary for each label or subproject represents
  346. the amount of time that CTest gave to run the tests for each label or
  347. subproject and gives a good representation of the total expense of the tests
  348. for each label or subproject when compared to other labels or subprojects.
  349. For example, if ``SubprojectA`` showed ``100 sec*proc`` and ``SubprojectB`` showed
  350. ``10 sec*proc``, then CTest allocated approximately 10 times the CPU/core time
  351. to run the tests for ``SubprojectA`` than for ``SubprojectB`` (e.g. so if effort
  352. is going to be expended to reduce the cost of the test suite for the whole
  353. project, then reducing the cost of the test suite for ``SubprojectA`` would
  354. likely have a larger impact than effort to reduce the cost of the test suite
  355. for ``SubprojectB``).
  356. .. _`Build and Test Mode`:
  357. Build and Test Mode
  358. ===================
  359. CTest provides a command-line signature to configure (i.e. run cmake on),
  360. build, and/or execute a test::
  361. ctest --build-and-test <path-to-source> <path-to-build>
  362. --build-generator <generator>
  363. [<options>...]
  364. [--build-options <opts>...]
  365. [--test-command <command> [<args>...]]
  366. The configure and test steps are optional. The arguments to this command line
  367. are the source and binary directories. The ``--build-generator`` option *must*
  368. be provided to use ``--build-and-test``. If ``--test-command`` is specified
  369. then that will be run after the build is complete. Other options that affect
  370. this mode include:
  371. ``--build-target``
  372. Specify a specific target to build.
  373. If left out the ``all`` target is built.
  374. ``--build-nocmake``
  375. Run the build without running cmake first.
  376. Skip the cmake step.
  377. ``--build-run-dir``
  378. Specify directory to run programs from.
  379. Directory where programs will be after it has been compiled.
  380. ``--build-two-config``
  381. Run CMake twice.
  382. ``--build-exe-dir``
  383. Specify the directory for the executable.
  384. ``--build-generator``
  385. Specify the generator to use. See the :manual:`cmake-generators(7)` manual.
  386. ``--build-generator-platform``
  387. Specify the generator-specific platform.
  388. ``--build-generator-toolset``
  389. Specify the generator-specific toolset.
  390. ``--build-project``
  391. Specify the name of the project to build.
  392. ``--build-makeprogram``
  393. Specify the explicit make program to be used by CMake when configuring and
  394. building the project. Only applicable for Make and Ninja based generators.
  395. ``--build-noclean``
  396. Skip the make clean step.
  397. ``--build-config-sample``
  398. A sample executable to use to determine the configuration that
  399. should be used. e.g. ``Debug``, ``Release`` etc.
  400. ``--build-options``
  401. Additional options for configuring the build (i.e. for CMake, not for
  402. the build tool). Note that if this is specified, the ``--build-options``
  403. keyword and its arguments must be the last option given on the command
  404. line, with the possible exception of ``--test-command``.
  405. ``--test-command``
  406. The command to run as the test step with the ``--build-and-test`` option.
  407. All arguments following this keyword will be assumed to be part of the
  408. test command line, so it must be the last option given.
  409. ``--test-timeout``
  410. The time limit in seconds
  411. .. _`Dashboard Client`:
  412. Dashboard Client
  413. ================
  414. CTest can operate as a client for the `CDash`_ software quality dashboard
  415. application. As a dashboard client, CTest performs a sequence of steps
  416. to configure, build, and test software, and then submits the results to
  417. a `CDash`_ server. The command-line signature used to submit to `CDash`_ is::
  418. ctest (-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>)
  419. [-- <dashboard-options>...]
  420. Options for Dashboard Client include:
  421. ``--group <group>``
  422. Specify what group you'd like to submit results to
  423. Submit dashboard to specified group instead of default one. By
  424. default, the dashboard is submitted to Nightly, Experimental, or
  425. Continuous group, but by specifying this option, the group can be
  426. arbitrary.
  427. This replaces the deprecated option ``--track``.
  428. Despite the name change its behavior is unchanged.
  429. ``-A <file>, --add-notes <file>``
  430. Add a notes file with submission.
  431. This option tells CTest to include a notes file when submitting
  432. dashboard.
  433. ``--tomorrow-tag``
  434. ``Nightly`` or ``Experimental`` starts with next day tag.
  435. This is useful if the build will not finish in one day.
  436. ``--extra-submit <file>[;<file>]``
  437. Submit extra files to the dashboard.
  438. This option will submit extra files to the dashboard.
  439. ``--http1.0``
  440. Submit using `HTTP 1.0`.
  441. This option will force CTest to use `HTTP 1.0` to submit files to the
  442. dashboard, instead of `HTTP 1.1`.
  443. ``--no-compress-output``
  444. Do not compress test output when submitting.
  445. This flag will turn off automatic compression of test output. Use
  446. this to maintain compatibility with an older version of CDash which
  447. doesn't support compressed test output.
  448. Dashboard Client Steps
  449. ----------------------
  450. CTest defines an ordered list of testing steps of which some or all may
  451. be run as a dashboard client:
  452. ``Start``
  453. Start a new dashboard submission to be composed of results recorded
  454. by the following steps.
  455. See the `CTest Start Step`_ section below.
  456. ``Update``
  457. Update the source tree from its version control repository.
  458. Record the old and new versions and the list of updated source files.
  459. See the `CTest Update Step`_ section below.
  460. ``Configure``
  461. Configure the software by running a command in the build tree.
  462. Record the configuration output log.
  463. See the `CTest Configure Step`_ section below.
  464. ``Build``
  465. Build the software by running a command in the build tree.
  466. Record the build output log and detect warnings and errors.
  467. See the `CTest Build Step`_ section below.
  468. ``Test``
  469. Test the software by loading a ``CTestTestfile.cmake``
  470. from the build tree and executing the defined tests.
  471. Record the output and result of each test.
  472. See the `CTest Test Step`_ section below.
  473. ``Coverage``
  474. Compute coverage of the source code by running a coverage
  475. analysis tool and recording its output.
  476. See the `CTest Coverage Step`_ section below.
  477. ``MemCheck``
  478. Run the software test suite through a memory check tool.
  479. Record the test output, results, and issues reported by the tool.
  480. See the `CTest MemCheck Step`_ section below.
  481. ``Submit``
  482. Submit results recorded from other testing steps to the
  483. software quality dashboard server.
  484. See the `CTest Submit Step`_ section below.
  485. Dashboard Client Modes
  486. ----------------------
  487. CTest defines three modes of operation as a dashboard client:
  488. ``Nightly``
  489. This mode is intended to be invoked once per day, typically at night.
  490. It enables the ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``,
  491. ``Coverage``, and ``Submit`` steps by default. Selected steps run even
  492. if the ``Update`` step reports no changes to the source tree.
  493. ``Continuous``
  494. This mode is intended to be invoked repeatedly throughout the day.
  495. It enables the ``Start``, ``Update``, ``Configure``, ``Build``, ``Test``,
  496. ``Coverage``, and ``Submit`` steps by default, but exits after the
  497. ``Update`` step if it reports no changes to the source tree.
  498. ``Experimental``
  499. This mode is intended to be invoked by a developer to test local changes.
  500. It enables the ``Start``, ``Configure``, ``Build``, ``Test``, ``Coverage``,
  501. and ``Submit`` steps by default.
  502. Dashboard Client via CTest Command-Line
  503. ---------------------------------------
  504. CTest can perform testing on an already-generated build tree.
  505. Run the ``ctest`` command with the current working directory set
  506. to the build tree and use one of these signatures::
  507. ctest -D <mode>[<step>]
  508. ctest -M <mode> [ -T <step> ]...
  509. The ``<mode>`` must be one of the above `Dashboard Client Modes`_,
  510. and each ``<step>`` must be one of the above `Dashboard Client Steps`_.
  511. CTest reads the `Dashboard Client Configuration`_ settings from
  512. a file in the build tree called either ``CTestConfiguration.ini``
  513. or ``DartConfiguration.tcl`` (the names are historical). The format
  514. of the file is::
  515. # Lines starting in '#' are comments.
  516. # Other non-blank lines are key-value pairs.
  517. <setting>: <value>
  518. where ``<setting>`` is the setting name and ``<value>`` is the
  519. setting value.
  520. In build trees generated by CMake, this configuration file is
  521. generated by the :module:`CTest` module if included by the project.
  522. The module uses variables to obtain a value for each setting
  523. as documented with the settings below.
  524. .. _`CTest Script`:
  525. Dashboard Client via CTest Script
  526. ---------------------------------
  527. CTest can perform testing driven by a :manual:`cmake-language(7)`
  528. script that creates and maintains the source and build tree as
  529. well as performing the testing steps. Run the ``ctest`` command
  530. with the current working directory set outside of any build tree
  531. and use one of these signatures::
  532. ctest -S <script>
  533. ctest -SP <script>
  534. The ``<script>`` file must call :ref:`CTest Commands` commands
  535. to run testing steps explicitly as documented below. The commands
  536. obtain `Dashboard Client Configuration`_ settings from their
  537. arguments or from variables set in the script.
  538. Dashboard Client Configuration
  539. ==============================
  540. The `Dashboard Client Steps`_ may be configured by named
  541. settings as documented in the following sections.
  542. .. _`CTest Start Step`:
  543. CTest Start Step
  544. ----------------
  545. Start a new dashboard submission to be composed of results recorded
  546. by the following steps.
  547. In a `CTest Script`_, the :command:`ctest_start` command runs this step.
  548. Arguments to the command may specify some of the step settings.
  549. The command first runs the command-line specified by the
  550. ``CTEST_CHECKOUT_COMMAND`` variable, if set, to initialize the source
  551. directory.
  552. Configuration settings include:
  553. ``BuildDirectory``
  554. The full path to the project build tree.
  555. * `CTest Script`_ variable: :variable:`CTEST_BINARY_DIRECTORY`
  556. * :module:`CTest` module variable: :variable:`PROJECT_BINARY_DIR`
  557. ``SourceDirectory``
  558. The full path to the project source tree.
  559. * `CTest Script`_ variable: :variable:`CTEST_SOURCE_DIRECTORY`
  560. * :module:`CTest` module variable: :variable:`PROJECT_SOURCE_DIR`
  561. .. _`CTest Update Step`:
  562. CTest Update Step
  563. -----------------
  564. In a `CTest Script`_, the :command:`ctest_update` command runs this step.
  565. Arguments to the command may specify some of the step settings.
  566. Configuration settings to specify the version control tool include:
  567. ``BZRCommand``
  568. ``bzr`` command-line tool to use if source tree is managed by Bazaar.
  569. * `CTest Script`_ variable: :variable:`CTEST_BZR_COMMAND`
  570. * :module:`CTest` module variable: none
  571. ``BZRUpdateOptions``
  572. Command-line options to the ``BZRCommand`` when updating the source.
  573. * `CTest Script`_ variable: :variable:`CTEST_BZR_UPDATE_OPTIONS`
  574. * :module:`CTest` module variable: none
  575. ``CVSCommand``
  576. ``cvs`` command-line tool to use if source tree is managed by CVS.
  577. * `CTest Script`_ variable: :variable:`CTEST_CVS_COMMAND`
  578. * :module:`CTest` module variable: ``CVSCOMMAND``
  579. ``CVSUpdateOptions``
  580. Command-line options to the ``CVSCommand`` when updating the source.
  581. * `CTest Script`_ variable: :variable:`CTEST_CVS_UPDATE_OPTIONS`
  582. * :module:`CTest` module variable: ``CVS_UPDATE_OPTIONS``
  583. ``GITCommand``
  584. ``git`` command-line tool to use if source tree is managed by Git.
  585. * `CTest Script`_ variable: :variable:`CTEST_GIT_COMMAND`
  586. * :module:`CTest` module variable: ``GITCOMMAND``
  587. The source tree is updated by ``git fetch`` followed by
  588. ``git reset --hard`` to the ``FETCH_HEAD``. The result is the same
  589. as ``git pull`` except that any local modifications are overwritten.
  590. Use ``GITUpdateCustom`` to specify a different approach.
  591. ``GITInitSubmodules``
  592. If set, CTest will update the repository's submodules before updating.
  593. * `CTest Script`_ variable: :variable:`CTEST_GIT_INIT_SUBMODULES`
  594. * :module:`CTest` module variable: ``CTEST_GIT_INIT_SUBMODULES``
  595. ``GITUpdateCustom``
  596. Specify a custom command line (as a semicolon-separated list) to run
  597. in the source tree (Git work tree) to update it instead of running
  598. the ``GITCommand``.
  599. * `CTest Script`_ variable: :variable:`CTEST_GIT_UPDATE_CUSTOM`
  600. * :module:`CTest` module variable: ``CTEST_GIT_UPDATE_CUSTOM``
  601. ``GITUpdateOptions``
  602. Command-line options to the ``GITCommand`` when updating the source.
  603. * `CTest Script`_ variable: :variable:`CTEST_GIT_UPDATE_OPTIONS`
  604. * :module:`CTest` module variable: ``GIT_UPDATE_OPTIONS``
  605. ``HGCommand``
  606. ``hg`` command-line tool to use if source tree is managed by Mercurial.
  607. * `CTest Script`_ variable: :variable:`CTEST_HG_COMMAND`
  608. * :module:`CTest` module variable: none
  609. ``HGUpdateOptions``
  610. Command-line options to the ``HGCommand`` when updating the source.
  611. * `CTest Script`_ variable: :variable:`CTEST_HG_UPDATE_OPTIONS`
  612. * :module:`CTest` module variable: none
  613. ``P4Client``
  614. Value of the ``-c`` option to the ``P4Command``.
  615. * `CTest Script`_ variable: :variable:`CTEST_P4_CLIENT`
  616. * :module:`CTest` module variable: ``CTEST_P4_CLIENT``
  617. ``P4Command``
  618. ``p4`` command-line tool to use if source tree is managed by Perforce.
  619. * `CTest Script`_ variable: :variable:`CTEST_P4_COMMAND`
  620. * :module:`CTest` module variable: ``P4COMMAND``
  621. ``P4Options``
  622. Command-line options to the ``P4Command`` for all invocations.
  623. * `CTest Script`_ variable: :variable:`CTEST_P4_OPTIONS`
  624. * :module:`CTest` module variable: ``CTEST_P4_OPTIONS``
  625. ``P4UpdateCustom``
  626. Specify a custom command line (as a semicolon-separated list) to run
  627. in the source tree (Perforce tree) to update it instead of running
  628. the ``P4Command``.
  629. * `CTest Script`_ variable: none
  630. * :module:`CTest` module variable: ``CTEST_P4_UPDATE_CUSTOM``
  631. ``P4UpdateOptions``
  632. Command-line options to the ``P4Command`` when updating the source.
  633. * `CTest Script`_ variable: :variable:`CTEST_P4_UPDATE_OPTIONS`
  634. * :module:`CTest` module variable: ``CTEST_P4_UPDATE_OPTIONS``
  635. ``SVNCommand``
  636. ``svn`` command-line tool to use if source tree is managed by Subversion.
  637. * `CTest Script`_ variable: :variable:`CTEST_SVN_COMMAND`
  638. * :module:`CTest` module variable: ``SVNCOMMAND``
  639. ``SVNOptions``
  640. Command-line options to the ``SVNCommand`` for all invocations.
  641. * `CTest Script`_ variable: :variable:`CTEST_SVN_OPTIONS`
  642. * :module:`CTest` module variable: ``CTEST_SVN_OPTIONS``
  643. ``SVNUpdateOptions``
  644. Command-line options to the ``SVNCommand`` when updating the source.
  645. * `CTest Script`_ variable: :variable:`CTEST_SVN_UPDATE_OPTIONS`
  646. * :module:`CTest` module variable: ``SVN_UPDATE_OPTIONS``
  647. ``UpdateCommand``
  648. Specify the version-control command-line tool to use without
  649. detecting the VCS that manages the source tree.
  650. * `CTest Script`_ variable: :variable:`CTEST_UPDATE_COMMAND`
  651. * :module:`CTest` module variable: ``<VCS>COMMAND``
  652. when ``UPDATE_TYPE`` is ``<vcs>``, else ``UPDATE_COMMAND``
  653. ``UpdateOptions``
  654. Command-line options to the ``UpdateCommand``.
  655. * `CTest Script`_ variable: :variable:`CTEST_UPDATE_OPTIONS`
  656. * :module:`CTest` module variable: ``<VCS>_UPDATE_OPTIONS``
  657. when ``UPDATE_TYPE`` is ``<vcs>``, else ``UPDATE_OPTIONS``
  658. ``UpdateType``
  659. Specify the version-control system that manages the source
  660. tree if it cannot be detected automatically.
  661. The value may be ``bzr``, ``cvs``, ``git``, ``hg``,
  662. ``p4``, or ``svn``.
  663. * `CTest Script`_ variable: none, detected from source tree
  664. * :module:`CTest` module variable: ``UPDATE_TYPE`` if set,
  665. else ``CTEST_UPDATE_TYPE``
  666. .. _`UpdateVersionOnly`:
  667. ``UpdateVersionOnly``
  668. Specify that you want the version control update command to only
  669. discover the current version that is checked out, and not to update
  670. to a different version.
  671. * `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_ONLY`
  672. .. _`UpdateVersionOverride`:
  673. ``UpdateVersionOverride``
  674. Specify the current version of your source tree.
  675. When this variable is set to a non-empty string, CTest will report the value
  676. you specified rather than using the update command to discover the current
  677. version that is checked out. Use of this variable supersedes
  678. ``UpdateVersionOnly``. Like ``UpdateVersionOnly``, using this variable tells
  679. CTest not to update the source tree to a different version.
  680. * `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_OVERRIDE`
  681. Additional configuration settings include:
  682. ``NightlyStartTime``
  683. In the ``Nightly`` dashboard mode, specify the "nightly start time".
  684. With centralized version control systems (``cvs`` and ``svn``),
  685. the ``Update`` step checks out the version of the software as of
  686. this time so that multiple clients choose a common version to test.
  687. This is not well-defined in distributed version-control systems so
  688. the setting is ignored.
  689. * `CTest Script`_ variable: :variable:`CTEST_NIGHTLY_START_TIME`
  690. * :module:`CTest` module variable: ``NIGHTLY_START_TIME`` if set,
  691. else ``CTEST_NIGHTLY_START_TIME``
  692. .. _`CTest Configure Step`:
  693. CTest Configure Step
  694. --------------------
  695. In a `CTest Script`_, the :command:`ctest_configure` command runs this step.
  696. Arguments to the command may specify some of the step settings.
  697. Configuration settings include:
  698. ``ConfigureCommand``
  699. Command-line to launch the software configuration process.
  700. It will be executed in the location specified by the
  701. ``BuildDirectory`` setting.
  702. * `CTest Script`_ variable: :variable:`CTEST_CONFIGURE_COMMAND`
  703. * :module:`CTest` module variable: :variable:`CMAKE_COMMAND`
  704. followed by :variable:`PROJECT_SOURCE_DIR`
  705. ``LabelsForSubprojects``
  706. Specify a semicolon-separated list of labels that will be treated as
  707. subprojects. This mapping will be passed on to CDash when configure, test or
  708. build results are submitted.
  709. * `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
  710. * :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
  711. See `Label and Subproject Summary`_.
  712. .. _`CTest Build Step`:
  713. CTest Build Step
  714. ----------------
  715. In a `CTest Script`_, the :command:`ctest_build` command runs this step.
  716. Arguments to the command may specify some of the step settings.
  717. Configuration settings include:
  718. ``DefaultCTestConfigurationType``
  719. When the build system to be launched allows build-time selection
  720. of the configuration (e.g. ``Debug``, ``Release``), this specifies
  721. the default configuration to be built when no ``-C`` option is
  722. given to the ``ctest`` command. The value will be substituted into
  723. the value of ``MakeCommand`` to replace the literal string
  724. ``${CTEST_CONFIGURATION_TYPE}`` if it appears.
  725. * `CTest Script`_ variable: :variable:`CTEST_CONFIGURATION_TYPE`
  726. * :module:`CTest` module variable: ``DEFAULT_CTEST_CONFIGURATION_TYPE``,
  727. initialized by the :envvar:`CMAKE_CONFIG_TYPE` environment variable
  728. ``LabelsForSubprojects``
  729. Specify a semicolon-separated list of labels that will be treated as
  730. subprojects. This mapping will be passed on to CDash when configure, test or
  731. build results are submitted.
  732. * `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
  733. * :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
  734. See `Label and Subproject Summary`_.
  735. ``MakeCommand``
  736. Command-line to launch the software build process.
  737. It will be executed in the location specified by the
  738. ``BuildDirectory`` setting.
  739. * `CTest Script`_ variable: :variable:`CTEST_BUILD_COMMAND`
  740. * :module:`CTest` module variable: ``MAKECOMMAND``,
  741. initialized by the :command:`build_command` command
  742. ``UseLaunchers``
  743. For build trees generated by CMake using one of the
  744. :ref:`Makefile Generators` or the :generator:`Ninja`
  745. generator, specify whether the
  746. ``CTEST_USE_LAUNCHERS`` feature is enabled by the
  747. :module:`CTestUseLaunchers` module (also included by the
  748. :module:`CTest` module). When enabled, the generated build
  749. system wraps each invocation of the compiler, linker, or
  750. custom command line with a "launcher" that communicates
  751. with CTest via environment variables and files to report
  752. granular build warning and error information. Otherwise,
  753. CTest must "scrape" the build output log for diagnostics.
  754. * `CTest Script`_ variable: :variable:`CTEST_USE_LAUNCHERS`
  755. * :module:`CTest` module variable: ``CTEST_USE_LAUNCHERS``
  756. .. _`CTest Test Step`:
  757. CTest Test Step
  758. ---------------
  759. In a `CTest Script`_, the :command:`ctest_test` command runs this step.
  760. Arguments to the command may specify some of the step settings.
  761. Configuration settings include:
  762. ``ResourceSpecFile``
  763. Specify a
  764. :ref:`resource specification file <ctest-resource-specification-file>`.
  765. * `CTest Script`_ variable: :variable:`CTEST_RESOURCE_SPEC_FILE`
  766. * :module:`CTest` module variable: ``CTEST_RESOURCE_SPEC_FILE``
  767. See :ref:`ctest-resource-allocation` for more information.
  768. ``LabelsForSubprojects``
  769. Specify a semicolon-separated list of labels that will be treated as
  770. subprojects. This mapping will be passed on to CDash when configure, test or
  771. build results are submitted.
  772. * `CTest Script`_ variable: :variable:`CTEST_LABELS_FOR_SUBPROJECTS`
  773. * :module:`CTest` module variable: ``CTEST_LABELS_FOR_SUBPROJECTS``
  774. See `Label and Subproject Summary`_.
  775. ``TestLoad``
  776. While running tests in parallel (e.g. with ``-j``), try not to start
  777. tests when they may cause the CPU load to pass above a given threshold.
  778. * `CTest Script`_ variable: :variable:`CTEST_TEST_LOAD`
  779. * :module:`CTest` module variable: ``CTEST_TEST_LOAD``
  780. ``TimeOut``
  781. The default timeout for each test if not specified by the
  782. :prop_test:`TIMEOUT` test property.
  783. * `CTest Script`_ variable: :variable:`CTEST_TEST_TIMEOUT`
  784. * :module:`CTest` module variable: ``DART_TESTING_TIMEOUT``
  785. .. _`CTest Coverage Step`:
  786. CTest Coverage Step
  787. -------------------
  788. In a `CTest Script`_, the :command:`ctest_coverage` command runs this step.
  789. Arguments to the command may specify some of the step settings.
  790. Configuration settings include:
  791. ``CoverageCommand``
  792. Command-line tool to perform software coverage analysis.
  793. It will be executed in the location specified by the
  794. ``BuildDirectory`` setting.
  795. * `CTest Script`_ variable: :variable:`CTEST_COVERAGE_COMMAND`
  796. * :module:`CTest` module variable: ``COVERAGE_COMMAND``
  797. ``CoverageExtraFlags``
  798. Specify command-line options to the ``CoverageCommand`` tool.
  799. * `CTest Script`_ variable: :variable:`CTEST_COVERAGE_EXTRA_FLAGS`
  800. * :module:`CTest` module variable: ``COVERAGE_EXTRA_FLAGS``
  801. These options are the first arguments passed to ``CoverageCommand``.
  802. .. _`CTest MemCheck Step`:
  803. CTest MemCheck Step
  804. -------------------
  805. In a `CTest Script`_, the :command:`ctest_memcheck` command runs this step.
  806. Arguments to the command may specify some of the step settings.
  807. Configuration settings include:
  808. ``MemoryCheckCommand``
  809. Command-line tool to perform dynamic analysis. Test command lines
  810. will be launched through this tool.
  811. * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND`
  812. * :module:`CTest` module variable: ``MEMORYCHECK_COMMAND``
  813. ``MemoryCheckCommandOptions``
  814. Specify command-line options to the ``MemoryCheckCommand`` tool.
  815. They will be placed prior to the test command line.
  816. * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND_OPTIONS`
  817. * :module:`CTest` module variable: ``MEMORYCHECK_COMMAND_OPTIONS``
  818. ``MemoryCheckType``
  819. Specify the type of memory checking to perform.
  820. * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_TYPE`
  821. * :module:`CTest` module variable: ``MEMORYCHECK_TYPE``
  822. ``MemoryCheckSanitizerOptions``
  823. Specify options to sanitizers when running with a sanitize-enabled build.
  824. * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS`
  825. * :module:`CTest` module variable: ``MEMORYCHECK_SANITIZER_OPTIONS``
  826. ``MemoryCheckSuppressionFile``
  827. Specify a file containing suppression rules for the
  828. ``MemoryCheckCommand`` tool. It will be passed with options
  829. appropriate to the tool.
  830. * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SUPPRESSIONS_FILE`
  831. * :module:`CTest` module variable: ``MEMORYCHECK_SUPPRESSIONS_FILE``
  832. Additional configuration settings include:
  833. ``BoundsCheckerCommand``
  834. Specify a ``MemoryCheckCommand`` that is known to be command-line
  835. compatible with Bounds Checker.
  836. * `CTest Script`_ variable: none
  837. * :module:`CTest` module variable: none
  838. ``PurifyCommand``
  839. Specify a ``MemoryCheckCommand`` that is known to be command-line
  840. compatible with Purify.
  841. * `CTest Script`_ variable: none
  842. * :module:`CTest` module variable: ``PURIFYCOMMAND``
  843. ``ValgrindCommand``
  844. Specify a ``MemoryCheckCommand`` that is known to be command-line
  845. compatible with Valgrind.
  846. * `CTest Script`_ variable: none
  847. * :module:`CTest` module variable: ``VALGRIND_COMMAND``
  848. ``ValgrindCommandOptions``
  849. Specify command-line options to the ``ValgrindCommand`` tool.
  850. They will be placed prior to the test command line.
  851. * `CTest Script`_ variable: none
  852. * :module:`CTest` module variable: ``VALGRIND_COMMAND_OPTIONS``
  853. ``DrMemoryCommand``
  854. Specify a ``MemoryCheckCommand`` that is known to be a command-line
  855. compatible with DrMemory.
  856. * `CTest Script`_ variable: none
  857. * :module:`CTest` module variable: ``DRMEMORY_COMMAND``
  858. ``DrMemoryCommandOptions``
  859. Specify command-line options to the ``DrMemoryCommand`` tool.
  860. They will be placed prior to the test command line.
  861. * `CTest Script`_ variable: none
  862. * :module:`CTest` module variable: ``DRMEMORY_COMMAND_OPTIONS``
  863. ``CudaSanitizerCommand``
  864. Specify a ``MemoryCheckCommand`` that is known to be a command-line
  865. compatible with cuda-memcheck or compute-sanitizer.
  866. * `CTest Script`_ variable: none
  867. * :module:`CTest` module variable: ``CUDA_SANITIZER_COMMAND``
  868. ``CudaSanitizerCommandOptions``
  869. Specify command-line options to the ``CudaSanitizerCommand`` tool.
  870. They will be placed prior to the test command line.
  871. * `CTest Script`_ variable: none
  872. * :module:`CTest` module variable: ``CUDA_SANITIZER_COMMAND_OPTIONS``
  873. .. _`CTest Submit Step`:
  874. CTest Submit Step
  875. -----------------
  876. In a `CTest Script`_, the :command:`ctest_submit` command runs this step.
  877. Arguments to the command may specify some of the step settings.
  878. Configuration settings include:
  879. ``BuildName``
  880. Describe the dashboard client platform with a short string.
  881. (Operating system, compiler, etc.)
  882. * `CTest Script`_ variable: :variable:`CTEST_BUILD_NAME`
  883. * :module:`CTest` module variable: ``BUILDNAME``
  884. ``CDashVersion``
  885. Legacy option. Not used.
  886. * `CTest Script`_ variable: none, detected from server
  887. * :module:`CTest` module variable: ``CTEST_CDASH_VERSION``
  888. ``CTestSubmitRetryCount``
  889. Specify a number of attempts to retry submission on network failure.
  890. * `CTest Script`_ variable: none,
  891. use the :command:`ctest_submit` ``RETRY_COUNT`` option.
  892. * :module:`CTest` module variable: ``CTEST_SUBMIT_RETRY_COUNT``
  893. ``CTestSubmitRetryDelay``
  894. Specify a delay before retrying submission on network failure.
  895. * `CTest Script`_ variable: none,
  896. use the :command:`ctest_submit` ``RETRY_DELAY`` option.
  897. * :module:`CTest` module variable: ``CTEST_SUBMIT_RETRY_DELAY``
  898. ``CurlOptions``
  899. Specify a semicolon-separated list of options to control the
  900. Curl library that CTest uses internally to connect to the
  901. server. Possible options are ``CURLOPT_SSL_VERIFYPEER_OFF``
  902. and ``CURLOPT_SSL_VERIFYHOST_OFF``.
  903. * `CTest Script`_ variable: :variable:`CTEST_CURL_OPTIONS`
  904. * :module:`CTest` module variable: ``CTEST_CURL_OPTIONS``
  905. ``DropLocation``
  906. Legacy option. When ``SubmitURL`` is not set, it is constructed from
  907. ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
  908. ``DropLocation``.
  909. * `CTest Script`_ variable: :variable:`CTEST_DROP_LOCATION`
  910. * :module:`CTest` module variable: ``DROP_LOCATION`` if set,
  911. else ``CTEST_DROP_LOCATION``
  912. ``DropMethod``
  913. Legacy option. When ``SubmitURL`` is not set, it is constructed from
  914. ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
  915. ``DropLocation``.
  916. * `CTest Script`_ variable: :variable:`CTEST_DROP_METHOD`
  917. * :module:`CTest` module variable: ``DROP_METHOD`` if set,
  918. else ``CTEST_DROP_METHOD``
  919. ``DropSite``
  920. Legacy option. When ``SubmitURL`` is not set, it is constructed from
  921. ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
  922. ``DropLocation``.
  923. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE`
  924. * :module:`CTest` module variable: ``DROP_SITE`` if set,
  925. else ``CTEST_DROP_SITE``
  926. ``DropSitePassword``
  927. Legacy option. When ``SubmitURL`` is not set, it is constructed from
  928. ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
  929. ``DropLocation``.
  930. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_PASSWORD`
  931. * :module:`CTest` module variable: ``DROP_SITE_PASSWORD`` if set,
  932. else ``CTEST_DROP_SITE_PASWORD``
  933. ``DropSiteUser``
  934. Legacy option. When ``SubmitURL`` is not set, it is constructed from
  935. ``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
  936. ``DropLocation``.
  937. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_USER`
  938. * :module:`CTest` module variable: ``DROP_SITE_USER`` if set,
  939. else ``CTEST_DROP_SITE_USER``
  940. ``IsCDash``
  941. Legacy option. Not used.
  942. * `CTest Script`_ variable: :variable:`CTEST_DROP_SITE_CDASH`
  943. * :module:`CTest` module variable: ``CTEST_DROP_SITE_CDASH``
  944. ``ScpCommand``
  945. Legacy option. Not used.
  946. * `CTest Script`_ variable: :variable:`CTEST_SCP_COMMAND`
  947. * :module:`CTest` module variable: ``SCPCOMMAND``
  948. ``Site``
  949. Describe the dashboard client host site with a short string.
  950. (Hostname, domain, etc.)
  951. * `CTest Script`_ variable: :variable:`CTEST_SITE`
  952. * :module:`CTest` module variable: ``SITE``,
  953. initialized by the :command:`site_name` command
  954. ``SubmitURL``
  955. The ``http`` or ``https`` URL of the dashboard server to send the submission
  956. to.
  957. * `CTest Script`_ variable: :variable:`CTEST_SUBMIT_URL`
  958. * :module:`CTest` module variable: ``SUBMIT_URL`` if set,
  959. else ``CTEST_SUBMIT_URL``
  960. ``TriggerSite``
  961. Legacy option. Not used.
  962. * `CTest Script`_ variable: :variable:`CTEST_TRIGGER_SITE`
  963. * :module:`CTest` module variable: ``TRIGGER_SITE`` if set,
  964. else ``CTEST_TRIGGER_SITE``
  965. .. _`Show as JSON Object Model`:
  966. Show as JSON Object Model
  967. =========================
  968. When the ``--show-only=json-v1`` command line option is given, the test
  969. information is output in JSON format. Version 1.0 of the JSON object
  970. model is defined as follows:
  971. ``kind``
  972. The string "ctestInfo".
  973. ``version``
  974. A JSON object specifying the version components. Its members are
  975. ``major``
  976. A non-negative integer specifying the major version component.
  977. ``minor``
  978. A non-negative integer specifying the minor version component.
  979. ``backtraceGraph``
  980. JSON object representing backtrace information with the
  981. following members:
  982. ``commands``
  983. List of command names.
  984. ``files``
  985. List of file names.
  986. ``nodes``
  987. List of node JSON objects with members:
  988. ``command``
  989. Index into the ``commands`` member of the ``backtraceGraph``.
  990. ``file``
  991. Index into the ``files`` member of the ``backtraceGraph``.
  992. ``line``
  993. Line number in the file where the backtrace was added.
  994. ``parent``
  995. Index into the ``nodes`` member of the ``backtraceGraph``
  996. representing the parent in the graph.
  997. ``tests``
  998. A JSON array listing information about each test. Each entry
  999. is a JSON object with members:
  1000. ``name``
  1001. Test name.
  1002. ``config``
  1003. Configuration that the test can run on.
  1004. Empty string means any config.
  1005. ``command``
  1006. List where the first element is the test command and the
  1007. remaining elements are the command arguments.
  1008. ``backtrace``
  1009. Index into the ``nodes`` member of the ``backtraceGraph``.
  1010. ``properties``
  1011. Test properties.
  1012. Can contain keys for each of the supported test properties.
  1013. .. _`ctest-resource-allocation`:
  1014. Resource Allocation
  1015. ===================
  1016. CTest provides a mechanism for tests to specify the resources that they need
  1017. in a fine-grained way, and for users to specify the resources available on
  1018. the running machine. This allows CTest to internally keep track of which
  1019. resources are in use and which are free, scheduling tests in a way that
  1020. prevents them from trying to claim resources that are not available.
  1021. When the resource allocation feature is used, CTest will not oversubscribe
  1022. resources. For example, if a resource has 8 slots, CTest will not run tests
  1023. that collectively use more than 8 slots at a time. This has the effect of
  1024. limiting how many tests can run at any given time, even if a high ``-j``
  1025. argument is used, if those tests all use some slots from the same resource.
  1026. In addition, it means that a single test that uses more of a resource than is
  1027. available on a machine will not run at all (and will be reported as
  1028. ``Not Run``).
  1029. A common use case for this feature is for tests that require the use of a GPU.
  1030. Multiple tests can simultaneously allocate memory from a GPU, but if too many
  1031. tests try to do this at once, some of them will fail to allocate, resulting in
  1032. a failed test, even though the test would have succeeded if it had the memory
  1033. it needed. By using the resource allocation feature, each test can specify how
  1034. much memory it requires from a GPU, allowing CTest to schedule tests in a way
  1035. that running several of these tests at once does not exhaust the GPU's memory
  1036. pool.
  1037. Please note that CTest has no concept of what a GPU is or how much memory it
  1038. has, nor does it have any way of communicating with a GPU to retrieve this
  1039. information or perform any memory management. CTest simply keeps track of a
  1040. list of abstract resource types, each of which has a certain number of slots
  1041. available for tests to use. Each test specifies the number of slots that it
  1042. requires from a certain resource, and CTest then schedules them in a way that
  1043. prevents the total number of slots in use from exceeding the listed capacity.
  1044. When a test is executed, and slots from a resource are allocated to that test,
  1045. tests may assume that they have exclusive use of those slots for the duration
  1046. of the test's process.
  1047. The CTest resource allocation feature consists of two inputs:
  1048. * The :ref:`resource specification file <ctest-resource-specification-file>`,
  1049. described below, which describes the resources available on the system.
  1050. * The :prop_test:`RESOURCE_GROUPS` property of tests, which describes the
  1051. resources required by the test.
  1052. When CTest runs a test, the resources allocated to that test are passed in the
  1053. form of a set of
  1054. :ref:`environment variables <ctest-resource-environment-variables>` as
  1055. described below. Using this information to decide which resource to connect to
  1056. is left to the test writer.
  1057. The ``RESOURCE_GROUPS`` property tells CTest what resources a test expects
  1058. to use grouped in a way meaningful to the test. The test itself must read
  1059. the :ref:`environment variables <ctest-resource-environment-variables>` to
  1060. determine which resources have been allocated to each group. For example,
  1061. each group may correspond to a process the test will spawn when executed.
  1062. Note that even if a test specifies a ``RESOURCE_GROUPS`` property, it is still
  1063. possible for that to test to run without any resource allocation (and without
  1064. the corresponding
  1065. :ref:`environment variables <ctest-resource-environment-variables>`)
  1066. if the user does not pass a resource specification file. Passing this file,
  1067. either through the ``--resource-spec-file`` command-line argument or the
  1068. ``RESOURCE_SPEC_FILE`` argument to :command:`ctest_test`, is what activates the
  1069. resource allocation feature. Tests should check the
  1070. ``CTEST_RESOURCE_GROUP_COUNT`` environment variable to find out whether or not
  1071. resource allocation is activated. This variable will always (and only) be
  1072. defined if resource allocation is activated. If resource allocation is not
  1073. activated, then the ``CTEST_RESOURCE_GROUP_COUNT`` variable will not exist,
  1074. even if it exists for the parent ``ctest`` process. If a test absolutely must
  1075. have resource allocation, then it can return a failing exit code or use the
  1076. :prop_test:`SKIP_RETURN_CODE` or :prop_test:`SKIP_REGULAR_EXPRESSION`
  1077. properties to indicate a skipped test.
  1078. .. _`ctest-resource-specification-file`:
  1079. Resource Specification File
  1080. ---------------------------
  1081. The resource specification file is a JSON file which is passed to CTest, either
  1082. on the :manual:`ctest(1)` command line as ``--resource-spec-file``, or as the
  1083. ``RESOURCE_SPEC_FILE`` argument of :command:`ctest_test`. If a dashboard script
  1084. is used and ``RESOURCE_SPEC_FILE`` is not specified, the value of
  1085. :variable:`CTEST_RESOURCE_SPEC_FILE` in the dashboard script is used instead.
  1086. If ``--resource-spec-file``, ``RESOURCE_SPEC_FILE``, and
  1087. :variable:`CTEST_RESOURCE_SPEC_FILE` in the dashboard script are not specified,
  1088. the value of :variable:`CTEST_RESOURCE_SPEC_FILE` in the CMake build is used
  1089. instead. If none of these are specified, no resource spec file is used.
  1090. The resource specification file must be a JSON object. All examples in this
  1091. document assume the following resource specification file:
  1092. .. code-block:: json
  1093. {
  1094. "version": {
  1095. "major": 1,
  1096. "minor": 0
  1097. },
  1098. "local": [
  1099. {
  1100. "gpus": [
  1101. {
  1102. "id": "0",
  1103. "slots": 2
  1104. },
  1105. {
  1106. "id": "1",
  1107. "slots": 4
  1108. },
  1109. {
  1110. "id": "2",
  1111. "slots": 2
  1112. },
  1113. {
  1114. "id": "3"
  1115. }
  1116. ],
  1117. "crypto_chips": [
  1118. {
  1119. "id": "card0",
  1120. "slots": 4
  1121. }
  1122. ]
  1123. }
  1124. ]
  1125. }
  1126. The members are:
  1127. ``version``
  1128. An object containing a ``major`` integer field and a ``minor`` integer field.
  1129. Currently, the only supported version is major ``1``, minor ``0``. Any other
  1130. value is an error.
  1131. ``local``
  1132. A JSON array of resource sets present on the system. Currently, this array
  1133. is restricted to being of size 1.
  1134. Each array element is a JSON object with members whose names are equal to the
  1135. desired resource types, such as ``gpus``. These names must start with a
  1136. lowercase letter or an underscore, and subsequent characters can be a
  1137. lowercase letter, a digit, or an underscore. Uppercase letters are not
  1138. allowed, because certain platforms have case-insensitive environment
  1139. variables. See the `Environment Variables`_ section below for
  1140. more information. It is recommended that the resource type name be the plural
  1141. of a noun, such as ``gpus`` or ``crypto_chips`` (and not ``gpu`` or
  1142. ``crypto_chip``.)
  1143. Please note that the names ``gpus`` and ``crypto_chips`` are just examples,
  1144. and CTest does not interpret them in any way. You are free to make up any
  1145. resource type you want to meet your own requirements.
  1146. The value for each resource type is a JSON array consisting of JSON objects,
  1147. each of which describe a specific instance of the specified resource. These
  1148. objects have the following members:
  1149. ``id``
  1150. A string consisting of an identifier for the resource. Each character in
  1151. the identifier can be a lowercase letter, a digit, or an underscore.
  1152. Uppercase letters are not allowed.
  1153. Identifiers must be unique within a resource type. However, they do not
  1154. have to be unique across resource types. For example, it is valid to have a
  1155. ``gpus`` resource named ``0`` and a ``crypto_chips`` resource named ``0``,
  1156. but not two ``gpus`` resources both named ``0``.
  1157. Please note that the IDs ``0``, ``1``, ``2``, ``3``, and ``card0`` are just
  1158. examples, and CTest does not interpret them in any way. You are free to
  1159. make up any IDs you want to meet your own requirements.
  1160. ``slots``
  1161. An optional unsigned number specifying the number of slots available on the
  1162. resource. For example, this could be megabytes of RAM on a GPU, or
  1163. cryptography units available on a cryptography chip. If ``slots`` is not
  1164. specified, a default value of ``1`` is assumed.
  1165. In the example file above, there are four GPUs with ID's 0 through 3. GPU 0 has
  1166. 2 slots, GPU 1 has 4, GPU 2 has 2, and GPU 3 has a default of 1 slot. There is
  1167. also one cryptography chip with 4 slots.
  1168. ``RESOURCE_GROUPS`` Property
  1169. ----------------------------
  1170. See :prop_test:`RESOURCE_GROUPS` for a description of this property.
  1171. .. _`ctest-resource-environment-variables`:
  1172. Environment Variables
  1173. ---------------------
  1174. Once CTest has decided which resources to allocate to a test, it passes this
  1175. information to the test executable as a series of environment variables. For
  1176. each example below, we will assume that the test in question has a
  1177. :prop_test:`RESOURCE_GROUPS` property of
  1178. ``2,gpus:2;gpus:4,gpus:1,crypto_chips:2``.
  1179. The following variables are passed to the test process:
  1180. .. envvar:: CTEST_RESOURCE_GROUP_COUNT
  1181. The total number of groups specified by the :prop_test:`RESOURCE_GROUPS`
  1182. property. For example:
  1183. * ``CTEST_RESOURCE_GROUP_COUNT=3``
  1184. This variable will only be defined if :manual:`ctest(1)` has been given a
  1185. ``--resource-spec-file``, or if :command:`ctest_test` has been given a
  1186. ``RESOURCE_SPEC_FILE``. If no resource specification file has been given,
  1187. this variable will not be defined.
  1188. .. envvar:: CTEST_RESOURCE_GROUP_<num>
  1189. The list of resource types allocated to each group, with each item
  1190. separated by a comma. ``<num>`` is a number from zero to
  1191. ``CTEST_RESOURCE_GROUP_COUNT`` minus one. ``CTEST_RESOURCE_GROUP_<num>``
  1192. is defined for each ``<num>`` in this range. For example:
  1193. * ``CTEST_RESOURCE_GROUP_0=gpus``
  1194. * ``CTEST_RESOURCE_GROUP_1=gpus``
  1195. * ``CTEST_RESOURCE_GROUP_2=crypto_chips,gpus``
  1196. .. envvar:: CTEST_RESOURCE_GROUP_<num>_<resource-type>
  1197. The list of resource IDs and number of slots from each ID allocated to each
  1198. group for a given resource type. This variable consists of a series of
  1199. pairs, each pair separated by a semicolon, and with the two items in the pair
  1200. separated by a comma. The first item in each pair is ``id:`` followed by the
  1201. ID of a resource of type ``<resource-type>``, and the second item is
  1202. ``slots:`` followed by the number of slots from that resource allocated to
  1203. the given group. For example:
  1204. * ``CTEST_RESOURCE_GROUP_0_GPUS=id:0,slots:2``
  1205. * ``CTEST_RESOURCE_GROUP_1_GPUS=id:2,slots:2``
  1206. * ``CTEST_RESOURCE_GROUP_2_GPUS=id:1,slots:4;id:3,slots:1``
  1207. * ``CTEST_RESOURCE_GROUP_2_CRYPTO_CHIPS=id:card0,slots:2``
  1208. In this example, group 0 gets 2 slots from GPU ``0``, group 1 gets 2 slots
  1209. from GPU ``2``, and group 2 gets 4 slots from GPU ``1``, 1 slot from GPU
  1210. ``3``, and 2 slots from cryptography chip ``card0``.
  1211. ``<num>`` is a number from zero to ``CTEST_RESOURCE_GROUP_COUNT`` minus one.
  1212. ``<resource-type>`` is the name of a resource type, converted to uppercase.
  1213. ``CTEST_RESOURCE_GROUP_<num>_<resource-type>`` is defined for the product
  1214. of each ``<num>`` in the range listed above and each resource type listed in
  1215. ``CTEST_RESOURCE_GROUP_<num>``.
  1216. Because some platforms have case-insensitive names for environment variables,
  1217. the names of resource types may not clash in a case-insensitive environment.
  1218. Because of this, for the sake of simplicity, all resource types must be
  1219. listed in all lowercase in the
  1220. :ref:`resource specification file <ctest-resource-specification-file>` and
  1221. in the :prop_test:`RESOURCE_GROUPS` property, and they are converted to all
  1222. uppercase in the ``CTEST_RESOURCE_GROUP_<num>_<resource-type>`` environment
  1223. variable.
  1224. See Also
  1225. ========
  1226. .. include:: LINKS.txt
  1227. .. _`CDash`: http://cdash.org/