ctest.1.rst 57 KB

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