Commit Graph

160 Commits

Author SHA1 Message Date
Brad King
8832f78dd6 IWYU: Update for Debian 13 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:35 -05:00
Daniel Pfeifer
b1fdab3cc1 source: Pass small and trivially copyable types by value 2025-08-01 09:56:00 -04:00
Daniel Goldberg
d3455f38de ctest: Add option to specify the --schedule-random seed
When `--schedule-random` is used in automated CI jobs, failures may
occur due to test order.  We now log the seed.  Provide a way for
developers to re-run the same order by specifying the seed.

Fixes: #26760
Co-authored-by: Brad King <brad.king@kitware.com>
2025-03-18 14:17:59 -04:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Zack Galbreath
a6d4a9a2ae ctest: Include cmake instrumentation data in XML files 2025-02-15 06:25:12 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Daniel Pfeifer
9fe40b33e0 cmCTest*Handler: Use default member initialization 2024-10-29 12:49:22 +01:00
Daniel Pfeifer
d07a35a336 cmCTest: Remove handler instances 2024-10-29 12:49:22 +01:00
Daniel Pfeifer
914a355810 CTest: Remove unneeded code 2024-10-29 11:27:17 +01:00
Daniel Pfeifer
70dfb24957 cmCTestTestHandler: Consolidate simple options into cmCTestTestOptions 2024-10-29 11:26:54 +01:00
Daniel Pfeifer
b43d3dcfba cmCTestTestHandler: Consolidate File options into cmCTestTestOptions 2024-10-29 11:26:27 +01:00
Daniel Pfeifer
f7181175ad cmCTestTestHandler: Consolidate RegExp options into cmCTestTestOptions 2024-10-29 11:25:57 +01:00
Daniel Pfeifer
86225833f2 cmCTestTestHandler: Consolidate Output options into cmCTestTestOptions 2024-10-29 11:25:05 +01:00
Brad King
8779b1ad28 Merge branch 'backport-ci-fedora-41' into ci-fedora-41 2024-10-26 06:02:18 -04:00
Brad King
7605228f5e codespell: Fix typos 2024-10-25 08:43:04 -04:00
Daniel Pfeifer
f5a314cc35 cmCTestGenericHandler: Add cmCTest* argument to Initialize function 2024-10-23 23:42:14 +02:00
Daniel Pfeifer
774fcbe49c CTest: Base command line mode on top of scripting commands
Make sure that all CMake variables that are translated into
CTest options in `cmCTest*Command` implementations are translated
from CTest options into CMake variables before the functions are
called.  This back-and-forth translation should be temporary.
It is a necessary prerequisite for refactoring `cmCTest*Handler`
implementations to operate on CMake variables directly rather
than CTest options.
2024-10-12 06:42:02 -04:00
Brad King
4905335776 Merge topic 'ctest-tests-from-file'
170ec48601 Help: Improve ctest tests-from-file documentation wording and wrapping
1a4837641e ctest: Remove unnecessary and ambiguous tests-from-file comment syntax
d52c66bfb3 ctest: Honor tests-from-file options with empty input
8673264e25 Tests: Make ctest tests-from-file expected output more precise

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9322
2024-03-11 10:17:00 -04:00
Brad King
d52c66bfb3 ctest: Honor tests-from-file options with empty input
If the `--tests-from-file` input file is empty, no tests should run.
2024-03-08 16:06:35 -05:00
Brad King
0530eca631 Merge topic 'gtest-json-test-def-source'
06860d5c12 ctest: Show custom test properties in --show-only=json-v1

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9305
2024-03-08 09:35:26 -05:00
Brad King
ca0a9def2e ctest: Exit with failure when tests-from-file input is missing
If the options added by

* commit 022f20f663 (ctest: add command line option to run the tests listed
                     in a given file, 2023-11-29, v3.29.0-rc1~66^2~2)
* commit dbacc1d5a8 (ctest: add command line option to exclude tests listed
                     in a given file, 2023-11-30, v3.29.0-rc1~66^2~1)
* commit 701029726f (ctest_test: add options INCLUDE_FROM_FILE and
                     EXCLUDE_FROM_FILE, 2023-12-03, v3.29.0-rc1~66^2)

are given a missing file, fail instead of ignoring it.

Fixes: #25740
2024-03-06 16:14:04 -05:00
Daniel Sim
06860d5c12 ctest: Show custom test properties in --show-only=json-v1 2024-03-06 15:06:20 +00:00
Alex Neundorf
dbacc1d5a8 ctest: add command line option to exclude tests listed in a given file
Add `--exclude-from-file <filename>` to exclude the tests listed in the
given file.

Issue: #25455
2024-01-25 12:37:56 -05:00
Alex Neundorf
022f20f663 ctest: add command line option to run the tests listed in a given file
Add `--tests-from-file <filename>` to run only the tests listed in the
given file.  The test names must match exactly, no regexps or something.
The listed tests can still be filtered with a regexp using -R.

Issue: #25455
2024-01-25 12:37:16 -05:00
Brad King
3c4767f467 cmCTestTestHandler: Clarify name of member storing RESOURCE_LOCK property
The property represents project-defined resources.
2023-11-21 08:29:17 -05:00
Kyle Edwards
c8c1dd0d95 CTest: Add ability to dynamically generate resource spec file
Issue: #25106
2023-08-10 16:47:51 -04:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Brad King
54c5654f7d ctest: Optionally terminate tests with a custom signal on timeout
CTest normally terminates test processes on timeout using `SIGKILL`.
Offer tests a chance to exit gracefully, on platforms supporting POSIX
signals, by setting `TIMEOUT_SIGNAL_{NAME,GRACE_PERIOD}` properties.

Fixes: #17288
2023-06-02 06:51:13 -04:00
Brad King
25c1468314 cmCTestTestHandler: Remove outdated comment
Remove a comment that has not been relevant since commit 177edc5ed1
(Fixed ctest -N segfault issue.  Further refactored ctest.  Enabled
failover for ctest, 2009-08-27, v2.8.0~250).
2023-05-31 09:43:03 -04:00
Brad King
0a5aeaf302 cmCTestRunTest: Consolidate test timeout selection logic
Test timeout selection was previously spread out over several locations.
Consolidate it in a single place to make it easier to follow.
2023-05-04 17:11:19 -04:00
Brad King
cd4038fe94 cmCTestTestHandler: Use in-class initialization of properties and results 2023-05-04 10:27:58 -04:00
Frank Winklmeier
140704d443 ctest: add option for output truncation
Add `--test-output-truncation` to `ctest`. This option can be used to
customize which part of the test output is being truncated. Currently
supported values are `tail`, `middle` and `head`.

Also add equivalent `CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION` variable.

Fixes: #23206
2022-03-08 08:18:02 -05:00
Rose
6f4727aaa0 Source: Replace C headers with C++ ones
In applicable areas only, of course.
2021-11-02 14:45:29 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Marc Chevrier
f9bcde974e cmCTestGenericHandler::GetOption returns cmProp 2021-09-13 11:29:07 +02:00
Ben Boeckel
de4f1f26b0 CTest: add an ENVIRONMENT_MODIFICATION property
This property allows projects to modify environment variables at test
time rather than trying to guess what the state should be based on what
is present at configure time. Of particular interest is the ability to
use a `PATH` present at test time while adding entries known to be
necessary for the test itself.

There are multiple operations provided to modify variables, including:

  - setting and unsetting
  - appending and prepending as:
    - strings
    - path lists
    - CMake lists

Additionally, a `reset` action is provided to cancel any prior
modifications to that particular variable in the case of incremental
additions to the test property.
2021-07-09 08:45:18 -04:00
Zack Galbreath
5489ce74b3 ctest: support <CTestMeasurement> for runtime measurements
Teach CTest to parse output for <CTestMeasurement> in addition to
<DartMeasurement> for measurements defined at runtime.

Use a new class (cmCTestTestMeasurementXMLParser) derived from cmXMLParser
to parse the data and attributes these XML elements. This is an improvement
over our previous approach of using a series of regular expressions.

As part of this commit we also rename some member variables and methods
to make their purpose more clear.

DartStuff                        -> AllTestMeasurementsRegex
DartStuff1                       -> SingleTestMeasurementRegex
DartString                       -> TestMeasurementsOutput
GenerateDartOutput()             -> GenerateCTestXML()
GenerateRegressionImages()       -> RecordCustomTestMeasurements()
cmCTestRunTest::DartProcessing() -> ParseOutputForMeasurements()
2021-07-01 15:16:23 -04:00
Zack Galbreath
bd38749fd4 ctest: allow test output to add labels
Parse test output for <CTestLabel>...</CTestLabel>.
If found, add this value to the list of labels associated with this test.
2021-06-17 14:09:01 -04:00
Zack Galbreath
02f1271bdf ctest: allow test output to override the 'details' field
Parse test output for <CTestDetails>...</CTestDetails>.
If found, use this value to override the default 'Details' string reported
to CDash.
2021-06-09 08:31:32 -04:00
Zack Galbreath
cbcb92d1cb ctest: add support for attaching files to tests at run time
Allow tests to specify files to upload at runtime. Previously this was
only possible to specify at configure time with the ATTACHED_FILES
test properties.

This commit also fixes a bug in how our test data tarballs were generated
by CTest. Previously, if you tried to attach a file outside of the binary
directory, CTest would generate a tar file with a relative path, and tar
would not allow you to extract it. We resolve this problem by creating
tar files with a flat directory structure instead.

Fixes: #22284
2021-06-08 09:27:19 -04:00
Zack Galbreath
25bf514447 ctest: Add support for writing test results in JUnit XML format
Addresses #18654
2021-04-26 08:55:22 -04:00
Adriaan de Groot
44ad3f0b7f ctest: Support multiple -L and -LE options to mean "AND"
Fixes: #21087
2021-03-28 12:04:05 +11:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Kevin Puetz
6a6f1d1edd CTest: exit nonzero after message(SEND_ERROR|FATAL_ERROR)
Fixes: #21004
2020-08-26 11:27:05 -04:00
Vitaly Stakhovsky
825b04c67a cmCTest: Members accept std::string parameters 2020-07-27 10:58:39 -04:00
Kyle Edwards
a1612af749 CTest: Log environment variables as a test measurement 2020-05-19 10:26:57 -04:00
Kyle Edwards
060d2ce269 CTest: Add CTEST_RESOURCE_SPEC_FILE variable 2020-04-02 16:29:50 -04:00
Rolf Eike Beer
dc21177461 remove pointless return value from cmCTestTestHandler::CleanTestOutput() 2020-03-23 19:47:47 +01:00
Kyle Edwards
a5be3916ee CTest: Provide more detailed information on resource allocation error 2020-02-24 15:44:01 -05:00
Brad King
28994115e8 ctest_test: Add option to REPEAT tests 2019-11-07 14:21:18 -05:00