1CTEST(1) CMake CTEST(1)
2
3
4
6 ctest - CTest Command-Line Reference
7
8 Contents
9 · ctest(1)
10
11 · Synopsis
12
13 · Description
14
15 · Options
16
17 · Label and Subproject Summary
18
19 · Build and Test Mode
20
21 · Dashboard Client
22
23 · Dashboard Client Steps
24
25 · Dashboard Client Modes
26
27 · Dashboard Client via CTest Command-Line
28
29 · Dashboard Client via CTest Script
30
31 · Dashboard Client Configuration
32
33 · CTest Start Step
34
35 · CTest Update Step
36
37 · CTest Configure Step
38
39 · CTest Build Step
40
41 · CTest Test Step
42
43 · CTest Coverage Step
44
45 · CTest MemCheck Step
46
47 · CTest Submit Step
48
49 · Show as JSON Object Model
50
51 · Resource Allocation
52
53 · Resource Specification File
54
55 · RESOURCE_GROUPS Property
56
57 · Environment Variables
58
59 · See Also
60
62 ctest [<options>]
63 ctest --build-and-test <path-to-source> <path-to-build>
64 --build-generator <generator> [<options>...]
65 [--build-options <opts>...] [--test-command <command> [<args>...]]
66 ctest {-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>}
67 [-- <dashboard-options>...]
68
70 The ctest executable is the CMake test driver program. CMake-generated
71 build trees created for projects that use the enable_testing() and
72 add_test() commands have testing support. This program will run the
73 tests and report results.
74
76 -C <cfg>, --build-config <cfg>
77 Choose configuration to test.
78
79 Some CMake-generated build trees can have multiple build config‐
80 urations in the same tree. This option can be used to specify
81 which one should be tested. Example configurations are Debug
82 and Release.
83
84 --progress
85 Enable short progress output from tests.
86
87 When the output of ctest is being sent directly to a terminal,
88 the progress through the set of tests is reported by updating
89 the same line rather than printing start and end messages for
90 each test on new lines. This can significantly reduce the ver‐
91 bosity of the test output. Test completion messages are still
92 output on their own line for failed tests and the final test
93 summary will also still be logged.
94
95 This option can also be enabled by setting the environment vari‐
96 able CTEST_PROGRESS_OUTPUT.
97
98 -V,--verbose
99 Enable verbose output from tests.
100
101 Test output is normally suppressed and only summary information
102 is displayed. This option will show all test output.
103
104 -VV,--extra-verbose
105 Enable more verbose output from tests.
106
107 Test output is normally suppressed and only summary information
108 is displayed. This option will show even more test output.
109
110 --debug
111 Displaying more verbose internals of CTest.
112
113 This feature will result in a large number of output that is
114 mostly useful for debugging dashboard problems.
115
116 --output-on-failure
117 Output anything outputted by the test program if the test should
118 fail. This option can also be enabled by setting the CTEST_OUT‐
119 PUT_ON_FAILURE environment variable
120
121 -F Enable failover.
122
123 This option allows CTest to resume a test set execution that was
124 previously interrupted. If no interruption occurred, the -F
125 option will have no effect.
126
127 -j <jobs>, --parallel <jobs>
128 Run the tests in parallel using the given number of jobs.
129
130 This option tells CTest to run the tests in parallel using given
131 number of jobs. This option can also be set by setting the
132 CTEST_PARALLEL_LEVEL environment variable.
133
134 This option can be used with the PROCESSORS test property.
135
136 See Label and Subproject Summary.
137
138 --resource-spec-file <file>
139 Run CTest with resource allocation enabled, using the resource
140 specification file specified in <file>.
141
142 When ctest is run as a Dashboard Client this sets the Resource‐
143 SpecFile option of the CTest Test Step.
144
145 --test-load <level>
146 While running tests in parallel (e.g. with -j), try not to start
147 tests when they may cause the CPU load to pass above a given
148 threshold.
149
150 When ctest is run as a Dashboard Client this sets the TestLoad
151 option of the CTest Test Step.
152
153 -Q,--quiet
154 Make CTest quiet.
155
156 This option will suppress all the output. The output log file
157 will still be generated if the --output-log is specified.
158 Options such as --verbose, --extra-verbose, and --debug are
159 ignored if --quiet is specified.
160
161 -O <file>, --output-log <file>
162 Output to log file.
163
164 This option tells CTest to write all its output to a <file> log
165 file.
166
167 -N,--show-only[=<format>]
168 Disable actual execution of tests.
169
170 This option tells CTest to list the tests that would be run but
171 not actually run them. Useful in conjunction with the -R and -E
172 options.
173
174 <format> can be one of the following values.
175
176 human Human-friendly output. This is not guaranteed to be
177 stable. This is the default.
178
179 json-v1
180 Dump the test information in JSON format. See Show as
181 JSON Object Model.
182
183 -L <regex>, --label-regex <regex>
184 Run tests with labels matching regular expression.
185
186 This option tells CTest to run only the tests whose labels match
187 the given regular expression.
188
189 -R <regex>, --tests-regex <regex>
190 Run tests matching regular expression.
191
192 This option tells CTest to run only the tests whose names match
193 the given regular expression.
194
195 -E <regex>, --exclude-regex <regex>
196 Exclude tests matching regular expression.
197
198 This option tells CTest to NOT run the tests whose names match
199 the given regular expression.
200
201 -LE <regex>, --label-exclude <regex>
202 Exclude tests with labels matching regular expression.
203
204 This option tells CTest to NOT run the tests whose labels match
205 the given regular expression.
206
207 -FA <regex>, --fixture-exclude-any <regex>
208 Exclude fixtures matching <regex> from automatically adding any
209 tests to the test set.
210
211 If a test in the set of tests to be executed requires a particu‐
212 lar fixture, that fixture’s setup and cleanup tests would nor‐
213 mally be added to the test set automatically. This option pre‐
214 vents adding setup or cleanup tests for fixtures matching the
215 <regex>. Note that all other fixture behavior is retained,
216 including test dependencies and skipping tests that have fixture
217 setup tests that fail.
218
219 -FS <regex>, --fixture-exclude-setup <regex>
220 Same as -FA except only matching setup tests are excluded.
221
222 -FC <regex>, --fixture-exclude-cleanup <regex>
223 Same as -FA except only matching cleanup tests are excluded.
224
225 -D <dashboard>, --dashboard <dashboard>
226 Execute dashboard test.
227
228 This option tells CTest to act as a CDash client and perform a
229 dashboard test. All tests are <Mode><Test>, where <Mode> can be
230 Experimental, Nightly, and Continuous, and <Test> can be Start,
231 Update, Configure, Build, Test, Coverage, and Submit.
232
233 See Dashboard Client.
234
235 -D <var>:<type>=<value>
236 Define a variable for script mode.
237
238 Pass in variable values on the command line. Use in conjunction
239 with -S to pass variable values to a dashboard script. Parsing
240 -D arguments as variable values is only attempted if the value
241 following -D does not match any of the known dashboard types.
242
243 -M <model>, --test-model <model>
244 Sets the model for a dashboard.
245
246 This option tells CTest to act as a CDash client where the
247 <model> can be Experimental, Nightly, and Continuous. Combining
248 -M and -T is similar to -D.
249
250 See Dashboard Client.
251
252 -T <action>, --test-action <action>
253 Sets the dashboard action to perform.
254
255 This option tells CTest to act as a CDash client and perform
256 some action such as start, build, test etc. See Dashboard Client
257 Steps for the full list of actions. Combining -M and -T is sim‐
258 ilar to -D.
259
260 See Dashboard Client.
261
262 -S <script>, --script <script>
263 Execute a dashboard for a configuration.
264
265 This option tells CTest to load in a configuration script which
266 sets a number of parameters such as the binary and source direc‐
267 tories. Then CTest will do what is required to create and run a
268 dashboard. This option basically sets up a dashboard and then
269 runs ctest -D with the appropriate options.
270
271 See Dashboard Client.
272
273 -SP <script>, --script-new-process <script>
274 Execute a dashboard for a configuration.
275
276 This option does the same operations as -S but it will do them
277 in a separate process. This is primarily useful in cases where
278 the script may modify the environment and you do not want the
279 modified environment to impact other -S scripts.
280
281 See Dashboard Client.
282
283 -I [Start,End,Stride,test#,test#|Test file], --tests-information
284 Run a specific number of tests by number.
285
286 This option causes CTest to run tests starting at number Start,
287 ending at number End, and incrementing by Stride. Any addi‐
288 tional numbers after Stride are considered individual test num‐
289 bers. Start, End, or Stride can be empty. Optionally a file
290 can be given that contains the same syntax as the command line.
291
292 -U, --union
293 Take the Union of -I and -R.
294
295 When both -R and -I are specified by default the intersection of
296 tests are run. By specifying -U the union of tests is run
297 instead.
298
299 --rerun-failed
300 Run only the tests that failed previously.
301
302 This option tells CTest to perform only the tests that failed
303 during its previous run. When this option is specified, CTest
304 ignores all other options intended to modify the list of tests
305 to run (-L, -R, -E, -LE, -I, etc). In the event that CTest runs
306 and no tests fail, subsequent calls to CTest with the
307 --rerun-failed option will run the set of tests that most
308 recently failed (if any).
309
310 --repeat <mode>:<n>
311 Run tests repeatedly based on the given <mode> up to <n> times.
312 The modes are:
313
314 until-fail
315 Require each test to run <n> times without failing in
316 order to pass. This is useful in finding sporadic fail‐
317 ures in test cases.
318
319 until-pass
320 Allow each test to run up to <n> times in order to pass.
321 Repeats tests if they fail for any reason. This is use‐
322 ful in tolerating sporadic failures in test cases.
323
324 after-timeout
325 Allow each test to run up to <n> times in order to pass.
326 Repeats tests only if they timeout. This is useful in
327 tolerating sporadic timeouts in test cases on busy
328 machines.
329
330 --repeat-until-fail <n>
331 Equivalent to --repeat until-fail:<n>.
332
333 --max-width <width>
334 Set the max width for a test name to output.
335
336 Set the maximum width for each test name to show in the output.
337 This allows the user to widen the output to avoid clipping the
338 test name which can be very annoying.
339
340 --interactive-debug-mode [0|1]
341 Set the interactive mode to 0 or 1.
342
343 This option causes CTest to run tests in either an interactive
344 mode or a non-interactive mode. On Windows this means that in
345 non-interactive mode, all system debug pop up windows are
346 blocked. In dashboard mode (Experimental, Nightly, Continuous),
347 the default is non-interactive. When just running tests not for
348 a dashboard the default is to allow popups and interactive
349 debugging.
350
351 --no-label-summary
352 Disable timing summary information for labels.
353
354 This option tells CTest not to print summary information for
355 each label associated with the tests run. If there are no
356 labels on the tests, nothing extra is printed.
357
358 See Label and Subproject Summary.
359
360 --no-subproject-summary
361 Disable timing summary information for subprojects.
362
363 This option tells CTest not to print summary information for
364 each subproject associated with the tests run. If there are no
365 subprojects on the tests, nothing extra is printed.
366
367 See Label and Subproject Summary.
368
369 --build-and-test See Build and Test Mode.
370
371 --test-output-size-passed <size>
372 Limit the output for passed tests to <size> bytes.
373
374 --test-output-size-failed <size>
375 Limit the output for failed tests to <size> bytes.
376
377 --overwrite
378 Overwrite CTest configuration option.
379
380 By default CTest uses configuration options from configuration
381 file. This option will overwrite the configuration option.
382
383 --force-new-ctest-process
384 Run child CTest instances as new processes.
385
386 By default CTest will run child CTest instances within the same
387 process. If this behavior is not desired, this argument will
388 enforce new processes for child CTest processes.
389
390 --schedule-random
391 Use a random order for scheduling tests.
392
393 This option will run the tests in a random order. It is com‐
394 monly used to detect implicit dependencies in a test suite.
395
396 --submit-index
397 Legacy option for old Dart2 dashboard server feature. Do not
398 use.
399
400 --timeout <seconds>
401 Set the default test timeout.
402
403 This option effectively sets a timeout on all tests that do not
404 already have a timeout set on them via the TIMEOUT property.
405
406 --stop-time <time>
407 Set a time at which all tests should stop running.
408
409 Set a real time of day at which all tests should timeout. Exam‐
410 ple: 7:00:00 -0400. Any time format understood by the curl date
411 parser is accepted. Local time is assumed if no timezone is
412 specified.
413
414 --print-labels
415 Print all available test labels.
416
417 This option will not run any tests, it will simply print the
418 list of all labels associated with the test set.
419
420 --no-tests=<[error|ignore]>
421 Regard no tests found either as error or ignore it.
422
423 If no tests were found, the default behavior of CTest is to
424 always log an error message but to return an error code in
425 script mode only. This option unifies the behavior of CTest by
426 either returning an error code if no tests were found or by
427 ignoring it.
428
429 --help,-help,-usage,-h,-H,/?
430 Print usage information and exit.
431
432 Usage describes the basic command line interface and its
433 options.
434
435 --version,-version,/V [<f>]
436 Show program name/version banner and exit.
437
438 If a file is specified, the version is written into it. The
439 help is printed to a named <f>ile if given.
440
441 --help-full [<f>]
442 Print all help manuals and exit.
443
444 All manuals are printed in a human-readable text format. The
445 help is printed to a named <f>ile if given.
446
447 --help-manual <man> [<f>]
448 Print one help manual and exit.
449
450 The specified manual is printed in a human-readable text format.
451 The help is printed to a named <f>ile if given.
452
453 --help-manual-list [<f>]
454 List help manuals available and exit.
455
456 The list contains all manuals for which help may be obtained by
457 using the --help-manual option followed by a manual name. The
458 help is printed to a named <f>ile if given.
459
460 --help-command <cmd> [<f>]
461 Print help for one command and exit.
462
463 The cmake-commands(7) manual entry for <cmd> is printed in a
464 human-readable text format. The help is printed to a named
465 <f>ile if given.
466
467 --help-command-list [<f>]
468 List commands with help available and exit.
469
470 The list contains all commands for which help may be obtained by
471 using the --help-command option followed by a command name. The
472 help is printed to a named <f>ile if given.
473
474 --help-commands [<f>]
475 Print cmake-commands manual and exit.
476
477 The cmake-commands(7) manual is printed in a human-readable text
478 format. The help is printed to a named <f>ile if given.
479
480 --help-module <mod> [<f>]
481 Print help for one module and exit.
482
483 The cmake-modules(7) manual entry for <mod> is printed in a
484 human-readable text format. The help is printed to a named
485 <f>ile if given.
486
487 --help-module-list [<f>]
488 List modules with help available and exit.
489
490 The list contains all modules for which help may be obtained by
491 using the --help-module option followed by a module name. The
492 help is printed to a named <f>ile if given.
493
494 --help-modules [<f>]
495 Print cmake-modules manual and exit.
496
497 The cmake-modules(7) manual is printed in a human-readable text
498 format. The help is printed to a named <f>ile if given.
499
500 --help-policy <cmp> [<f>]
501 Print help for one policy and exit.
502
503 The cmake-policies(7) manual entry for <cmp> is printed in a
504 human-readable text format. The help is printed to a named
505 <f>ile if given.
506
507 --help-policy-list [<f>]
508 List policies with help available and exit.
509
510 The list contains all policies for which help may be obtained by
511 using the --help-policy option followed by a policy name. The
512 help is printed to a named <f>ile if given.
513
514 --help-policies [<f>]
515 Print cmake-policies manual and exit.
516
517 The cmake-policies(7) manual is printed in a human-readable text
518 format. The help is printed to a named <f>ile if given.
519
520 --help-property <prop> [<f>]
521 Print help for one property and exit.
522
523 The cmake-properties(7) manual entries for <prop> are printed in
524 a human-readable text format. The help is printed to a named
525 <f>ile if given.
526
527 --help-property-list [<f>]
528 List properties with help available and exit.
529
530 The list contains all properties for which help may be obtained
531 by using the --help-property option followed by a property name.
532 The help is printed to a named <f>ile if given.
533
534 --help-properties [<f>]
535 Print cmake-properties manual and exit.
536
537 The cmake-properties(7) manual is printed in a human-readable
538 text format. The help is printed to a named <f>ile if given.
539
540 --help-variable <var> [<f>]
541 Print help for one variable and exit.
542
543 The cmake-variables(7) manual entry for <var> is printed in a
544 human-readable text format. The help is printed to a named
545 <f>ile if given.
546
547 --help-variable-list [<f>]
548 List variables with help available and exit.
549
550 The list contains all variables for which help may be obtained
551 by using the --help-variable option followed by a variable name.
552 The help is printed to a named <f>ile if given.
553
554 --help-variables [<f>]
555 Print cmake-variables manual and exit.
556
557 The cmake-variables(7) manual is printed in a human-readable
558 text format. The help is printed to a named <f>ile if given.
559
561 CTest prints timing summary information for each LABEL and subproject
562 associated with the tests run. The label time summary will not include
563 labels that are mapped to subprojects.
564
565 When the PROCESSORS test property is set, CTest will display a weighted
566 test timing result in label and subproject summaries. The time is
567 reported with sec*proc instead of just sec.
568
569 The weighted time summary reported for each label or subproject j is
570 computed as:
571
572 Weighted Time Summary for Label/Subproject j =
573 sum(raw_test_time[j,i] * num_processors[j,i], i=1...num_tests[j])
574
575 for labels/subprojects j=1...total
576
577 where:
578
579 · raw_test_time[j,i]: Wall-clock time for the i test for the j label or
580 subproject
581
582 · num_processors[j,i]: Value of the CTest PROCESSORS property for the i
583 test for the j label or subproject
584
585 · num_tests[j]: Number of tests associated with the j label or subpro‐
586 ject
587
588 · total: Total number of labels or subprojects that have at least one
589 test run
590
591 Therefore, the weighted time summary for each label or subproject rep‐
592 resents the amount of time that CTest gave to run the tests for each
593 label or subproject and gives a good representation of the total
594 expense of the tests for each label or subproject when compared to
595 other labels or subprojects.
596
597 For example, if SubprojectA showed 100 sec*proc and SubprojectB showed
598 10 sec*proc, then CTest allocated approximately 10 times the CPU/core
599 time to run the tests for SubprojectA than for SubprojectB (e.g. so if
600 effort is going to be expended to reduce the cost of the test suite for
601 the whole project, then reducing the cost of the test suite for Subpro‐
602 jectA would likely have a larger impact than effort to reduce the cost
603 of the test suite for SubprojectB).
604
606 CTest provides a command-line signature to configure (i.e. run cmake
607 on), build, and/or execute a test:
608
609 ctest --build-and-test <path-to-source> <path-to-build>
610 --build-generator <generator>
611 [<options>...]
612 [--build-options <opts>...]
613 [--test-command <command> [<args>...]]
614
615 The configure and test steps are optional. The arguments to this com‐
616 mand line are the source and binary directories. The --build-generator
617 option must be provided to use --build-and-test. If --test-command is
618 specified then that will be run after the build is complete. Other
619 options that affect this mode include:
620
621 --build-target
622 Specify a specific target to build.
623
624 If left out the all target is built.
625
626 --build-nocmake
627 Run the build without running cmake first.
628
629 Skip the cmake step.
630
631 --build-run-dir
632 Specify directory to run programs from.
633
634 Directory where programs will be after it has been compiled.
635
636 --build-two-config
637 Run CMake twice.
638
639 --build-exe-dir
640 Specify the directory for the executable.
641
642 --build-generator
643 Specify the generator to use. See the cmake-generators(7) man‐
644 ual.
645
646 --build-generator-platform
647 Specify the generator-specific platform.
648
649 --build-generator-toolset
650 Specify the generator-specific toolset.
651
652 --build-project
653 Specify the name of the project to build.
654
655 --build-makeprogram
656 Specify the explicit make program to be used by CMake when con‐
657 figuring and building the project. Only applicable for Make and
658 Ninja based generators.
659
660 --build-noclean
661 Skip the make clean step.
662
663 --build-config-sample
664 A sample executable to use to determine the configuration that
665 should be used. e.g. Debug, Release etc.
666
667 --build-options
668 Additional options for configuring the build (i.e. for CMake,
669 not for the build tool). Note that if this is specified, the
670 --build-options keyword and its arguments must be the last
671 option given on the command line, with the possible exception of
672 --test-command.
673
674 --test-command
675 The command to run as the test step with the --build-and-test
676 option. All arguments following this keyword will be assumed to
677 be part of the test command line, so it must be the last option
678 given.
679
680 --test-timeout
681 The time limit in seconds
682
684 CTest can operate as a client for the CDash software quality dashboard
685 application. As a dashboard client, CTest performs a sequence of steps
686 to configure, build, and test software, and then submits the results to
687 a CDash server. The command-line signature used to submit to CDash is:
688
689 ctest (-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>)
690 [-- <dashboard-options>...]
691
692 Options for Dashboard Client include:
693
694 --group <group>
695 Specify what group you’d like to submit results to
696
697 Submit dashboard to specified group instead of default one. By
698 default, the dashboard is submitted to Nightly, Experimental, or
699 Continuous group, but by specifying this option, the group can
700 be arbitrary.
701
702 This replaces the deprecated option --track. Despite the name
703 change its behavior is unchanged.
704
705 -A <file>, --add-notes <file>
706 Add a notes file with submission.
707
708 This option tells CTest to include a notes file when submitting
709 dashboard.
710
711 --tomorrow-tag
712 Nightly or Experimental starts with next day tag.
713
714 This is useful if the build will not finish in one day.
715
716 --extra-submit <file>[;<file>]
717 Submit extra files to the dashboard.
718
719 This option will submit extra files to the dashboard.
720
721 --http1.0
722 Submit using HTTP 1.0.
723
724 This option will force CTest to use HTTP 1.0 to submit files to
725 the dashboard, instead of HTTP 1.1.
726
727 --no-compress-output
728 Do not compress test output when submitting.
729
730 This flag will turn off automatic compression of test output.
731 Use this to maintain compatibility with an older version of
732 CDash which doesn’t support compressed test output.
733
734 Dashboard Client Steps
735 CTest defines an ordered list of testing steps of which some or all may
736 be run as a dashboard client:
737
738 Start Start a new dashboard submission to be composed of results
739 recorded by the following steps. See the CTest Start Step sec‐
740 tion below.
741
742 Update Update the source tree from its version control repository.
743 Record the old and new versions and the list of updated source
744 files. See the CTest Update Step section below.
745
746 Configure
747 Configure the software by running a command in the build tree.
748 Record the configuration output log. See the CTest Configure
749 Step section below.
750
751 Build Build the software by running a command in the build tree.
752 Record the build output log and detect warnings and errors. See
753 the CTest Build Step section below.
754
755 Test Test the software by loading a CTestTestfile.cmake from the
756 build tree and executing the defined tests. Record the output
757 and result of each test. See the CTest Test Step section below.
758
759 Coverage
760 Compute coverage of the source code by running a coverage analy‐
761 sis tool and recording its output. See the CTest Coverage Step
762 section below.
763
764 MemCheck
765 Run the software test suite through a memory check tool. Record
766 the test output, results, and issues reported by the tool. See
767 the CTest MemCheck Step section below.
768
769 Submit Submit results recorded from other testing steps to the software
770 quality dashboard server. See the CTest Submit Step section
771 below.
772
773 Dashboard Client Modes
774 CTest defines three modes of operation as a dashboard client:
775
776 Nightly
777 This mode is intended to be invoked once per day, typically at
778 night. It enables the Start, Update, Configure, Build, Test,
779 Coverage, and Submit steps by default. Selected steps run even
780 if the Update step reports no changes to the source tree.
781
782 Continuous
783 This mode is intended to be invoked repeatedly throughout the
784 day. It enables the Start, Update, Configure, Build, Test, Cov‐
785 erage, and Submit steps by default, but exits after the Update
786 step if it reports no changes to the source tree.
787
788 Experimental
789 This mode is intended to be invoked by a developer to test local
790 changes. It enables the Start, Configure, Build, Test, Cover‐
791 age, and Submit steps by default.
792
793 Dashboard Client via CTest Command-Line
794 CTest can perform testing on an already-generated build tree. Run the
795 ctest command with the current working directory set to the build tree
796 and use one of these signatures:
797
798 ctest -D <mode>[<step>]
799 ctest -M <mode> [ -T <step> ]...
800
801 The <mode> must be one of the above Dashboard Client Modes, and each
802 <step> must be one of the above Dashboard Client Steps.
803
804 CTest reads the Dashboard Client Configuration settings from a file in
805 the build tree called either CTestConfiguration.ini or DartConfigura‐
806 tion.tcl (the names are historical). The format of the file is:
807
808 # Lines starting in '#' are comments.
809 # Other non-blank lines are key-value pairs.
810 <setting>: <value>
811
812 where <setting> is the setting name and <value> is the setting value.
813
814 In build trees generated by CMake, this configuration file is generated
815 by the CTest module if included by the project. The module uses vari‐
816 ables to obtain a value for each setting as documented with the set‐
817 tings below.
818
819 Dashboard Client via CTest Script
820 CTest can perform testing driven by a cmake-language(7) script that
821 creates and maintains the source and build tree as well as performing
822 the testing steps. Run the ctest command with the current working
823 directory set outside of any build tree and use one of these signa‐
824 tures:
825
826 ctest -S <script>
827 ctest -SP <script>
828
829 The <script> file must call CTest Commands commands to run testing
830 steps explicitly as documented below. The commands obtain Dashboard
831 Client Configuration settings from their arguments or from variables
832 set in the script.
833
835 The Dashboard Client Steps may be configured by named settings as docu‐
836 mented in the following sections.
837
838 CTest Start Step
839 Start a new dashboard submission to be composed of results recorded by
840 the following steps.
841
842 In a CTest Script, the ctest_start() command runs this step. Arguments
843 to the command may specify some of the step settings. The command
844 first runs the command-line specified by the CTEST_CHECKOUT_COMMAND
845 variable, if set, to initialize the source directory.
846
847 Configuration settings include:
848
849 BuildDirectory
850 The full path to the project build tree.
851
852 · CTest Script variable: CTEST_BINARY_DIRECTORY
853
854 · CTest module variable: PROJECT_BINARY_DIR
855
856 SourceDirectory
857 The full path to the project source tree.
858
859 · CTest Script variable: CTEST_SOURCE_DIRECTORY
860
861 · CTest module variable: PROJECT_SOURCE_DIR
862
863 CTest Update Step
864 In a CTest Script, the ctest_update() command runs this step. Argu‐
865 ments to the command may specify some of the step settings.
866
867 Configuration settings to specify the version control tool include:
868
869 BZRCommand
870 bzr command-line tool to use if source tree is managed by
871 Bazaar.
872
873 · CTest Script variable: CTEST_BZR_COMMAND
874
875 · CTest module variable: none
876
877 BZRUpdateOptions
878 Command-line options to the BZRCommand when updating the source.
879
880 · CTest Script variable: CTEST_BZR_UPDATE_OPTIONS
881
882 · CTest module variable: none
883
884 CVSCommand
885 cvs command-line tool to use if source tree is managed by CVS.
886
887 · CTest Script variable: CTEST_CVS_COMMAND
888
889 · CTest module variable: CVSCOMMAND
890
891 CVSUpdateOptions
892 Command-line options to the CVSCommand when updating the source.
893
894 · CTest Script variable: CTEST_CVS_UPDATE_OPTIONS
895
896 · CTest module variable: CVS_UPDATE_OPTIONS
897
898 GITCommand
899 git command-line tool to use if source tree is managed by Git.
900
901 · CTest Script variable: CTEST_GIT_COMMAND
902
903 · CTest module variable: GITCOMMAND
904
905 The source tree is updated by git fetch followed by git reset
906 --hard to the FETCH_HEAD. The result is the same as git pull
907 except that any local modifications are overwritten. Use GITUp‐
908 dateCustom to specify a different approach.
909
910 GITInitSubmodules
911 If set, CTest will update the repository’s submodules before
912 updating.
913
914 · CTest Script variable: CTEST_GIT_INIT_SUBMODULES
915
916 · CTest module variable: CTEST_GIT_INIT_SUBMODULES
917
918 GITUpdateCustom
919 Specify a custom command line (as a semicolon-separated list) to
920 run in the source tree (Git work tree) to update it instead of
921 running the GITCommand.
922
923 · CTest Script variable: CTEST_GIT_UPDATE_CUSTOM
924
925 · CTest module variable: CTEST_GIT_UPDATE_CUSTOM
926
927 GITUpdateOptions
928 Command-line options to the GITCommand when updating the source.
929
930 · CTest Script variable: CTEST_GIT_UPDATE_OPTIONS
931
932 · CTest module variable: GIT_UPDATE_OPTIONS
933
934 HGCommand
935 hg command-line tool to use if source tree is managed by Mercu‐
936 rial.
937
938 · CTest Script variable: CTEST_HG_COMMAND
939
940 · CTest module variable: none
941
942 HGUpdateOptions
943 Command-line options to the HGCommand when updating the source.
944
945 · CTest Script variable: CTEST_HG_UPDATE_OPTIONS
946
947 · CTest module variable: none
948
949 P4Client
950 Value of the -c option to the P4Command.
951
952 · CTest Script variable: CTEST_P4_CLIENT
953
954 · CTest module variable: CTEST_P4_CLIENT
955
956 P4Command
957 p4 command-line tool to use if source tree is managed by Per‐
958 force.
959
960 · CTest Script variable: CTEST_P4_COMMAND
961
962 · CTest module variable: P4COMMAND
963
964 P4Options
965 Command-line options to the P4Command for all invocations.
966
967 · CTest Script variable: CTEST_P4_OPTIONS
968
969 · CTest module variable: CTEST_P4_OPTIONS
970
971 P4UpdateCustom
972 Specify a custom command line (as a semicolon-separated list) to
973 run in the source tree (Perforce tree) to update it instead of
974 running the P4Command.
975
976 · CTest Script variable: none
977
978 · CTest module variable: CTEST_P4_UPDATE_CUSTOM
979
980 P4UpdateOptions
981 Command-line options to the P4Command when updating the source.
982
983 · CTest Script variable: CTEST_P4_UPDATE_OPTIONS
984
985 · CTest module variable: CTEST_P4_UPDATE_OPTIONS
986
987 SVNCommand
988 svn command-line tool to use if source tree is managed by Sub‐
989 version.
990
991 · CTest Script variable: CTEST_SVN_COMMAND
992
993 · CTest module variable: SVNCOMMAND
994
995 SVNOptions
996 Command-line options to the SVNCommand for all invocations.
997
998 · CTest Script variable: CTEST_SVN_OPTIONS
999
1000 · CTest module variable: CTEST_SVN_OPTIONS
1001
1002 SVNUpdateOptions
1003 Command-line options to the SVNCommand when updating the source.
1004
1005 · CTest Script variable: CTEST_SVN_UPDATE_OPTIONS
1006
1007 · CTest module variable: SVN_UPDATE_OPTIONS
1008
1009 UpdateCommand
1010 Specify the version-control command-line tool to use without
1011 detecting the VCS that manages the source tree.
1012
1013 · CTest Script variable: CTEST_UPDATE_COMMAND
1014
1015 · CTest module variable: <VCS>COMMAND when UPDATE_TYPE is <vcs>,
1016 else UPDATE_COMMAND
1017
1018 UpdateOptions
1019 Command-line options to the UpdateCommand.
1020
1021 · CTest Script variable: CTEST_UPDATE_OPTIONS
1022
1023 · CTest module variable: <VCS>_UPDATE_OPTIONS when UPDATE_TYPE
1024 is <vcs>, else UPDATE_OPTIONS
1025
1026 UpdateType
1027 Specify the version-control system that manages the source tree
1028 if it cannot be detected automatically. The value may be bzr,
1029 cvs, git, hg, p4, or svn.
1030
1031 · CTest Script variable: none, detected from source tree
1032
1033 · CTest module variable: UPDATE_TYPE if set, else
1034 CTEST_UPDATE_TYPE
1035
1036 UpdateVersionOnly
1037 Specify that you want the version control update command to only
1038 discover the current version that is checked out, and not to
1039 update to a different version.
1040
1041 · CTest Script variable: CTEST_UPDATE_VERSION_ONLY
1042
1043 UpdateVersionOverride
1044 Specify the current version of your source tree.
1045
1046 When this variable is set to a non-empty string, CTest will
1047 report the value you specified rather than using the update com‐
1048 mand to discover the current version that is checked out. Use of
1049 this variable supersedes UpdateVersionOnly. Like UpdateVer‐
1050 sionOnly, using this variable tells CTest not to update the
1051 source tree to a different version.
1052
1053 · CTest Script variable: CTEST_UPDATE_VERSION_OVERRIDE
1054
1055 Additional configuration settings include:
1056
1057 NightlyStartTime
1058 In the Nightly dashboard mode, specify the “nightly start time”.
1059 With centralized version control systems (cvs and svn), the
1060 Update step checks out the version of the software as of this
1061 time so that multiple clients choose a common version to test.
1062 This is not well-defined in distributed version-control systems
1063 so the setting is ignored.
1064
1065 · CTest Script variable: CTEST_NIGHTLY_START_TIME
1066
1067 · CTest module variable: NIGHTLY_START_TIME if set, else
1068 CTEST_NIGHTLY_START_TIME
1069
1070 CTest Configure Step
1071 In a CTest Script, the ctest_configure() command runs this step. Argu‐
1072 ments to the command may specify some of the step settings.
1073
1074 Configuration settings include:
1075
1076 ConfigureCommand
1077 Command-line to launch the software configuration process. It
1078 will be executed in the location specified by the BuildDirectory
1079 setting.
1080
1081 · CTest Script variable: CTEST_CONFIGURE_COMMAND
1082
1083 · CTest module variable: CMAKE_COMMAND followed by
1084 PROJECT_SOURCE_DIR
1085
1086 LabelsForSubprojects
1087 Specify a semicolon-separated list of labels that will be
1088 treated as subprojects. This mapping will be passed on to CDash
1089 when configure, test or build results are submitted.
1090
1091 · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1092
1093 · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1094
1095 See Label and Subproject Summary.
1096
1097 CTest Build Step
1098 In a CTest Script, the ctest_build() command runs this step. Arguments
1099 to the command may specify some of the step settings.
1100
1101 Configuration settings include:
1102
1103 DefaultCTestConfigurationType
1104 When the build system to be launched allows build-time selection
1105 of the configuration (e.g. Debug, Release), this specifies the
1106 default configuration to be built when no -C option is given to
1107 the ctest command. The value will be substituted into the value
1108 of MakeCommand to replace the literal string ${CTEST_CONFIGURA‐
1109 TION_TYPE} if it appears.
1110
1111 · CTest Script variable: CTEST_CONFIGURATION_TYPE
1112
1113 · CTest module variable: DEFAULT_CTEST_CONFIGURATION_TYPE, ini‐
1114 tialized by the CMAKE_CONFIG_TYPE environment variable
1115
1116 LabelsForSubprojects
1117 Specify a semicolon-separated list of labels that will be
1118 treated as subprojects. This mapping will be passed on to CDash
1119 when configure, test or build results are submitted.
1120
1121 · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1122
1123 · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1124
1125 See Label and Subproject Summary.
1126
1127 MakeCommand
1128 Command-line to launch the software build process. It will be
1129 executed in the location specified by the BuildDirectory set‐
1130 ting.
1131
1132 · CTest Script variable: CTEST_BUILD_COMMAND
1133
1134 · CTest module variable: MAKECOMMAND, initialized by the
1135 build_command() command
1136
1137 UseLaunchers
1138 For build trees generated by CMake using one of the Makefile
1139 Generators or the Ninja generator, specify whether the
1140 CTEST_USE_LAUNCHERS feature is enabled by the CTestUseLaunchers
1141 module (also included by the CTest module). When enabled, the
1142 generated build system wraps each invocation of the compiler,
1143 linker, or custom command line with a “launcher” that communi‐
1144 cates with CTest via environment variables and files to report
1145 granular build warning and error information. Otherwise, CTest
1146 must “scrape” the build output log for diagnostics.
1147
1148 · CTest Script variable: CTEST_USE_LAUNCHERS
1149
1150 · CTest module variable: CTEST_USE_LAUNCHERS
1151
1152 CTest Test Step
1153 In a CTest Script, the ctest_test() command runs this step. Arguments
1154 to the command may specify some of the step settings.
1155
1156 Configuration settings include:
1157
1158 ResourceSpecFile
1159 Specify a resource specification file. See Resource Allocation
1160 for more information.
1161
1162 LabelsForSubprojects
1163 Specify a semicolon-separated list of labels that will be
1164 treated as subprojects. This mapping will be passed on to CDash
1165 when configure, test or build results are submitted.
1166
1167 · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1168
1169 · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1170
1171 See Label and Subproject Summary.
1172
1173 TestLoad
1174 While running tests in parallel (e.g. with -j), try not to start
1175 tests when they may cause the CPU load to pass above a given
1176 threshold.
1177
1178 · CTest Script variable: CTEST_TEST_LOAD
1179
1180 · CTest module variable: CTEST_TEST_LOAD
1181
1182 TimeOut
1183 The default timeout for each test if not specified by the TIME‐
1184 OUT test property.
1185
1186 · CTest Script variable: CTEST_TEST_TIMEOUT
1187
1188 · CTest module variable: DART_TESTING_TIMEOUT
1189
1190 CTest Coverage Step
1191 In a CTest Script, the ctest_coverage() command runs this step. Argu‐
1192 ments to the command may specify some of the step settings.
1193
1194 Configuration settings include:
1195
1196 CoverageCommand
1197 Command-line tool to perform software coverage analysis. It
1198 will be executed in the location specified by the BuildDirectory
1199 setting.
1200
1201 · CTest Script variable: CTEST_COVERAGE_COMMAND
1202
1203 · CTest module variable: COVERAGE_COMMAND
1204
1205 CoverageExtraFlags
1206 Specify command-line options to the CoverageCommand tool.
1207
1208 · CTest Script variable: CTEST_COVERAGE_EXTRA_FLAGS
1209
1210 · CTest module variable: COVERAGE_EXTRA_FLAGS
1211
1212 These options are the first arguments passed to CoverageCommand.
1213
1214 CTest MemCheck Step
1215 In a CTest Script, the ctest_memcheck() command runs this step. Argu‐
1216 ments to the command may specify some of the step settings.
1217
1218 Configuration settings include:
1219
1220 MemoryCheckCommand
1221 Command-line tool to perform dynamic analysis. Test command
1222 lines will be launched through this tool.
1223
1224 · CTest Script variable: CTEST_MEMORYCHECK_COMMAND
1225
1226 · CTest module variable: MEMORYCHECK_COMMAND
1227
1228 MemoryCheckCommandOptions
1229 Specify command-line options to the MemoryCheckCommand tool.
1230 They will be placed prior to the test command line.
1231
1232 · CTest Script variable: CTEST_MEMORYCHECK_COMMAND_OPTIONS
1233
1234 · CTest module variable: MEMORYCHECK_COMMAND_OPTIONS
1235
1236 MemoryCheckType
1237 Specify the type of memory checking to perform.
1238
1239 · CTest Script variable: CTEST_MEMORYCHECK_TYPE
1240
1241 · CTest module variable: MEMORYCHECK_TYPE
1242
1243 MemoryCheckSanitizerOptions
1244 Specify options to sanitizers when running with a sani‐
1245 tize-enabled build.
1246
1247 · CTest Script variable: CTEST_MEMORYCHECK_SANITIZER_OPTIONS
1248
1249 · CTest module variable: MEMORYCHECK_SANITIZER_OPTIONS
1250
1251 MemoryCheckSuppressionFile
1252 Specify a file containing suppression rules for the MemoryCheck‐
1253 Command tool. It will be passed with options appropriate to the
1254 tool.
1255
1256 · CTest Script variable: CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
1257
1258 · CTest module variable: MEMORYCHECK_SUPPRESSIONS_FILE
1259
1260 Additional configuration settings include:
1261
1262 BoundsCheckerCommand
1263 Specify a MemoryCheckCommand that is known to be command-line
1264 compatible with Bounds Checker.
1265
1266 · CTest Script variable: none
1267
1268 · CTest module variable: none
1269
1270 PurifyCommand
1271 Specify a MemoryCheckCommand that is known to be command-line
1272 compatible with Purify.
1273
1274 · CTest Script variable: none
1275
1276 · CTest module variable: PURIFYCOMMAND
1277
1278 ValgrindCommand
1279 Specify a MemoryCheckCommand that is known to be command-line
1280 compatible with Valgrind.
1281
1282 · CTest Script variable: none
1283
1284 · CTest module variable: VALGRIND_COMMAND
1285
1286 ValgrindCommandOptions
1287 Specify command-line options to the ValgrindCommand tool. They
1288 will be placed prior to the test command line.
1289
1290 · CTest Script variable: none
1291
1292 · CTest module variable: VALGRIND_COMMAND_OPTIONS
1293
1294 DrMemoryCommand
1295 Specify a MemoryCheckCommand that is known to be a command-line
1296 compatible with DrMemory.
1297
1298 · CTest Script variable: none
1299
1300 · CTest module variable: DRMEMORY_COMMAND
1301
1302 DrMemoryCommandOptions
1303 Specify command-line options to the DrMemoryCommand tool. They
1304 will be placed prior to the test command line.
1305
1306 · CTest Script variable: none
1307
1308 · CTest module variable: DRMEMORY_COMMAND_OPTIONS
1309
1310 CTest Submit Step
1311 In a CTest Script, the ctest_submit() command runs this step. Argu‐
1312 ments to the command may specify some of the step settings.
1313
1314 Configuration settings include:
1315
1316 BuildName
1317 Describe the dashboard client platform with a short string.
1318 (Operating system, compiler, etc.)
1319
1320 · CTest Script variable: CTEST_BUILD_NAME
1321
1322 · CTest module variable: BUILDNAME
1323
1324 CDashVersion
1325 Legacy option. Not used.
1326
1327 · CTest Script variable: none, detected from server
1328
1329 · CTest module variable: CTEST_CDASH_VERSION
1330
1331 CTestSubmitRetryCount
1332 Specify a number of attempts to retry submission on network
1333 failure.
1334
1335 · CTest Script variable: none, use the ctest_submit()
1336 RETRY_COUNT option.
1337
1338 · CTest module variable: CTEST_SUBMIT_RETRY_COUNT
1339
1340 CTestSubmitRetryDelay
1341 Specify a delay before retrying submission on network failure.
1342
1343 · CTest Script variable: none, use the ctest_submit()
1344 RETRY_DELAY option.
1345
1346 · CTest module variable: CTEST_SUBMIT_RETRY_DELAY
1347
1348 CurlOptions
1349 Specify a semicolon-separated list of options to control the
1350 Curl library that CTest uses internally to connect to the
1351 server. Possible options are CURLOPT_SSL_VERIFYPEER_OFF and
1352 CURLOPT_SSL_VERIFYHOST_OFF.
1353
1354 · CTest Script variable: CTEST_CURL_OPTIONS
1355
1356 · CTest module variable: CTEST_CURL_OPTIONS
1357
1358 DropLocation
1359 Legacy option. When SubmitURL is not set, it is constructed
1360 from DropMethod, DropSiteUser, DropSitePassword, DropSite, and
1361 DropLocation.
1362
1363 · CTest Script variable: CTEST_DROP_LOCATION
1364
1365 · CTest module variable: DROP_LOCATION if set, else
1366 CTEST_DROP_LOCATION
1367
1368 DropMethod
1369 Legacy option. When SubmitURL is not set, it is constructed
1370 from DropMethod, DropSiteUser, DropSitePassword, DropSite, and
1371 DropLocation.
1372
1373 · CTest Script variable: CTEST_DROP_METHOD
1374
1375 · CTest module variable: DROP_METHOD if set, else
1376 CTEST_DROP_METHOD
1377
1378 DropSite
1379 Legacy option. When SubmitURL is not set, it is constructed
1380 from DropMethod, DropSiteUser, DropSitePassword, DropSite, and
1381 DropLocation.
1382
1383 · CTest Script variable: CTEST_DROP_SITE
1384
1385 · CTest module variable: DROP_SITE if set, else CTEST_DROP_SITE
1386
1387 DropSitePassword
1388 Legacy option. When SubmitURL is not set, it is constructed
1389 from DropMethod, DropSiteUser, DropSitePassword, DropSite, and
1390 DropLocation.
1391
1392 · CTest Script variable: CTEST_DROP_SITE_PASSWORD
1393
1394 · CTest module variable: DROP_SITE_PASSWORD if set, else
1395 CTEST_DROP_SITE_PASWORD
1396
1397 DropSiteUser
1398 Legacy option. When SubmitURL is not set, it is constructed
1399 from DropMethod, DropSiteUser, DropSitePassword, DropSite, and
1400 DropLocation.
1401
1402 · CTest Script variable: CTEST_DROP_SITE_USER
1403
1404 · CTest module variable: DROP_SITE_USER if set, else
1405 CTEST_DROP_SITE_USER
1406
1407 IsCDash
1408 Legacy option. Not used.
1409
1410 · CTest Script variable: CTEST_DROP_SITE_CDASH
1411
1412 · CTest module variable: CTEST_DROP_SITE_CDASH
1413
1414 ScpCommand
1415 Legacy option. Not used.
1416
1417 · CTest Script variable: CTEST_SCP_COMMAND
1418
1419 · CTest module variable: SCPCOMMAND
1420
1421 Site Describe the dashboard client host site with a short string.
1422 (Hostname, domain, etc.)
1423
1424 · CTest Script variable: CTEST_SITE
1425
1426 · CTest module variable: SITE, initialized by the site_name()
1427 command
1428
1429 SubmitURL
1430 The http or https URL of the dashboard server to send the sub‐
1431 mission to.
1432
1433 · CTest Script variable: CTEST_SUBMIT_URL
1434
1435 · CTest module variable: SUBMIT_URL if set, else CTEST_SUB‐
1436 MIT_URL
1437
1438 TriggerSite
1439 Legacy option. Not used.
1440
1441 · CTest Script variable: CTEST_TRIGGER_SITE
1442
1443 · CTest module variable: TRIGGER_SITE if set, else CTEST_TRIG‐
1444 GER_SITE
1445
1447 When the --show-only=json-v1 command line option is given, the test
1448 information is output in JSON format. Version 1.0 of the JSON object
1449 model is defined as follows:
1450
1451 kind The string “ctestInfo”.
1452
1453 version
1454 A JSON object specifying the version components. Its members
1455 are
1456
1457 major A non-negative integer specifying the major version com‐
1458 ponent.
1459
1460 minor A non-negative integer specifying the minor version com‐
1461 ponent.
1462
1463 backtraceGraph
1464 JSON object representing backtrace information with the follow‐
1465 ing members:
1466
1467 commands
1468 List of command names.
1469
1470 files List of file names.
1471
1472 nodes List of node JSON objects with members:
1473
1474 command
1475 Index into the commands member of the backtrace‐
1476 Graph.
1477
1478 file Index into the files member of the backtraceGraph.
1479
1480 line Line number in the file where the backtrace was
1481 added.
1482
1483 parent Index into the nodes member of the backtraceGraph
1484 representing the parent in the graph.
1485
1486 tests A JSON array listing information about each test. Each entry is
1487 a JSON object with members:
1488
1489 name Test name.
1490
1491 config Configuration that the test can run on. Empty string
1492 means any config.
1493
1494 command
1495 List where the first element is the test command and the
1496 remaining elements are the command arguments.
1497
1498 backtrace
1499 Index into the nodes member of the backtraceGraph.
1500
1501 properties
1502 Test properties. Can contain keys for each of the sup‐
1503 ported test properties.
1504
1506 CTest provides a mechanism for tests to specify the resources that they
1507 need in a fine-grained way, and for users to specify the resources
1508 availiable on the running machine. This allows CTest to internally keep
1509 track of which resources are in use and which are free, scheduling
1510 tests in a way that prevents them from trying to claim resources that
1511 are not available.
1512
1513 When the resource allocation feature is used, CTest will not oversub‐
1514 scribe resources. For example, if a resource has 8 slots, CTest will
1515 not run tests that collectively use more than 8 slots at a time. This
1516 has the effect of limiting how many tests can run at any given time,
1517 even if a high -j argument is used, if those tests all use some slots
1518 from the same resource. In addition, it means that a single test that
1519 uses more of a resource than is available on a machine will not run at
1520 all (and will be reported as Not Run).
1521
1522 A common use case for this feature is for tests that require the use of
1523 a GPU. Multiple tests can simultaneously allocate memory from a GPU,
1524 but if too many tests try to do this at once, some of them will fail to
1525 allocate, resulting in a failed test, even though the test would have
1526 succeeded if it had the memory it needed. By using the resource alloca‐
1527 tion feature, each test can specify how much memory it requires from a
1528 GPU, allowing CTest to schedule tests in a way that running several of
1529 these tests at once does not exhaust the GPU’s memory pool.
1530
1531 Please note that CTest has no concept of what a GPU is or how much mem‐
1532 ory it has, nor does it have any way of communicating with a GPU to
1533 retrieve this information or perform any memory management. CTest sim‐
1534 ply keeps track of a list of abstract resource types, each of which has
1535 a certain number of slots available for tests to use. Each test speci‐
1536 fies the number of slots that it requires from a certain resource, and
1537 CTest then schedules them in a way that prevents the total number of
1538 slots in use from exceeding the listed capacity. When a test is exe‐
1539 cuted, and slots from a resource are allocated to that test, tests may
1540 assume that they have exclusive use of those slots for the duration of
1541 the test’s process.
1542
1543 The CTest resource allocation feature consists of two inputs:
1544
1545 · The resource specification file, described below, which describes the
1546 resources available on the system.
1547
1548 · The RESOURCE_GROUPS property of tests, which describes the resources
1549 required by the test.
1550
1551 When CTest runs a test, the resources allocated to that test are passed
1552 in the form of a set of environment variables as described below. Using
1553 this information to decide which resource to connect to is left to the
1554 test writer.
1555
1556 The RESOURCE_GROUPS property tells CTest what resources a test expects
1557 to use grouped in a way meaningful to the test. The test itself must
1558 read the environment variables to determine which resources have been
1559 allocated to each group. For example, each group may correspond to a
1560 process the test will spawn when executed.
1561
1562 Note that even if a test specifies a RESOURCE_GROUPS property, it is
1563 still possible for that to test to run without any resource allocation
1564 (and without the corresponding environment variables) if the user does
1565 not pass a resource specification file. Passing this file, either
1566 through the --resource-spec-file command-line argument or the
1567 RESOURCE_SPEC_FILE argument to ctest_test(), is what activates the
1568 resource allocation feature. Tests should check the
1569 CTEST_RESOURCE_GROUP_COUNT environment variable to find out whether or
1570 not resource allocation is activated. This variable will always (and
1571 only) be defined if resource allocation is activated. If resource allo‐
1572 cation is not activated, then the CTEST_RESOURCE_GROUP_COUNT variable
1573 will not exist, even if it exists for the parent ctest process. If a
1574 test absolutely must have resource allocation, then it can return a
1575 failing exit code or use the SKIP_RETURN_CODE or SKIP_REGULAR_EXPRES‐
1576 SION properties to indicate a skipped test.
1577
1578 Resource Specification File
1579 The resource specification file is a JSON file which is passed to
1580 CTest, either on the ctest(1) command line as --resource-spec-file, or
1581 as the RESOURCE_SPEC_FILE argument of ctest_test(). The resource speci‐
1582 fication file must be a JSON object. All examples in this document
1583 assume the following resource specification file:
1584
1585 {
1586 "version": {
1587 "major": 1,
1588 "minor": 0
1589 },
1590 "local": [
1591 {
1592 "gpus": [
1593 {
1594 "id": "0",
1595 "slots": 2
1596 },
1597 {
1598 "id": "1",
1599 "slots": 4
1600 },
1601 {
1602 "id": "2",
1603 "slots": 2
1604 },
1605 {
1606 "id": "3"
1607 }
1608 ],
1609 "crypto_chips": [
1610 {
1611 "id": "card0",
1612 "slots": 4
1613 }
1614 ]
1615 }
1616 ]
1617 }
1618
1619 The members are:
1620
1621 version
1622 An object containing a major integer field and a minor integer
1623 field. Currently, the only supported version is major 1, minor
1624 0. Any other value is an error.
1625
1626 local A JSON array of resource sets present on the system. Currently,
1627 this array is restricted to being of size 1.
1628
1629 Each array element is a JSON object with members whose names are
1630 equal to the desired resource types, such as gpus. These names
1631 must start with a lowercase letter or an underscore, and subse‐
1632 quent characters can be a lowercase letter, a digit, or an
1633 underscore. Uppercase letters are not allowed, because certain
1634 platforms have case-insensitive environment variables. See the
1635 Environment Variables section below for more information. It is
1636 recommended that the resource type name be the plural of a noun,
1637 such as gpus or crypto_chips (and not gpu or crypto_chip.)
1638
1639 Please note that the names gpus and crypto_chips are just exam‐
1640 ples, and CTest does not interpret them in any way. You are free
1641 to make up any resource type you want to meet your own require‐
1642 ments.
1643
1644 The value for each resource type is a JSON array consisting of
1645 JSON objects, each of which describe a specific instance of the
1646 specified resource. These objects have the following members:
1647
1648 id A string consisting of an identifier for the resource.
1649 Each character in the identifier can be a lowercase let‐
1650 ter, a digit, or an underscore. Uppercase letters are
1651 not allowed.
1652
1653 Identifiers must be unique within a resource type. How‐
1654 ever, they do not have to be unique across resource
1655 types. For example, it is valid to have a gpus resource
1656 named 0 and a crypto_chips resource named 0, but not two
1657 gpus resources both named 0.
1658
1659 Please note that the IDs 0, 1, 2, 3, and card0 are just
1660 examples, and CTest does not interpret them in any way.
1661 You are free to make up any IDs you want to meet your own
1662 requirements.
1663
1664 slots An optional unsigned number specifying the number of
1665 slots available on the resource. For example, this could
1666 be megabytes of RAM on a GPU, or cryptography units
1667 available on a cryptography chip. If slots is not speci‐
1668 fied, a default value of 1 is assumed.
1669
1670 In the example file above, there are four GPUs with ID’s 0 through 3.
1671 GPU 0 has 2 slots, GPU 1 has 4, GPU 2 has 2, and GPU 3 has a default of
1672 1 slot. There is also one cryptography chip with 4 slots.
1673
1674 RESOURCE_GROUPS Property
1675 See RESOURCE_GROUPS for a description of this property.
1676
1677 Environment Variables
1678 Once CTest has decided which resources to allocate to a test, it passes
1679 this information to the test executable as a series of environment
1680 variables. For each example below, we will assume that the test in
1681 question has a RESOURCE_GROUPS property of
1682 2,gpus:2;gpus:4,gpus:1,crypto_chips:2.
1683
1684 The following variables are passed to the test process:
1685
1686 CTEST_RESOURCE_GROUP_COUNT
1687 The total number of groups specified by the RESOURCE_GROUPS
1688 property. For example:
1689
1690 · CTEST_RESOURCE_GROUP_COUNT=3
1691
1692 This variable will only be defined if ctest(1) has been given a
1693 --resource-spec-file, or if ctest_test() has been given a
1694 RESOURCE_SPEC_FILE. If no resource specification file has been
1695 given, this variable will not be defined.
1696
1697 CTEST_RESOURCE_GROUP_<num>
1698 The list of resource types allocated to each group, with each
1699 item separated by a comma. <num> is a number from zero to
1700 CTEST_RESOURCE_GROUP_COUNT minus one. CTEST_RESOURCE_GROUP_<num>
1701 is defined for each <num> in this range. For example:
1702
1703 · CTEST_RESOURCE_GROUP_0=gpus
1704
1705 · CTEST_RESOURCE_GROUP_1=gpus
1706
1707 · CTEST_RESOURCE_GROUP_2=crypto_chips,gpus
1708
1709 CTEST_RESOURCE_GROUP_<num>_<resource-type>
1710 The list of resource IDs and number of slots from each ID allo‐
1711 cated to each group for a given resource type. This variable
1712 consists of a series of pairs, each pair separated by a semi‐
1713 colon, and with the two items in the pair separated by a comma.
1714 The first item in each pair is id: followed by the ID of a
1715 resource of type <resource-type>, and the second item is slots:
1716 followed by the number of slots from that resource allocated to
1717 the given group. For example:
1718
1719 · CTEST_RESOURCE_GROUP_0_GPUS=id:0,slots:2
1720
1721 · CTEST_RESOURCE_GROUP_1_GPUS=id:2,slots:2
1722
1723 · CTEST_RESOURCE_GROUP_2_GPUS=id:1,slots:4;id:3,slots:1
1724
1725 · CTEST_RESOURCE_GROUP_2_CRYPTO_CHIPS=id:card0,slots:2
1726
1727 In this example, group 0 gets 2 slots from GPU 0, group 1 gets 2
1728 slots from GPU 2, and group 2 gets 4 slots from GPU 1, 1 slot
1729 from GPU 3, and 2 slots from cryptography chip card0.
1730
1731 <num> is a number from zero to CTEST_RESOURCE_GROUP_COUNT minus
1732 one. <resource-type> is the name of a resource type, converted
1733 to uppercase. CTEST_RESOURCE_GROUP_<num>_<resource-type> is
1734 defined for the product of each <num> in the range listed above
1735 and each resource type listed in CTEST_RESOURCE_GROUP_<num>.
1736
1737 Because some platforms have case-insensitive names for environ‐
1738 ment variables, the names of resource types may not clash in a
1739 case-insensitive environment. Because of this, for the sake of
1740 simplicity, all resource types must be listed in all lowercase
1741 in the resource specification file and in the RESOURCE_GROUPS
1742 property, and they are converted to all uppercase in the
1743 CTEST_RESOURCE_GROUP_<num>_<resource-type> environment variable.
1744
1746 The following resources are available to get help using CMake:
1747
1748 Home Page
1749 https://cmake.org
1750
1751 The primary starting point for learning about CMake.
1752
1753 Online Documentation and Community Resources
1754 https://cmake.org/documentation
1755
1756 Links to available documentation and community resources may be
1757 found on this web page.
1758
1759 Discourse Forum
1760 https://discourse.cmake.org
1761
1762 The Discourse Forum hosts discussion and questions about CMake.
1763
1765 2000-2020 Kitware, Inc. and Contributors
1766
1767
1768
1769
17703.17.2 Apr 28, 2020 CTEST(1)