1846 Commits

Author SHA1 Message Date
Joan Bruguera Micó
ff077af032 ctest: Set close-on-exec for jobserver FIFO
Set the close-on-exec flag to prevent the jobserver FIFO file
descriptor from leaking to subprocesses spawned by `ctest`.

This leak is usually harmless, but can cause `make test -jN` to hang
at the end of the build if a test leaves a background process running
with the jobserver FIFO file descriptor open.

Fixes: #26027
2024-06-05 09:37:05 -04:00
Brad King
85745cce7a ctest: Restore enforcement of RESOURCE_LOCK test property
Refactoring in commit 5ff0b4ed57 (cmCTestMultiProcessHandler:
Consolidate test readiness checks, 2023-10-20, v3.29.0-rc1~378^2~4)
accidentally broke `RESOURCE_LOCK`.  Fix it and replace the previous
test with one that would have caught this.

Fixes: #25843
2024-04-01 12:22:29 -04:00
Brad King
04d8bc6bb9 Merge topic 'ctest-j-default' into release-3.29
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:49 -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
bbcbcff7d9 cmCTestMultiProcessHandler: Modernize member initialization 2024-03-10 10:27:05 -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
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
d9b9f63083 Merge topic 'ctest-tests-from-file'
701029726f ctest_test: add options INCLUDE_FROM_FILE and EXCLUDE_FROM_FILE
dbacc1d5a8 ctest: add command line option to exclude tests listed in a given file
022f20f663 ctest: add command line option to run the tests listed in a given file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !9128
2024-01-26 10:14:58 -05:00
Alex Neundorf
701029726f ctest_test: add options INCLUDE_FROM_FILE and EXCLUDE_FROM_FILE
These options can be used to specify files which can be used
to restrict the set of tests that will be executed.

Fixes: #25455
2024-01-25 12:38:04 -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
b11c8c45f9 Merge topic 'cmuvprocesschain'
adb3e13d32 cmUVProcessChain: Tolerate fileno() of invalid FILE stream
b6e4e4babc cmUVProcessChain: Simplify SetExternalStream usage
116bb2b70f cmUVProcessChain: Simplify builder initialization
d32c30906a Tests: Add missing include in testUVProcessChainHelper on Windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9181
2024-01-25 10:40:02 -05:00
Brad King
b6e4e4babc cmUVProcessChain: Simplify SetExternalStream usage
It is commonly called with the `fileno()` of a `FILE*` stream,
so accept the latter directly.
2024-01-24 16:59:49 -05:00
Brad King
d9d9326e14 Source: Avoid out-of-range inputs to std::isspace()
`isspace` takes `int` but documents that the value must be representable
by `unsigned char`, or be EOF.  Use a wrapper to cast to `unsigned char`
to avoid sign extension while converting to `int`.  This generalizes the
fix from commit 5e8c176e2a (cmExecuteProcessCommand: Cast c to unsigned
char before cast to int, 2024-01-05) to other `isspace` call sites.

This was detected by assertions in the MSVC standard library while
processing UTF-8 text.

Issue: #25561
2024-01-17 10:17:06 -05:00
Matthew Woehlke
20adf8cfce ctest: allow HTTP headers via command line
Add ability to specify HTTP headers via `ctest -T Submit`.
2024-01-08 14:11:40 -05:00
Brad King
80fe56c481 ctest: Add support for running under a make job server on POSIX systems
Share job slots with the job server by acquiring a token before running
each test, and releasing the token when the test finishes.
2023-12-03 08:30:07 -05:00
Brad King
5396f4a9a3 cmUVJobServerClient: Add libuv-based job server integration client 2023-12-03 08:30:06 -05:00
Brad King
0432b921ae cmCTestMultiProcessHandler: Inline removal of pending test as it starts
Avoid searching the entire list of ordered pending tests to remove one
when we already know where it is.
2023-11-22 07:49:04 -05:00
Brad King
b17c732e88 cmCTestMultiProcessHandler: Clarify role of StartTestProcess
Focus its role on actually running the test process.
Move administrative tasks to the call site.
2023-11-22 07:49:04 -05:00
Brad King
0950acb337 cmCTestMultiProcessHandler: Manage concurrency slots with other resources 2023-11-22 07:49:04 -05:00
Brad King
697900da29 cmCTestMultiProcessHandler: Manage affinity assignments with other resources 2023-11-22 07:49:04 -05:00
Brad King
086a41c0f3 cmCTestMultiProcessHandler: Simplify test startup batching
Once a test is ready to run, count it against the number of tests to
start in the current batch whether or not the test process actually
starts successfully.  If a test process does fail to start, simply
schedule a new startup batch on the next loop iteration.
2023-11-21 12:40:13 -05:00
Brad King
e528cd795f cmCTestMultiProcessHandler: Start new tests asynchronously
When a test finishes, defer starting new tests until the next loop
iteration.  That way, if multiple tests finish in a single loop
iteration, we can free all of their resources first, and then start
a new batch of tests.
2023-11-21 12:37:53 -05:00
Brad King
9d8415c17b cmCTestMultiProcessHandler: Clarify test-load retry timer infrastructure 2023-11-21 12:37:41 -05:00
Brad King
61e98ca33b cmCTestMultiProcessHandler: Factor out loop startup and teardown 2023-11-21 12:37:31 -05:00
Brad King
5ff0b4ed57 cmCTestMultiProcessHandler: Consolidate test readiness checks 2023-11-21 12:36:31 -05:00
Brad King
ad3df3ce4d cmCTestMultiProcessHandler: Exclude dependent tests earlier
Tests with unfinished dependencies should not be considered at all when
looking for tests that fit within the load and concurrency limits.
2023-11-21 08:29:17 -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
Brad King
6818925b9a Merge topic 'ctest-cleanup'
5d2e93f9e8 cmCTestMultiProcessHandler: Simplify logic on unavailable resources
a4b061a035 cmCTestMultiProcessHandler: Clarify resource availability error member names
1487e540aa cmCTestMultiProcessHandler: Reduce repeat test property map lookups
b02b628ad9 cmCTestMultiProcessHandler: Simplify loop termination on serial test
8f1e8af0cc cmCTestMultiProcessHandler: Stop searching for tests when limit is reached
bd0b4ca867 cmCTestMultiProcessHandler: Invert spare load condition
9b548139fd cmCTestMultiProcessHandler: Clarify search for tests <= concurrency limit
ee321dc85f cmCTestMultiProcessHandler: Clarify search for tests <= spare load
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8981
2023-11-20 08:16:19 -05:00
Brad King
4c1a6f2e23 Merge topic 'ci-fedora-39'
cdd741ebf9 Merge branch 'backport-ci-fedora-39' into ci-fedora-39
9283b20659 ci: Suppress CPack/RPM tests pending fix for Fedora 39
18145e8745 ci: Update FindMPI test environment for mpich on Fedora 39
a8be80ccf2 ci: Drop now-unnecessary Clang rules for CXXModules tests
99238b23e9 ci: use Fedora 39 images and environments
57eadec617 ci: update Linux image to Fedora 39
653262162c clang-tidy module: Update to build against LLVM/Clang 17
2cf9a65835 clang-tidy: ignore warnings new in version 17
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8983
2023-11-20 08:10:37 -05:00
Brad King
5d2e93f9e8 cmCTestMultiProcessHandler: Simplify logic on unavailable resources
Deallocation is not necessary after allocation fails.
2023-11-17 18:43:01 -05:00
Brad King
a4b061a035 cmCTestMultiProcessHandler: Clarify resource availability error member names
The members are about the availability of sufficient resources,
not allocation of them.
2023-11-17 18:43:01 -05:00
Brad King
1487e540aa cmCTestMultiProcessHandler: Reduce repeat test property map lookups 2023-11-17 18:43:01 -05:00
Brad King
b02b628ad9 cmCTestMultiProcessHandler: Simplify loop termination on serial test 2023-11-17 18:43:01 -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
bd0b4ca867 cmCTestMultiProcessHandler: Invert spare load condition
Switch then/else blocks to reduce indentation.
2023-11-17 18:41:42 -05:00
Brad King
9b548139fd cmCTestMultiProcessHandler: Clarify search for tests <= concurrency limit 2023-11-17 18:41:42 -05:00
Brad King
ee321dc85f cmCTestMultiProcessHandler: Clarify search for tests <= spare load
Move code into conditions where it is needed and comment its purpose.
2023-11-17 18:41:42 -05:00
Brad King
afd185881f cmCTestMultiProcessHandler: Make loops over all pending tests more consistent
Some loops were using the ordered list unnecessarily while others used
the main map of pending test.  Update all to use the latter.
2023-11-17 18:41:41 -05:00
Brad King
3bc3f6cbb5 cmCTestMultiProcessHandler: Clarify representation of pending test order
Also avoid copying the entire list each time we start a batch of tests.
2023-11-17 18:41:41 -05:00
Brad King
b27969c89d cmCTestMultiProcessHandler: Clarify representation of pending tests 2023-11-17 18:41:41 -05:00
Brad King
7bca3f8c80 cmCTestMultiProcessHandler: Avoid extra copy of test maps 2023-11-17 18:41:41 -05:00
Brad King
d6d114f3e8 cmCTestMultiProcessHandler: Remove unused members
The `TestRunningMap` and `TestFinishMap` members have not been used
since commit 44017a4767 (CTest: handle dependent and non dependent test
requirements equally, 2013-10-17, v3.0.0-rc1~451^2~7).
2023-11-17 18:41:41 -05:00
Brad King
451429e19c cmCTestMultiProcessHandler: Use cm::uv_loop_ptr abstraction
This ensures all loop resources are released.
2023-11-17 18:41:41 -05:00
John Parent
419443f68f cmCTestMultiProcessHandler: Factor out helper to check for completion 2023-11-17 18:41:41 -05:00
Chris Mahoney
8c307ab567 cmCTestMultiProcessHandler: Replace false condition with opposite assert 2023-11-17 18:41:41 -05:00
Brad King
1f8f270f62 cmCTestRunTest: Consolidate initialization in constructor 2023-11-17 18:41:40 -05:00
Brad King
cdd741ebf9 Merge branch 'backport-ci-fedora-39' into ci-fedora-39 2023-11-17 11:35:41 -05:00
Brad King
7517923418 codespell: Match valgrind output without repeating a spelling error 2023-11-17 09:58:21 -05:00