1CTEST(1)                             CMake                            CTEST(1)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

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

OPTIONS

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-until-fail <n>
311              Require  each  test to run <n> times without failing in order to
312              pass.
313
314              This is useful in finding sporadic failures in test cases.
315
316       --max-width <width>
317              Set the max width for a test name to output.
318
319              Set the maximum width for each test name to show in the  output.
320              This  allows  the user to widen the output to avoid clipping the
321              test name which can be very annoying.
322
323       --interactive-debug-mode [0|1]
324              Set the interactive mode to 0 or 1.
325
326              This option causes CTest to run tests in either  an  interactive
327              mode  or  a non-interactive mode.  On Windows this means that in
328              non-interactive mode,  all  system  debug  pop  up  windows  are
329              blocked.  In dashboard mode (Experimental, Nightly, Continuous),
330              the default is non-interactive.  When just running tests not for
331              a  dashboard  the  default  is  to  allow popups and interactive
332              debugging.
333
334       --no-label-summary
335              Disable timing summary information for labels.
336
337              This option tells CTest not to  print  summary  information  for
338              each  label  associated  with  the  tests  run.  If there are no
339              labels on the tests, nothing extra is printed.
340
341              See Label and Subproject Summary.
342
343       --no-subproject-summary
344              Disable timing summary information for subprojects.
345
346              This option tells CTest not to  print  summary  information  for
347              each  subproject associated with the tests run.  If there are no
348              subprojects on the tests, nothing extra is printed.
349
350              See Label and Subproject Summary.
351
352       --build-and-test See Build and Test Mode.
353
354       --test-output-size-passed <size>
355              Limit the output for passed tests to <size> bytes.
356
357       --test-output-size-failed <size>
358              Limit the output for failed tests to <size> bytes.
359
360       --overwrite
361              Overwrite CTest configuration option.
362
363              By default CTest uses configuration options  from  configuration
364              file.  This option will overwrite the configuration option.
365
366       --force-new-ctest-process
367              Run child CTest instances as new processes.
368
369              By  default CTest will run child CTest instances within the same
370              process.  If this behavior is not desired,  this  argument  will
371              enforce new processes for child CTest processes.
372
373       --schedule-random
374              Use a random order for scheduling tests.
375
376              This  option  will  run the tests in a random order.  It is com‐
377              monly used to detect implicit dependencies in a test suite.
378
379       --submit-index
380              Legacy option for old Dart2 dashboard server  feature.   Do  not
381              use.
382
383       --timeout <seconds>
384              Set the default test timeout.
385
386              This  option effectively sets a timeout on all tests that do not
387              already have a timeout set on them via the TIMEOUT property.
388
389       --stop-time <time>
390              Set a time at which all tests should stop running.
391
392              Set a real time of day at which all tests should timeout.  Exam‐
393              ple: 7:00:00 -0400.  Any time format understood by the curl date
394              parser is accepted.  Local time is assumed  if  no  timezone  is
395              specified.
396
397       --print-labels
398              Print all available test labels.
399
400              This  option  will  not  run any tests, it will simply print the
401              list of all labels associated with the test set.
402
403       --help,-help,-usage,-h,-H,/?
404              Print usage information and exit.
405
406              Usage  describes  the  basic  command  line  interface  and  its
407              options.
408
409       --version,-version,/V [<f>]
410              Show program name/version banner and exit.
411
412              If  a  file  is  specified, the version is written into it.  The
413              help is printed to a named <f>ile if given.
414
415       --help-full [<f>]
416              Print all help manuals and exit.
417
418              All manuals are printed in a human-readable  text  format.   The
419              help is printed to a named <f>ile if given.
420
421       --help-manual <man> [<f>]
422              Print one help manual and exit.
423
424              The specified manual is printed in a human-readable text format.
425              The help is printed to a named <f>ile if given.
426
427       --help-manual-list [<f>]
428              List help manuals available and exit.
429
430              The list contains all manuals for which help may be obtained  by
431              using  the  --help-manual option followed by a manual name.  The
432              help is printed to a named <f>ile if given.
433
434       --help-command <cmd> [<f>]
435              Print help for one command and exit.
436
437              The cmake-commands(7) manual entry for <cmd>  is  printed  in  a
438              human-readable  text  format.   The  help  is printed to a named
439              <f>ile if given.
440
441       --help-command-list [<f>]
442              List commands with help available and exit.
443
444              The list contains all commands for which help may be obtained by
445              using the --help-command option followed by a command name.  The
446              help is printed to a named <f>ile if given.
447
448       --help-commands [<f>]
449              Print cmake-commands manual and exit.
450
451              The cmake-commands(7) manual is printed in a human-readable text
452              format.  The help is printed to a named <f>ile if given.
453
454       --help-module <mod> [<f>]
455              Print help for one module and exit.
456
457              The  cmake-modules(7)  manual  entry  for  <mod> is printed in a
458              human-readable text format.  The help  is  printed  to  a  named
459              <f>ile if given.
460
461       --help-module-list [<f>]
462              List modules with help available and exit.
463
464              The  list contains all modules for which help may be obtained by
465              using the --help-module option followed by a module  name.   The
466              help is printed to a named <f>ile if given.
467
468       --help-modules [<f>]
469              Print cmake-modules manual and exit.
470
471              The  cmake-modules(7) manual is printed in a human-readable text
472              format.  The help is printed to a named <f>ile if given.
473
474       --help-policy <cmp> [<f>]
475              Print help for one policy and exit.
476
477              The cmake-policies(7) manual entry for <cmp>  is  printed  in  a
478              human-readable  text  format.   The  help  is printed to a named
479              <f>ile if given.
480
481       --help-policy-list [<f>]
482              List policies with help available and exit.
483
484              The list contains all policies for which help may be obtained by
485              using  the  --help-policy option followed by a policy name.  The
486              help is printed to a named <f>ile if given.
487
488       --help-policies [<f>]
489              Print cmake-policies manual and exit.
490
491              The cmake-policies(7) manual is printed in a human-readable text
492              format.  The help is printed to a named <f>ile if given.
493
494       --help-property <prop> [<f>]
495              Print help for one property and exit.
496
497              The cmake-properties(7) manual entries for <prop> are printed in
498              a human-readable text format.  The help is printed  to  a  named
499              <f>ile if given.
500
501       --help-property-list [<f>]
502              List properties with help available and exit.
503
504              The  list contains all properties for which help may be obtained
505              by using the --help-property option followed by a property name.
506              The help is printed to a named <f>ile if given.
507
508       --help-properties [<f>]
509              Print cmake-properties manual and exit.
510
511              The  cmake-properties(7)  manual  is printed in a human-readable
512              text format.  The help is printed to a named <f>ile if given.
513
514       --help-variable <var> [<f>]
515              Print help for one variable and exit.
516
517              The cmake-variables(7) manual entry for <var> is  printed  in  a
518              human-readable  text  format.   The  help  is printed to a named
519              <f>ile if given.
520
521       --help-variable-list [<f>]
522              List variables with help available and exit.
523
524              The list contains all variables for which help may  be  obtained
525              by using the --help-variable option followed by a variable name.
526              The help is printed to a named <f>ile if given.
527
528       --help-variables [<f>]
529              Print cmake-variables manual and exit.
530
531              The cmake-variables(7) manual is  printed  in  a  human-readable
532              text format.  The help is printed to a named <f>ile if given.
533

LABEL AND SUBPROJECT SUMMARY

535       CTest  prints  timing summary information for each LABEL and subproject
536       associated with the tests run. The label time summary will not  include
537       labels that are mapped to subprojects.
538
539       When the PROCESSORS test property is set, CTest will display a weighted
540       test timing result in label  and  subproject  summaries.  The  time  is
541       reported with sec*proc instead of just sec.
542
543       The  weighted  time  summary reported for each label or subproject j is
544       computed as:
545
546          Weighted Time Summary for Label/Subproject j =
547              sum(raw_test_time[j,i] * num_processors[j,i], i=1...num_tests[j])
548
549          for labels/subprojects j=1...total
550
551       where:
552
553       · raw_test_time[j,i]: Wall-clock time for the i test for the j label or
554         subproject
555
556       · num_processors[j,i]: Value of the CTest PROCESSORS property for the i
557         test for the j label or subproject
558
559       · num_tests[j]: Number of tests associated with the j label or  subpro‐
560         ject
561
562       · total:  Total  number of labels or subprojects that have at least one
563         test run
564
565       Therefore, the weighted time summary for each label or subproject  rep‐
566       resents  the  amount  of time that CTest gave to run the tests for each
567       label or subproject and  gives  a  good  representation  of  the  total
568       expense  of  the  tests  for  each label or subproject when compared to
569       other labels or subprojects.
570
571       For example, if SubprojectA showed 100 sec*proc and SubprojectB  showed
572       10  sec*proc,  then CTest allocated approximately 10 times the CPU/core
573       time to run the tests for SubprojectA than for SubprojectB (e.g. so  if
574       effort is going to be expended to reduce the cost of the test suite for
575       the whole project, then reducing the cost of the test suite for Subpro‐
576       jectA  would likely have a larger impact than effort to reduce the cost
577       of the test suite for SubprojectB).
578

BUILD AND TEST MODE

580       CTest provides a command-line signature to configure  (i.e.  run  cmake
581       on), build, and/or execute a test:
582
583          ctest --build-and-test <path-to-source> <path-to-build>
584                --build-generator <generator>
585                [<options>...]
586                [--build-options <opts>...]
587                [--test-command <command> [<args>...]]
588
589       The  configure  and test steps are optional. The arguments to this com‐
590       mand line are the source and binary directories.  The --build-generator
591       option  must be provided to use --build-and-test.  If --test-command is
592       specified then that will be run after the  build  is  complete.   Other
593       options that affect this mode include:
594
595       --build-target
596              Specify a specific target to build.
597
598              If left out the all target is built.
599
600       --build-nocmake
601              Run the build without running cmake first.
602
603              Skip the cmake step.
604
605       --build-run-dir
606              Specify directory to run programs from.
607
608              Directory where programs will be after it has been compiled.
609
610       --build-two-config
611              Run CMake twice.
612
613       --build-exe-dir
614              Specify the directory for the executable.
615
616       --build-generator
617              Specify  the  generator to use. See the cmake-generators(7) man‐
618              ual.
619
620       --build-generator-platform
621              Specify the generator-specific platform.
622
623       --build-generator-toolset
624              Specify the generator-specific toolset.
625
626       --build-project
627              Specify the name of the project to build.
628
629       --build-makeprogram
630              Specify the explicit make program to be used by CMake when  con‐
631              figuring  and building the project. Only applicable for Make and
632              Ninja based generators.
633
634       --build-noclean
635              Skip the make clean step.
636
637       --build-config-sample
638              A sample executable to use to determine the  configuration  that
639              should be used.  e.g.  Debug, Release etc.
640
641       --build-options
642              Additional  options  for  configuring the build (i.e. for CMake,
643              not for the build tool).  Note that if this  is  specified,  the
644              --build-options  keyword  and  its  arguments  must  be the last
645              option given on the command line, with the possible exception of
646              --test-command.
647
648       --test-command
649              The  command  to  run as the test step with the --build-and-test
650              option.  All arguments following this keyword will be assumed to
651              be  part of the test command line, so it must be the last option
652              given.
653
654       --test-timeout
655              The time limit in seconds
656

DASHBOARD CLIENT

658       CTest can operate as a client for the CDash software quality  dashboard
659       application.  As a dashboard client, CTest performs a sequence of steps
660       to configure, build, and test software, and then submits the results to
661       a CDash server. The command-line signature used to submit to CDash is:
662
663          ctest (-D <dashboard> | -M <model> -T <action> | -S <script> | -SP <script>)
664                [-- <dashboard-options>...]
665
666       Options for Dashboard Client include:
667
668       --group <group>
669              Specify what group you’d like to submit results to
670
671              Submit  dashboard to specified group instead of default one.  By
672              default, the dashboard is submitted to Nightly, Experimental, or
673              Continuous  group,  but by specifying this option, the group can
674              be arbitrary.
675
676              This replaces the deprecated option --track.  Despite  the  name
677              change its behavior is unchanged.
678
679       -A <file>, --add-notes <file>
680              Add a notes file with submission.
681
682              This  option tells CTest to include a notes file when submitting
683              dashboard.
684
685       --tomorrow-tag
686              Nightly or Experimental starts with next day tag.
687
688              This is useful if the build will not finish in one day.
689
690       --extra-submit <file>[;<file>]
691              Submit extra files to the dashboard.
692
693              This option will submit extra files to the dashboard.
694
695       --http1.0
696              Submit using HTTP 1.0.
697
698              This option will force CTest to use HTTP 1.0 to submit files  to
699              the dashboard, instead of HTTP 1.1.
700
701       --no-compress-output
702              Do not compress test output when submitting.
703
704              This  flag  will  turn off automatic compression of test output.
705              Use this to maintain compatibility  with  an  older  version  of
706              CDash which doesn’t support compressed test output.
707
708   Dashboard Client Steps
709       CTest defines an ordered list of testing steps of which some or all may
710       be run as a dashboard client:
711
712       Start  Start a new dashboard  submission  to  be  composed  of  results
713              recorded  by the following steps.  See the CTest Start Step sec‐
714              tion below.
715
716       Update Update the source tree  from  its  version  control  repository.
717              Record  the  old and new versions and the list of updated source
718              files.  See the CTest Update Step section below.
719
720       Configure
721              Configure the software by running a command in the  build  tree.
722              Record  the  configuration  output log.  See the CTest Configure
723              Step section below.
724
725       Build  Build the software by running  a  command  in  the  build  tree.
726              Record the build output log and detect warnings and errors.  See
727              the CTest Build Step section below.
728
729       Test   Test the software by  loading  a  CTestTestfile.cmake  from  the
730              build  tree  and executing the defined tests.  Record the output
731              and result of each test.  See the CTest Test Step section below.
732
733       Coverage
734              Compute coverage of the source code by running a coverage analy‐
735              sis  tool and recording its output.  See the CTest Coverage Step
736              section below.
737
738       MemCheck
739              Run the software test suite through a memory check tool.  Record
740              the  test output, results, and issues reported by the tool.  See
741              the CTest MemCheck Step section below.
742
743       Submit Submit results recorded from other testing steps to the software
744              quality  dashboard  server.   See  the CTest Submit Step section
745              below.
746
747   Dashboard Client Modes
748       CTest defines three modes of operation as a dashboard client:
749
750       Nightly
751              This mode is intended to be invoked once per day,  typically  at
752              night.   It  enables  the Start, Update, Configure, Build, Test,
753              Coverage, and Submit steps by default.  Selected steps run  even
754              if the Update step reports no changes to the source tree.
755
756       Continuous
757              This  mode  is  intended to be invoked repeatedly throughout the
758              day.  It enables the Start, Update, Configure, Build, Test, Cov‐
759              erage,  and  Submit steps by default, but exits after the Update
760              step if it reports no changes to the source tree.
761
762       Experimental
763              This mode is intended to be invoked by a developer to test local
764              changes.   It  enables the Start, Configure, Build, Test, Cover‐
765              age, and Submit steps by default.
766
767   Dashboard Client via CTest Command-Line
768       CTest can perform testing on an already-generated build tree.  Run  the
769       ctest  command with the current working directory set to the build tree
770       and use one of these signatures:
771
772          ctest -D <mode>[<step>]
773          ctest -M <mode> [ -T <step> ]...
774
775       The <mode> must be one of the above Dashboard Client  Modes,  and  each
776       <step> must be one of the above Dashboard Client Steps.
777
778       CTest  reads the Dashboard Client Configuration settings from a file in
779       the build tree called either CTestConfiguration.ini  or  DartConfigura‐
780       tion.tcl (the names are historical).  The format of the file is:
781
782          # Lines starting in '#' are comments.
783          # Other non-blank lines are key-value pairs.
784          <setting>: <value>
785
786       where <setting> is the setting name and <value> is the setting value.
787
788       In build trees generated by CMake, this configuration file is generated
789       by the CTest module if included by the project.  The module uses  vari‐
790       ables  to  obtain  a value for each setting as documented with the set‐
791       tings below.
792
793   Dashboard Client via CTest Script
794       CTest can perform testing driven by  a  cmake-language(7)  script  that
795       creates  and  maintains the source and build tree as well as performing
796       the testing steps.  Run the ctest  command  with  the  current  working
797       directory  set  outside  of  any build tree and use one of these signa‐
798       tures:
799
800          ctest -S <script>
801          ctest -SP <script>
802
803       The <script> file must call CTest  Commands  commands  to  run  testing
804       steps  explicitly  as  documented below.  The commands obtain Dashboard
805       Client Configuration settings from their arguments  or  from  variables
806       set in the script.
807

DASHBOARD CLIENT CONFIGURATION

809       The Dashboard Client Steps may be configured by named settings as docu‐
810       mented in the following sections.
811
812   CTest Start Step
813       Start a new dashboard submission to be composed of results recorded  by
814       the following steps.
815
816       In a CTest Script, the ctest_start() command runs this step.  Arguments
817       to the command may specify some of  the  step  settings.   The  command
818       first  runs  the  command-line  specified by the CTEST_CHECKOUT_COMMAND
819       variable, if set, to initialize the source directory.
820
821       Configuration settings include:
822
823       BuildDirectory
824              The full path to the project build tree.
825
826              · CTest Script variable: CTEST_BINARY_DIRECTORY
827
828              · CTest module variable: PROJECT_BINARY_DIR
829
830       SourceDirectory
831              The full path to the project source tree.
832
833              · CTest Script variable: CTEST_SOURCE_DIRECTORY
834
835              · CTest module variable: PROJECT_SOURCE_DIR
836
837   CTest Update Step
838       In a CTest Script, the ctest_update() command runs  this  step.   Argu‐
839       ments to the command may specify some of the step settings.
840
841       Configuration settings to specify the version control tool include:
842
843       BZRCommand
844              bzr  command-line  tool  to  use  if  source  tree is managed by
845              Bazaar.
846
847              · CTest Script variable: CTEST_BZR_COMMAND
848
849              · CTest module variable: none
850
851       BZRUpdateOptions
852              Command-line options to the BZRCommand when updating the source.
853
854              · CTest Script variable: CTEST_BZR_UPDATE_OPTIONS
855
856              · CTest module variable: none
857
858       CVSCommand
859              cvs command-line tool to use if source tree is managed by CVS.
860
861              · CTest Script variable: CTEST_CVS_COMMAND
862
863              · CTest module variable: CVSCOMMAND
864
865       CVSUpdateOptions
866              Command-line options to the CVSCommand when updating the source.
867
868              · CTest Script variable: CTEST_CVS_UPDATE_OPTIONS
869
870              · CTest module variable: CVS_UPDATE_OPTIONS
871
872       GITCommand
873              git command-line tool to use if source tree is managed by Git.
874
875              · CTest Script variable: CTEST_GIT_COMMAND
876
877              · CTest module variable: GITCOMMAND
878
879              The source tree is updated by git fetch followed  by  git  reset
880              --hard  to  the  FETCH_HEAD.  The result is the same as git pull
881              except that any local modifications are overwritten.  Use GITUp‐
882              dateCustom to specify a different approach.
883
884       GITInitSubmodules
885              If  set,  CTest  will  update the repository’s submodules before
886              updating.
887
888              · CTest Script variable: CTEST_GIT_INIT_SUBMODULES
889
890              · CTest module variable: CTEST_GIT_INIT_SUBMODULES
891
892       GITUpdateCustom
893              Specify a custom command line (as a semicolon-separated list) to
894              run  in  the source tree (Git work tree) to update it instead of
895              running the GITCommand.
896
897              · CTest Script variable: CTEST_GIT_UPDATE_CUSTOM
898
899              · CTest module variable: CTEST_GIT_UPDATE_CUSTOM
900
901       GITUpdateOptions
902              Command-line options to the GITCommand when updating the source.
903
904              · CTest Script variable: CTEST_GIT_UPDATE_OPTIONS
905
906              · CTest module variable: GIT_UPDATE_OPTIONS
907
908       HGCommand
909              hg command-line tool to use if source tree is managed by  Mercu‐
910              rial.
911
912              · CTest Script variable: CTEST_HG_COMMAND
913
914              · CTest module variable: none
915
916       HGUpdateOptions
917              Command-line options to the HGCommand when updating the source.
918
919              · CTest Script variable: CTEST_HG_UPDATE_OPTIONS
920
921              · CTest module variable: none
922
923       P4Client
924              Value of the -c option to the P4Command.
925
926              · CTest Script variable: CTEST_P4_CLIENT
927
928              · CTest module variable: CTEST_P4_CLIENT
929
930       P4Command
931              p4  command-line  tool  to use if source tree is managed by Per‐
932              force.
933
934              · CTest Script variable: CTEST_P4_COMMAND
935
936              · CTest module variable: P4COMMAND
937
938       P4Options
939              Command-line options to the P4Command for all invocations.
940
941              · CTest Script variable: CTEST_P4_OPTIONS
942
943              · CTest module variable: CTEST_P4_OPTIONS
944
945       P4UpdateCustom
946              Specify a custom command line (as a semicolon-separated list) to
947              run  in  the source tree (Perforce tree) to update it instead of
948              running the P4Command.
949
950              · CTest Script variable: none
951
952              · CTest module variable: CTEST_P4_UPDATE_CUSTOM
953
954       P4UpdateOptions
955              Command-line options to the P4Command when updating the source.
956
957              · CTest Script variable: CTEST_P4_UPDATE_OPTIONS
958
959              · CTest module variable: CTEST_P4_UPDATE_OPTIONS
960
961       SVNCommand
962              svn command-line tool to use if source tree is managed  by  Sub‐
963              version.
964
965              · CTest Script variable: CTEST_SVN_COMMAND
966
967              · CTest module variable: SVNCOMMAND
968
969       SVNOptions
970              Command-line options to the SVNCommand for all invocations.
971
972              · CTest Script variable: CTEST_SVN_OPTIONS
973
974              · CTest module variable: CTEST_SVN_OPTIONS
975
976       SVNUpdateOptions
977              Command-line options to the SVNCommand when updating the source.
978
979              · CTest Script variable: CTEST_SVN_UPDATE_OPTIONS
980
981              · CTest module variable: SVN_UPDATE_OPTIONS
982
983       UpdateCommand
984              Specify  the  version-control  command-line  tool to use without
985              detecting the VCS that manages the source tree.
986
987              · CTest Script variable: CTEST_UPDATE_COMMAND
988
989              · CTest module variable: <VCS>COMMAND when UPDATE_TYPE is <vcs>,
990                else UPDATE_COMMAND
991
992       UpdateOptions
993              Command-line options to the UpdateCommand.
994
995              · CTest Script variable: CTEST_UPDATE_OPTIONS
996
997              · CTest  module  variable: <VCS>_UPDATE_OPTIONS when UPDATE_TYPE
998                is <vcs>, else UPDATE_OPTIONS
999
1000       UpdateType
1001              Specify the version-control system that manages the source  tree
1002              if  it  cannot be detected automatically.  The value may be bzr,
1003              cvs, git, hg, p4, or svn.
1004
1005              · CTest Script variable: none, detected from source tree
1006
1007              · CTest   module   variable:   UPDATE_TYPE    if    set,    else
1008                CTEST_UPDATE_TYPE
1009
1010       UpdateVersionOnly
1011              Specify that you want the version control update command to only
1012              discover the current version that is checked  out,  and  not  to
1013              update to a different version.
1014
1015              · CTest Script variable: CTEST_UPDATE_VERSION_ONLY
1016
1017       UpdateVersionOverride
1018              Specify the current version of your source tree.
1019
1020              When  this  variable  is  set  to a non-empty string, CTest will
1021              report the value you specified rather than using the update com‐
1022              mand to discover the current version that is checked out. Use of
1023              this  variable  supersedes  UpdateVersionOnly.  Like  UpdateVer‐
1024              sionOnly,  using  this  variable  tells  CTest not to update the
1025              source tree to a different version.
1026
1027              · CTest Script variable: CTEST_UPDATE_VERSION_OVERRIDE
1028
1029       Additional configuration settings include:
1030
1031       NightlyStartTime
1032              In the Nightly dashboard mode, specify the “nightly start time”.
1033              With  centralized  version  control  systems  (cvs and svn), the
1034              Update step checks out the version of the software  as  of  this
1035              time  so  that multiple clients choose a common version to test.
1036              This is not well-defined in distributed version-control  systems
1037              so the setting is ignored.
1038
1039              · CTest Script variable: CTEST_NIGHTLY_START_TIME
1040
1041              · CTest   module   variable:  NIGHTLY_START_TIME  if  set,  else
1042                CTEST_NIGHTLY_START_TIME
1043
1044   CTest Configure Step
1045       In a CTest Script, the ctest_configure() command runs this step.  Argu‐
1046       ments to the command may specify some of the step settings.
1047
1048       Configuration settings include:
1049
1050       ConfigureCommand
1051              Command-line  to  launch the software configuration process.  It
1052              will be executed in the location specified by the BuildDirectory
1053              setting.
1054
1055              · CTest Script variable: CTEST_CONFIGURE_COMMAND
1056
1057              · CTest    module    variable:    CMAKE_COMMAND    followed   by
1058                PROJECT_SOURCE_DIR
1059
1060       LabelsForSubprojects
1061              Specify a  semicolon-separated  list  of  labels  that  will  be
1062              treated  as subprojects. This mapping will be passed on to CDash
1063              when configure, test or build results are submitted.
1064
1065              · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1066
1067              · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1068
1069              See Label and Subproject Summary.
1070
1071   CTest Build Step
1072       In a CTest Script, the ctest_build() command runs this step.  Arguments
1073       to the command may specify some of the step settings.
1074
1075       Configuration settings include:
1076
1077       DefaultCTestConfigurationType
1078              When the build system to be launched allows build-time selection
1079              of the configuration (e.g. Debug, Release), this  specifies  the
1080              default  configuration to be built when no -C option is given to
1081              the ctest command.  The value will be substituted into the value
1082              of  MakeCommand to replace the literal string ${CTEST_CONFIGURA‐
1083              TION_TYPE} if it appears.
1084
1085              · CTest Script variable: CTEST_CONFIGURATION_TYPE
1086
1087              · CTest module variable: DEFAULT_CTEST_CONFIGURATION_TYPE,  ini‐
1088                tialized by the CMAKE_CONFIG_TYPE environment variable
1089
1090       LabelsForSubprojects
1091              Specify  a  semicolon-separated  list  of  labels  that  will be
1092              treated as subprojects. This mapping will be passed on to  CDash
1093              when configure, test or build results are submitted.
1094
1095              · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1096
1097              · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1098
1099              See Label and Subproject Summary.
1100
1101       MakeCommand
1102              Command-line  to  launch the software build process.  It will be
1103              executed in the location specified by  the  BuildDirectory  set‐
1104              ting.
1105
1106              · CTest Script variable: CTEST_BUILD_COMMAND
1107
1108              · CTest   module   variable:  MAKECOMMAND,  initialized  by  the
1109                build_command() command
1110
1111       UseLaunchers
1112              For build trees generated by CMake using  one  of  the  Makefile
1113              Generators   or   the   Ninja  generator,  specify  whether  the
1114              CTEST_USE_LAUNCHERS feature is enabled by the  CTestUseLaunchers
1115              module  (also  included by the CTest module).  When enabled, the
1116              generated build system wraps each invocation  of  the  compiler,
1117              linker,  or  custom command line with a “launcher” that communi‐
1118              cates with CTest via environment variables and files  to  report
1119              granular  build warning and error information.  Otherwise, CTest
1120              must “scrape” the build output log for diagnostics.
1121
1122              · CTest Script variable: CTEST_USE_LAUNCHERS
1123
1124              · CTest module variable: CTEST_USE_LAUNCHERS
1125
1126   CTest Test Step
1127       In a CTest Script, the ctest_test() command runs this step.   Arguments
1128       to the command may specify some of the step settings.
1129
1130       Configuration settings include:
1131
1132       ResourceSpecFile
1133              Specify  a  resource specification file. See Resource Allocation
1134              for more information.
1135
1136       LabelsForSubprojects
1137              Specify a  semicolon-separated  list  of  labels  that  will  be
1138              treated  as subprojects. This mapping will be passed on to CDash
1139              when configure, test or build results are submitted.
1140
1141              · CTest Script variable: CTEST_LABELS_FOR_SUBPROJECTS
1142
1143              · CTest module variable: CTEST_LABELS_FOR_SUBPROJECTS
1144
1145              See Label and Subproject Summary.
1146
1147       TestLoad
1148              While running tests in parallel (e.g. with -j), try not to start
1149              tests  when  they  may  cause the CPU load to pass above a given
1150              threshold.
1151
1152              · CTest Script variable: CTEST_TEST_LOAD
1153
1154              · CTest module variable: CTEST_TEST_LOAD
1155
1156       TimeOut
1157              The default timeout for each test if not specified by the  TIME‐
1158              OUT test property.
1159
1160              · CTest Script variable: CTEST_TEST_TIMEOUT
1161
1162              · CTest module variable: DART_TESTING_TIMEOUT
1163
1164   CTest Coverage Step
1165       In  a CTest Script, the ctest_coverage() command runs this step.  Argu‐
1166       ments to the command may specify some of the step settings.
1167
1168       Configuration settings include:
1169
1170       CoverageCommand
1171              Command-line tool to perform  software  coverage  analysis.   It
1172              will be executed in the location specified by the BuildDirectory
1173              setting.
1174
1175              · CTest Script variable: CTEST_COVERAGE_COMMAND
1176
1177              · CTest module variable: COVERAGE_COMMAND
1178
1179       CoverageExtraFlags
1180              Specify command-line options to the CoverageCommand tool.
1181
1182              · CTest Script variable: CTEST_COVERAGE_EXTRA_FLAGS
1183
1184              · CTest module variable: COVERAGE_EXTRA_FLAGS
1185
1186              These options are the first arguments passed to CoverageCommand.
1187
1188   CTest MemCheck Step
1189       In a CTest Script, the ctest_memcheck() command runs this step.   Argu‐
1190       ments to the command may specify some of the step settings.
1191
1192       Configuration settings include:
1193
1194       MemoryCheckCommand
1195              Command-line  tool  to  perform  dynamic analysis.  Test command
1196              lines will be launched through this tool.
1197
1198              · CTest Script variable: CTEST_MEMORYCHECK_COMMAND
1199
1200              · CTest module variable: MEMORYCHECK_COMMAND
1201
1202       MemoryCheckCommandOptions
1203              Specify command-line options  to  the  MemoryCheckCommand  tool.
1204              They will be placed prior to the test command line.
1205
1206              · CTest Script variable: CTEST_MEMORYCHECK_COMMAND_OPTIONS
1207
1208              · CTest module variable: MEMORYCHECK_COMMAND_OPTIONS
1209
1210       MemoryCheckType
1211              Specify the type of memory checking to perform.
1212
1213              · CTest Script variable: CTEST_MEMORYCHECK_TYPE
1214
1215              · CTest module variable: MEMORYCHECK_TYPE
1216
1217       MemoryCheckSanitizerOptions
1218              Specify   options  to  sanitizers  when  running  with  a  sani‐
1219              tize-enabled build.
1220
1221              · CTest Script variable: CTEST_MEMORYCHECK_SANITIZER_OPTIONS
1222
1223              · CTest module variable: MEMORYCHECK_SANITIZER_OPTIONS
1224
1225       MemoryCheckSuppressionFile
1226              Specify a file containing suppression rules for the MemoryCheck‐
1227              Command tool.  It will be passed with options appropriate to the
1228              tool.
1229
1230              · CTest Script variable: CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
1231
1232              · CTest module variable: MEMORYCHECK_SUPPRESSIONS_FILE
1233
1234       Additional configuration settings include:
1235
1236       BoundsCheckerCommand
1237              Specify a MemoryCheckCommand that is known  to  be  command-line
1238              compatible with Bounds Checker.
1239
1240              · CTest Script variable: none
1241
1242              · CTest module variable: none
1243
1244       PurifyCommand
1245              Specify  a  MemoryCheckCommand  that is known to be command-line
1246              compatible with Purify.
1247
1248              · CTest Script variable: none
1249
1250              · CTest module variable: PURIFYCOMMAND
1251
1252       ValgrindCommand
1253              Specify a MemoryCheckCommand that is known  to  be  command-line
1254              compatible with Valgrind.
1255
1256              · CTest Script variable: none
1257
1258              · CTest module variable: VALGRIND_COMMAND
1259
1260       ValgrindCommandOptions
1261              Specify  command-line options to the ValgrindCommand tool.  They
1262              will be placed prior to the test command line.
1263
1264              · CTest Script variable: none
1265
1266              · CTest module variable: VALGRIND_COMMAND_OPTIONS
1267
1268   CTest Submit Step
1269       In a CTest Script, the ctest_submit() command runs  this  step.   Argu‐
1270       ments to the command may specify some of the step settings.
1271
1272       Configuration settings include:
1273
1274       BuildName
1275              Describe  the  dashboard  client  platform  with a short string.
1276              (Operating system, compiler, etc.)
1277
1278              · CTest Script variable: CTEST_BUILD_NAME
1279
1280              · CTest module variable: BUILDNAME
1281
1282       CDashVersion
1283              Legacy option.  Not used.
1284
1285              · CTest Script variable: none, detected from server
1286
1287              · CTest module variable: CTEST_CDASH_VERSION
1288
1289       CTestSubmitRetryCount
1290              Specify a number of attempts  to  retry  submission  on  network
1291              failure.
1292
1293              · CTest   Script   variable:   none,   use   the  ctest_submit()
1294                RETRY_COUNT option.
1295
1296              · CTest module variable: CTEST_SUBMIT_RETRY_COUNT
1297
1298       CTestSubmitRetryDelay
1299              Specify a delay before retrying submission on network failure.
1300
1301              · CTest  Script   variable:   none,   use   the   ctest_submit()
1302                RETRY_DELAY option.
1303
1304              · CTest module variable: CTEST_SUBMIT_RETRY_DELAY
1305
1306       CurlOptions
1307              Specify  a  semicolon-separated  list  of options to control the
1308              Curl library that  CTest  uses  internally  to  connect  to  the
1309              server.   Possible  options  are  CURLOPT_SSL_VERIFYPEER_OFF and
1310              CURLOPT_SSL_VERIFYHOST_OFF.
1311
1312              · CTest Script variable: CTEST_CURL_OPTIONS
1313
1314              · CTest module variable: CTEST_CURL_OPTIONS
1315
1316       DropLocation
1317              Legacy option.  When SubmitURL is not  set,  it  is  constructed
1318              from  DropMethod,  DropSiteUser, DropSitePassword, DropSite, and
1319              DropLocation.
1320
1321              · CTest Script variable: CTEST_DROP_LOCATION
1322
1323              · CTest   module   variable:   DROP_LOCATION   if   set,    else
1324                CTEST_DROP_LOCATION
1325
1326       DropMethod
1327              Legacy  option.   When  SubmitURL  is not set, it is constructed
1328              from DropMethod, DropSiteUser, DropSitePassword,  DropSite,  and
1329              DropLocation.
1330
1331              · CTest Script variable: CTEST_DROP_METHOD
1332
1333              · CTest    module    variable:    DROP_METHOD   if   set,   else
1334                CTEST_DROP_METHOD
1335
1336       DropSite
1337              Legacy option.  When SubmitURL is not  set,  it  is  constructed
1338              from  DropMethod,  DropSiteUser, DropSitePassword, DropSite, and
1339              DropLocation.
1340
1341              · CTest Script variable: CTEST_DROP_SITE
1342
1343              · CTest module variable: DROP_SITE if set, else CTEST_DROP_SITE
1344
1345       DropSitePassword
1346              Legacy option.  When SubmitURL is not  set,  it  is  constructed
1347              from  DropMethod,  DropSiteUser, DropSitePassword, DropSite, and
1348              DropLocation.
1349
1350              · CTest Script variable: CTEST_DROP_SITE_PASSWORD
1351
1352              · CTest  module  variable:  DROP_SITE_PASSWORD  if   set,   else
1353                CTEST_DROP_SITE_PASWORD
1354
1355       DropSiteUser
1356              Legacy  option.   When  SubmitURL  is not set, it is constructed
1357              from DropMethod, DropSiteUser, DropSitePassword,  DropSite,  and
1358              DropLocation.
1359
1360              · CTest Script variable: CTEST_DROP_SITE_USER
1361
1362              · CTest   module   variable:   DROP_SITE_USER   if   set,   else
1363                CTEST_DROP_SITE_USER
1364
1365       IsCDash
1366              Legacy option.  Not used.
1367
1368              · CTest Script variable: CTEST_DROP_SITE_CDASH
1369
1370              · CTest module variable: CTEST_DROP_SITE_CDASH
1371
1372       ScpCommand
1373              Legacy option.  Not used.
1374
1375              · CTest Script variable: CTEST_SCP_COMMAND
1376
1377              · CTest module variable: SCPCOMMAND
1378
1379       Site   Describe the dashboard client host site  with  a  short  string.
1380              (Hostname, domain, etc.)
1381
1382              · CTest Script variable: CTEST_SITE
1383
1384              · CTest  module  variable:  SITE, initialized by the site_name()
1385                command
1386
1387       SubmitURL
1388              The http or https URL of the dashboard server to send  the  sub‐
1389              mission to.
1390
1391              · CTest Script variable: CTEST_SUBMIT_URL
1392
1393              · CTest  module  variable:  SUBMIT_URL  if  set, else CTEST_SUB‐
1394                MIT_URL
1395
1396       TriggerSite
1397              Legacy option.  Not used.
1398
1399              · CTest Script variable: CTEST_TRIGGER_SITE
1400
1401              · CTest module variable: TRIGGER_SITE if set,  else  CTEST_TRIG‐
1402                GER_SITE
1403

SHOW AS JSON OBJECT MODEL

1405       When  the  --show-only=json-v1  command  line option is given, the test
1406       information is output in JSON format.  Version 1.0 of the  JSON  object
1407       model is defined as follows:
1408
1409       kind   The string “ctestInfo”.
1410
1411       version
1412              A  JSON  object  specifying the version components.  Its members
1413              are
1414
1415              major  A non-negative integer specifying the major version  com‐
1416                     ponent.
1417
1418              minor  A  non-negative integer specifying the minor version com‐
1419                     ponent.
1420
1421       backtraceGraph
1422              JSON object representing backtrace information with the  follow‐
1423              ing members:
1424
1425              commands
1426                     List of command names.
1427
1428              files  List of file names.
1429
1430              nodes  List of node JSON objects with members:
1431
1432                     command
1433                            Index  into  the commands member of the backtrace‐
1434                            Graph.
1435
1436                     file   Index into the files member of the backtraceGraph.
1437
1438                     line   Line number in the file where  the  backtrace  was
1439                            added.
1440
1441                     parent Index  into the nodes member of the backtraceGraph
1442                            representing the parent in the graph.
1443
1444       tests  A JSON array listing information about each test.  Each entry is
1445              a JSON object with members:
1446
1447              name   Test name.
1448
1449              config Configuration  that  the  test  can run on.  Empty string
1450                     means any config.
1451
1452              command
1453                     List where the first element is the test command and  the
1454                     remaining elements are the command arguments.
1455
1456              backtrace
1457                     Index into the nodes member of the backtraceGraph.
1458
1459              properties
1460                     Test  properties.   Can contain keys for each of the sup‐
1461                     ported test properties.
1462

RESOURCE ALLOCATION

1464       CTest provides a mechanism for tests to specify the resources that they
1465       need  in  a  fine-grained  way,  and for users to specify the resources
1466       availiable on the running machine. This allows CTest to internally keep
1467       track  of  which  resources  are  in use and which are free, scheduling
1468       tests in a way that prevents them from trying to claim  resources  that
1469       are not available.
1470
1471       A common use case for this feature is for tests that require the use of
1472       a GPU.  Multiple tests can simultaneously allocate memory from  a  GPU,
1473       but if too many tests try to do this at once, some of them will fail to
1474       allocate, resulting in a failed test, even though the test  would  have
1475       succeeded if it had the memory it needed. By using the resource alloca‐
1476       tion feature, each test can specify how much memory it requires from  a
1477       GPU,  allowing CTest to schedule tests in a way that running several of
1478       these tests at once does not exhaust the GPU’s memory pool.
1479
1480       Please note that CTest has no concept of what a GPU is or how much mem‐
1481       ory  it  has,  nor  does it have any way of communicating with a GPU to
1482       retrieve this information or perform any memory management. CTest  sim‐
1483       ply keeps track of a list of abstract resource types, each of which has
1484       a certain number of slots available for tests to use. Each test  speci‐
1485       fies  the number of slots that it requires from a certain resource, and
1486       CTest then schedules them in a way that prevents the  total  number  of
1487       slots  in  use from exceeding the listed capacity.  When a test is exe‐
1488       cuted, and slots from a resource are allocated to that test, tests  may
1489       assume  that they have exclusive use of those slots for the duration of
1490       the test’s process.
1491
1492       The CTest resource allocation feature consists of two inputs:
1493
1494       · The resource specification file, described below, which describes the
1495         resources available on the system.
1496
1497       · The  RESOURCE_GROUPS property of tests, which describes the resources
1498         required by the test.
1499
1500       When CTest runs a test, the resources allocated to that test are passed
1501       in the form of a set of environment variables as described below. Using
1502       this information to decide which resource to connect to is left to  the
1503       test writer.
1504
1505       The  RESOURCE_GROUPS property tells CTest what resources a test expects
1506       to use grouped in a way meaningful to the test.  The test  itself  must
1507       read  the  environment variables to determine which resources have been
1508       allocated to each group.  For example, each group may correspond  to  a
1509       process the test will spawn when executed.
1510
1511       Note  that  even  if a test specifies a RESOURCE_GROUPS property, it is
1512       still possible for that to test to run without any resource  allocation
1513       (and  without the corresponding environment variables) if the user does
1514       not pass a resource  specification  file.  Passing  this  file,  either
1515       through   the   --resource-spec-file   command-line   argument  or  the
1516       RESOURCE_SPEC_FILE argument to  ctest_test(),  is  what  activates  the
1517       resource     allocation     feature.    Tests    should    check    the
1518       CTEST_RESOURCE_GROUP_COUNT environment variable to find out whether  or
1519       not  resource  allocation  is activated. This variable will always (and
1520       only) be defined if resource allocation is activated. If resource allo‐
1521       cation  is  not activated, then the CTEST_RESOURCE_GROUP_COUNT variable
1522       will not exist, even if it exists for the parent ctest  process.  If  a
1523       test  absolutely  must  have  resource allocation, then it can return a
1524       failing exit code or use the SKIP_RETURN_CODE  or  SKIP_REGULAR_EXPRES‐
1525       SION properties to indicate a skipped test.
1526
1527   Resource Specification File
1528       The  resource  specification  file  is  a  JSON file which is passed to
1529       CTest, either on the ctest(1) command line as --resource-spec-file,  or
1530       as the RESOURCE_SPEC_FILE argument of ctest_test(). The resource speci‐
1531       fication file must be a JSON object.  All  examples  in  this  document
1532       assume the following resource specification file:
1533
1534          {
1535            "version": {
1536              "major": 1,
1537              "minor": 0
1538            },
1539            "local": [
1540              {
1541                "gpus": [
1542                  {
1543                    "id": "0",
1544                    "slots": 2
1545                  },
1546                  {
1547                    "id": "1",
1548                    "slots": 4
1549                  },
1550                  {
1551                    "id": "2",
1552                    "slots": 2
1553                  },
1554                  {
1555                    "id": "3"
1556                  }
1557                ],
1558                "crypto_chips": [
1559                  {
1560                    "id": "card0",
1561                    "slots": 4
1562                  }
1563                ]
1564              }
1565            ]
1566          }
1567
1568       The members are:
1569
1570       version
1571              An  object  containing a major integer field and a minor integer
1572              field.  Currently, the only supported version is major 1,  minor
1573              0. Any other value is an error.
1574
1575       local  A JSON array of resource sets present on the system.  Currently,
1576              this array is restricted to being of size 1.
1577
1578              Each array element is a JSON object with members whose names are
1579              equal  to  the desired resource types, such as gpus. These names
1580              must start with a lowercase letter or an underscore, and  subse‐
1581              quent  characters  can  be  a  lowercase  letter, a digit, or an
1582              underscore. Uppercase letters are not allowed,  because  certain
1583              platforms  have  case-insensitive environment variables. See the
1584              Environment Variables section below for more information. It  is
1585              recommended that the resource type name be the plural of a noun,
1586              such as gpus or crypto_chips (and not gpu or crypto_chip.)
1587
1588              Please note that the names gpus and crypto_chips are just  exam‐
1589              ples, and CTest does not interpret them in any way. You are free
1590              to make up any resource type you want to meet your own  require‐
1591              ments.
1592
1593              The  value  for each resource type is a JSON array consisting of
1594              JSON objects, each of which describe a specific instance of  the
1595              specified resource. These objects have the following members:
1596
1597              id     A  string  consisting  of an identifier for the resource.
1598                     Each character in the identifier can be a lowercase  let‐
1599                     ter,  a  digit,  or an underscore.  Uppercase letters are
1600                     not allowed.
1601
1602                     Identifiers must be unique within a resource  type.  How‐
1603                     ever,  they  do  not  have  to  be unique across resource
1604                     types. For example, it is valid to have a  gpus  resource
1605                     named  0 and a crypto_chips resource named 0, but not two
1606                     gpus resources both named 0.
1607
1608                     Please note that the IDs 0, 1, 2, 3, and card0  are  just
1609                     examples,  and  CTest does not interpret them in any way.
1610                     You are free to make up any IDs you want to meet your own
1611                     requirements.
1612
1613              slots  An  optional  unsigned  number  specifying  the number of
1614                     slots available on the resource. For example, this  could
1615                     be  megabytes  of  RAM  on  a  GPU, or cryptography units
1616                     available on a cryptography chip. If slots is not  speci‐
1617                     fied, a default value of 1 is assumed.
1618
1619       In  the  example file above, there are four GPUs with ID’s 0 through 3.
1620       GPU 0 has 2 slots, GPU 1 has 4, GPU 2 has 2, and GPU 3 has a default of
1621       1 slot. There is also one cryptography chip with 4 slots.
1622
1623   RESOURCE_GROUPS Property
1624       See RESOURCE_GROUPS for a description of this property.
1625
1626   Environment Variables
1627       Once CTest has decided which resources to allocate to a test, it passes
1628       this information to the test executable  as  a  series  of  environment
1629       variables.  For  each  example  below,  we will assume that the test in
1630       question      has       a       RESOURCE_GROUPS       property       of
1631       2,gpus:2;gpus:4,gpus:1,crypto_chips:2.
1632
1633       The following variables are passed to the test process:
1634
1635       CTEST_RESOURCE_GROUP_COUNT
1636              The  total  number  of  groups  specified by the RESOURCE_GROUPS
1637              property. For example:
1638
1639              · CTEST_RESOURCE_GROUP_COUNT=3
1640
1641              This variable will only be defined if ctest(1) has been given  a
1642              --resource-spec-file,  or  if  ctest_test()  has  been  given  a
1643              RESOURCE_SPEC_FILE. If no resource specification file  has  been
1644              given, this variable will not be defined.
1645
1646       CTEST_RESOURCE_GROUP_<num>
1647              The  list  of  resource types allocated to each group, with each
1648              item separated by a comma.  <num>  is  a  number  from  zero  to
1649              CTEST_RESOURCE_GROUP_COUNT minus one. CTEST_RESOURCE_GROUP_<num>
1650              is defined for each <num> in this range. For example:
1651
1652              · CTEST_RESOURCE_GROUP_0=gpus
1653
1654              · CTEST_RESOURCE_GROUP_1=gpus
1655
1656              · CTEST_RESOURCE_GROUP_2=crypto_chips,gpus
1657
1658       CTEST_RESOURCE_GROUP_<num>_<resource-type>
1659              The list of resource IDs and number of slots from each ID  allo‐
1660              cated  to  each  group  for a given resource type. This variable
1661              consists of a series of pairs, each pair separated  by  a  semi‐
1662              colon,  and with the two items in the pair separated by a comma.
1663              The first item in each pair is id:  followed  by  the  ID  of  a
1664              resource  of type <resource-type>, and the second item is slots:
1665              followed by the number of slots from that resource allocated  to
1666              the given group. For example:
1667
1668              · CTEST_RESOURCE_GROUP_0_GPUS=id:0,slots:2
1669
1670              · CTEST_RESOURCE_GROUP_1_GPUS=id:2,slots:2
1671
1672              · CTEST_RESOURCE_GROUP_2_GPUS=id:1,slots:4;id:3,slots:1
1673
1674              · CTEST_RESOURCE_GROUP_2_CRYPTO_CHIPS=id:card0,slots:2
1675
1676              In this example, group 0 gets 2 slots from GPU 0, group 1 gets 2
1677              slots from GPU 2, and group 2 gets 4 slots from GPU  1,  1  slot
1678              from GPU 3, and 2 slots from cryptography chip card0.
1679
1680              <num>  is a number from zero to CTEST_RESOURCE_GROUP_COUNT minus
1681              one.  <resource-type> is the name of a resource type,  converted
1682              to   uppercase.   CTEST_RESOURCE_GROUP_<num>_<resource-type>  is
1683              defined for the product of each <num> in the range listed  above
1684              and each resource type listed in CTEST_RESOURCE_GROUP_<num>.
1685
1686              Because  some platforms have case-insensitive names for environ‐
1687              ment variables, the names of resource types may not clash  in  a
1688              case-insensitive  environment.  Because of this, for the sake of
1689              simplicity, all resource types must be listed in  all  lowercase
1690              in  the  resource  specification file and in the RESOURCE_GROUPS
1691              property, and  they  are  converted  to  all  uppercase  in  the
1692              CTEST_RESOURCE_GROUP_<num>_<resource-type> environment variable.
1693

SEE ALSO

1695       The following resources are available to get help using CMake:
1696
1697       Home Page
1698              https://cmake.org
1699
1700              The primary starting point for learning about CMake.
1701
1702       Online Documentation and Community Resources
1703              https://cmake.org/documentation
1704
1705              Links  to available documentation and community resources may be
1706              found on this web page.
1707
1708       Discourse Forum
1709              https://discourse.cmake.org
1710
1711              The Discourse Forum hosts discussion and questions about CMake.
1712
1714       2000-2019 Kitware, Inc. and Contributors
1715
1716
1717
1718
17193.16.1                           Dec 14, 2019                         CTEST(1)
Impressum