ctest.1.rst 56 KB

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