Commit Graph

96 Commits

Author SHA1 Message Date
Craig Scott
2e7bca5f05 ctest: Add JSON schema for --show-only=json-v1 output
Add schema validation to the existing test case for --show-only=json-v1 too.

Fixes: #26980
2025-06-10 07:12:31 +10:00
Brad King
bf5661bb25 Merge topic 'test-ctest-regression'
6bc5b467a9 Tests: Fix RunCMake.CTestCommandLine under ctest -T Coverage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10699
2025-04-23 08:43:05 -04:00
Brad King
6bc5b467a9 Tests: Fix RunCMake.CTestCommandLine under ctest -T Coverage
Update commit 712cb8cb14 (ctest: Restore support for -T Test without
dashboard configuration, 2025-03-06, v4.0.0-rc4~11^2) to avoid
conflating coverage of CMake itself with the coverage mode of ctest
being tested.
2025-04-22 11:25:24 -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
Daniel Pfeifer
712cb8cb14 ctest: Restore support for -T Test without dashboard configuration
Since commit 774fcbe49c (CTest: Base command line mode on top of
scripting commands, 2024-10-05, v4.0.0-rc1~653^2) we drive dashboard
client steps through `cmCTestHandlerCommand::ExecuteHandlerCommand`
instead of calling `ProcessHandler` directly.  This requires the
`BuildDirectory` to be known to establish a work directory.

Fixes: #26743
Co-authored-by: Brad King <brad.king@kitware.com>
2025-03-06 09:43:22 -05:00
Brad King
7b041f7fe8 ctest: Print GENERATED_RESOURCE_SPEC_FILE property in show-only output
This was missed in commit c8c1dd0d95 (CTest: Add ability to dynamically
generate resource spec file, 2023-07-20, v3.28.0-rc1~233^2).
2024-11-25 14:18:07 -05:00
Brad King
733808150b ctest: Print custom timeout signal properties in show-only output
This was missed in commit 54c5654f7d (ctest: Optionally terminate tests
with a custom signal on timeout, 2023-05-11, v3.27.0-rc1~18^2).
2024-11-25 14:17:34 -05:00
Brad King
57587b3863 Tests/RunCMake/CTestCommandLine: Fix python string literal syntax 2024-11-25 12:15:29 -05:00
Daniel Pfeifer
281e9039cb cmWorkingDirectory: Unify error messages 2024-10-18 15:04:07 -04: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
Daniel Pfeifer
5115c01e1f CTestCommandLine tests: Make sure to test successful run
Add a DartConfiguration.tcl file in two places, so that testing the
generated Text.xml file does not depend on output in stderr.
2024-10-09 18:48:52 +02:00
Brad King
f4aa34daa7 Tests/RunCMake: Update cmake_minimum_required versions to 3.10
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.10 where possible.
2024-10-03 11:52:22 -04:00
Brad King
8f6092fc20 Tests: Move ctest --print-labels case into RunCMake.CTestCommandLine 2024-07-24 10:07:35 -04:00
Wim Colgate
49e9f817de ctest: Display test labels in failure summary
In a complex test environment, there may be a desire to add a test
property label to indicate context. Here is one such example:

    set_property(TEST mygoofytest PROPERTY LABELS might-fail-on-config-change)

Upon looking at the failed test summary, one can quickly decide whether
the failure might be expected or not.

    198 - mygoofytest (Failed)                might-fail-on-config-change
2024-07-17 13:56:01 -04:00
castro-ma
c971212703 ctest: Allow --test-dir override when using presets
Fixes: #23982
2024-04-24 16:45:29 -04:00
Martin Duffy
96dbf6c34a ctest: Cleanup for invalid argument handling
Backs out unrelated change and changes error message to 'Unknown argument'
2024-04-17 15:44:56 -04:00
Brad King
c2949dbdf8 Merge topic 'ctest-invalid-arg'
304396d13c ctest: Show error on invalid ctest arguments
06cb978c1b Tests: Fix ctest flag typo in RunCMake.GoogleTest

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9383
2024-04-05 11:55:47 -04:00
Jake D'Esposito
304396d13c ctest: Show error on invalid ctest arguments
Fixes: #24227
2024-04-03 21:33:19 -04:00
Brad King
7139944264 ctest: Fall back to CMake environment variable for TLS server verification
Use `ENV{CMAKE_TLS_VERIFY}` if `CTEST_TLS_VERIFY` or `CMAKE_TLS_VERIFY`
is not set.

Issue: #23608
2024-03-30 09:22:05 -04:00
Brad King
c295df53c6 ctest: Test fallback to CMake options for TLS server verification 2024-03-30 09:22:05 -04:00
Brad King
6c44abb6e0 Tests: Update cmake_minimum_required version in RunCMake ctest cases
This was missed in commit 1edf138506 (Tests/RunCMake: Update
cmake_minimum_required versions, 2023-02-06, v3.27.0-rc1~508^2~1).
2024-03-29 14:17:58 -04:00
Brad King
aeb8bcc055 ctest: Fall back to CMake options for TLS version
Use `CMAKE_TLS_VERSION` or `ENV{CMAKE_TLS_VERSION}` if
`CTEST_TLS_VERSION` is not set.

Issue: #25701
2024-03-12 10:47:08 -04:00
Brad King
56e319ce4a ctest: Fall back to CMake options for TLS server verification
Use `CMAKE_TLS_VERIFY` if `CTEST_TLS_VERIFY` is not set.
2024-03-12 10:46:42 -04:00
Brad King
6671f17f65 ctest: Add explicit options for TLS version
Add a dedicated `TLSVersion` ctest option and a `CTEST_TLS_VERSION`
variable to control it.

Issue: #25701
2024-03-12 10:46:23 -04:00
Brad King
0aba13a2f3 ctest: Add explicit options for TLS server verification
Add a dedicated `TLSVerify` ctest option and a `CTEST_TLS_VERIFY`
variable to control it.  Deprecate `CurlOptions` because it exposes
internal implementation details.
2024-03-12 10:46:11 -04:00
Brad King
89e99cca63 Merge topic 'ctest-j-default'
5de1e21659 ctest: Allow passing -j without value to choose a contextual default
bbcbcff7d9 cmCTestMultiProcessHandler: Modernize member initialization
7457b474a1 Tests: Remove unnecessary parallel suppression from CTestCoverageCollectGCOV
ae69801d96 Tests: Convert CTestTestSkipReturnCode to RunCMake.ctest_test case
30dda49416 Tests: Convert CTestTestSerialOrder to RunCMake.ctest_test case

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9315
2024-03-11 10:18:50 -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
5de1e21659 ctest: Allow passing -j without value to choose a contextual default
Under job server integration, added by commit 80fe56c481 (ctest: Add
support for running under a make job server on POSIX systems,
2023-11-15, v3.29.0-rc1~324^2), use a very high default so that
parallelism is effectively limited only by available job server tokens.

Otherwise, choose a default limit based on the number of processors.

Also allow passing `0` to specify unbounded parallelism.

Fixes: #25739
2024-03-10 11:41:39 -04:00
Brad King
1a4837641e ctest: Remove unnecessary and ambiguous tests-from-file comment syntax
Test names can contain `#`.  Since we ignore lines that do not match any
test names anyway, "commenting" can still work without explicit syntax.
Also drop whitespace trimming for similar reasons.

Fixes: #25741
2024-03-08 16:25:33 -05: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
8673264e25 Tests: Make ctest tests-from-file expected output more precise 2024-03-08 16:03:48 -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
35038b65f9 Merge topic 'ctest-tests-from-file'
ca0a9def2e ctest: Exit with failure when tests-from-file input is missing
60433fc6e8 Tests: Generalize ctest tests-from-file test cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9317
2024-03-08 09:28:46 -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
Brad King
60433fc6e8 Tests: Generalize ctest tests-from-file test cases 2024-03-06 13:34:10 -05:00
Daniel Sim
06860d5c12 ctest: Show custom test properties in --show-only=json-v1 2024-03-06 15:06:20 +00:00
Kyle Edwards
de446077f7 Tests: Allow RunCMake.CTestCommandLine/TestOutputSize to have larger file 2024-02-27 14:36:40 -05: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
8f1e8af0cc cmCTestMultiProcessHandler: Stop searching for tests when limit is reached
Avoid an extra loop iteration if we have no room for more tests.
2023-11-17 18:42:17 -05:00
Brad King
c896dc78f9 Tests: Cover ctest waiting on insufficient non-zero spare test-load 2023-11-17 18:40:44 -05:00
Brad King
be657bf1e0 Tests: Migrate CTestTest{NoBuild,NoExe} to RunCMake.ctest_{build,test}
Avoid duplicating infrastructure provided by the latter.
2023-09-07 11:46:53 -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
1edf138506 Tests/RunCMake: Update cmake_minimum_required versions
For policy-specific tests, use the version before the policy was
introduced.  Otherwise, use 3.5 where possible.

Also, remove `cmake_minimum_required()` and `project()` calls from
individual cases where they are handled by `CMakeLists.txt`.
2023-02-11 06:24:22 -05:00
friendlyanon
0661de58d8 ctest(1): Add CTEST_NO_TESTS_ACTION env var
This environment variable provides a default value for the
--no-tests=<action> command line argument.
2023-01-13 13:33:39 +01:00
Brad King
3b6c1c1a3b Tests: Factor out RunCMake ctest environment isolation
Some RunCMake tests unset some environment variables that affect ctest's
behavior before running it.  Any test using the RunCTest helper needs to
do this, so do it in the helper itself.

Issue: #24153
2022-11-14 11:05:56 -05:00
Brad King
bd30d20bc3 Tests: Add cases covering bad ctest output truncation types
Issue: #23869
2022-09-07 12:23:08 -04:00
Frank Winklmeier
cb55d5e730 RunCMakeTest: fix Truncation test definition
The `ctest_test` and `CTestCommandLine` truncation tests had multiple problems:
- escape expected result string to avoid regex matching
- specify the truncation size
- pass the truncation mode correctly into the test definition
- use unique test names

Issue: #23868
2022-09-05 13:42:40 +02:00
Kyle Edwards
313ea361b0 CMake: Use FindPython instead of FindPythonInterp to build CMake itself
Fixes: #23444
2022-04-21 14:23:36 -04:00
Brad King
5059db7c17 Tests: Fix CMake syntax warning in RunCMake.CTestCommandLine
Fix a regex added in the test by commit 140704d443 (ctest: add option
for output truncation, 2022-03-07).
2022-03-10 08:05:56 -05:00