ctest.1.rst 56 KB

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