ctest.1.rst 52 KB

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