Commit Graph

10859 Commits

Author SHA1 Message Date
Alexander Krabler
2ea216a6bb GoogleTest: Add working directory to gtest_discover_tests error message
If the working directory didn't exist, the old message just says:

    Error running test executable.

        Path: '<Path to test executable>'
        Result: No such file or directory
        Output:

This leads the user to the conclusion that the test executable doesn't
exist, which isn't true.  Make the true cause visible by reporting the
working directory in the error message.
2023-12-18 09:03:51 -05:00
Brad King
ba41ca758a Merge topic 'swift-split-compilation-model'
9bed4f4d81 Swift/Ninja: Split compilation model
64b3367845 cmGlobalGenerator: Allow passing language to GetLangaugeOutputExtension

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8907
2023-12-16 07:15:41 -05:00
Brad King
6ba3bb0563 Merge topic 'cmake-test-launcher'
88863d83d6 fileapi: Add test launcher to codemodel-v2
1ec0372ed4 add_test: Optionally use a launcher for tests running in-project targets
478a5f4e04 fileapi: Make launcher attribute 'arguments' optional
b44e38a397 cmFileAPICodemodel: Add missing std::move()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8963
2023-12-15 09:34:20 -05:00
Brad King
d901c4aa95 Merge topic 'FindCUDAToolkit-cupti'
04959e0285 Tests: Verify CUDA::cupti existence on a subset of machines
09a3c8b46b CUDAToolkit: Correctly search all include paths from compiler

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9072
2023-12-15 09:32:00 -05:00
Evan Wilde
9bed4f4d81 Swift/Ninja: Split compilation model
Splitting the Swift build into an object build and a separate link step,
instead of building and linking in one step. The immediate benefit is
LSP support because we are able to emit compile-commands for Swift files
now. Additionally, it is possible to specify flags to the compile step,
enabling folks to emit C and C++ headers from their Swift builds for
C/C++ interop, without needing custom commands. Eventually, this gives
us a path toward working object libraries.

Object Libraries:
 - Object libraries don't work today because CMake doesn't emit targets
   for object libraries into the Ninja build file.
 - tl;dr: Object libraries work if they aren't WMO. Still need work to
   make WMO'd object libraries work.

   Object libraries still don't completely work with this patch because,
   while we emit the targets, the `TARGET_OBJECTS` generator expression
   expansion has a separate mechanism for determining what the names of
   the objects are based on the input source files, so targets that
   depend on an object library built with a whole-module optimization
   will depend on objects based on the name of the source file instead
   of the actual emitted object file.

These features require being able to accurately model wholemodule builds
though, because we actually need to track object files and WMO affects
what objects are emitted. For that, we require CMP0157 use the NEW
policy. When it's OLD, we have to fall back on the old behavior and
cannot provide object libraries or the compile-commands for LSP.

Issue: #25308
2023-12-15 05:51:13 -08:00
Robert Maynard
04959e0285 Tests: Verify CUDA::cupti existence on a subset of machines
When we know that the cupti library exists explicitly request the CUDA Toolkit test to verify the existence
2023-12-14 14:05:28 -05:00
Ralf Habacker
88863d83d6 fileapi: Add test launcher to codemodel-v2
We do not need to bump the minor version because it was recently bumped
by addition of the cross-compiling emulator as another kind of launcher.
2023-12-13 10:20:43 -05:00
Ralf Habacker
1ec0372ed4 add_test: Optionally use a launcher for tests running in-project targets
Add a `CMAKE_TEST_LAUNCHER` variable and corresponding `TEST_LAUNCHER`
target property.

Issue: #23672
2023-12-13 10:20:43 -05:00
Ralf Habacker
478a5f4e04 fileapi: Make launcher attribute 'arguments' optional
This was missed in commit 80a64c9ce5 (fileapi: Add cross-compiling
emulator to codemodel-v2, 2023-11-11).
2023-12-13 10:20:41 -05:00
Kyle Edwards
3ff556ae41 Tests/RunCMake/XcFramework: Add iOS and iOS Simulator to .xcfw 2023-12-11 16:41:38 -05:00
Brad King
143f5abb3b Merge topic 'find-rustc-importlibs'
f20c5c6f20 MSVC: Teach find_library to consider Rust's '${name}.dll.lib' convention
7598ea5389 Tests: Add case covering find_library behavior when targeting MSVC ABI

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9046
2023-12-09 08:11:56 -05:00
Brad King
19b631a2ed Merge topic 'test-gnu-hurd-sleep'
8f53526dec Tests: Do not expect EINTR when sleep is interrupted on GNU/Hurd

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9052
2023-12-09 08:10:38 -05:00
Brad King
fabfaf0aa0 Merge topic 'test-gnu-hurd-sleep' into release-3.28
8f53526dec Tests: Do not expect EINTR when sleep is interrupted on GNU/Hurd

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9052
2023-12-09 08:10:37 -05:00
Brad King
04727ba21c Merge topic 'ninja-dev'
101ac06b28 Tests: Update for changes to upstream ninja development version

Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !9053
2023-12-09 08:09:38 -05:00
Mattias Ellert
8f53526dec Tests: Do not expect EINTR when sleep is interrupted on GNU/Hurd
Previously `RunCMake.CTestTimeout` failed on GNU/Hurd because the
`sleep` command does not set `errno` to `EINTR` when interrupted by a
signal, which is a Linux-specific feature.
2023-12-08 09:07:24 -05:00
Brad King
101ac06b28 Tests: Update for changes to upstream ninja development version
Account for:

* commit `8f47d5aa33` (Remove `-w dupbuild` completely, always error
                       on duplicate edges, 2023-11-29)
* commit `4d98903d4c` (Improve misleading error message when an output
                       is defined multiple times, 2023-12-06)
2023-12-08 09:04:44 -05:00
Daniel Ching
f20c5c6f20 MSVC: Teach find_library to consider Rust's '${name}.dll.lib' convention
This convention is used by Rust toolchains (rustc/cargo/cargo-c) for the
MSVC ABI.

Fixes: #25478
2023-12-07 19:19:00 -06:00
Brad King
7170b9cf45 Tests: Fix RunCMake.try_run case on gfortran < 4.3
Since commit 0f37000304 (try_{compile,run}: add LINKER_LANGUAGE option,
2023-10-12) the test has failed with gfortran < 4.3 because it does
not support the Fortran syntax used by the test.  Add a version check.
2023-12-07 10:49:25 -05:00
Brad King
30ab0f576f Tests: Add inspection step to RunCMake.try_run 2023-12-07 10:49:25 -05:00
Brad King
a5de5da9ca Tests: Remove unused code from RunCMake.try_run 2023-12-07 10:49:23 -05:00
Brad King
7598ea5389 Tests: Add case covering find_library behavior when targeting MSVC ABI 2023-12-07 10:15:12 -05:00
Brad King
256d532593 Merge topic 'GoogleTest-discovery-scope'
0767016eab GoogleTest: Avoid silent failures of dynamic test discovery

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9038
2023-12-07 09:20:43 -05:00
Brad King
b2b0d839c1 Merge topic 'LLVMFlang-MSVC'
cd28915260 LLVMFlang: Update MSVC ABI and architecture detection for LLVMFlang 18.0
48302b469e LLVMFlang: Update MSVC runtime library selection for LLVMFlang 18.0
1c07758ca2 CMakeParseImplicitLinkInfo: Exclude LLVMFlang program entry point for MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9036
2023-12-07 09:16:11 -05:00
Brad King
f0deb107c5 Merge topic 'cmuvprocesschain-external-loop'
0b043a75b7 cmUVProcessChain: Add option for external uv_loop_t

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9040
2023-12-07 09:13:57 -05:00
Brad King
48302b469e LLVMFlang: Update MSVC runtime library selection for LLVMFlang 18.0
LLVMFlang 18.0 adds MSVC runtime library selection flags and associated
Fortran runtime library variants.  Resolve the corresponding FIXME left
by commit 26bf32cdc6 (LLVMFlang: Add support for targeting MSVC ABI on
Windows, 2023-09-28, v3.28.0-rc1~10^2).

Issue: #24840
2023-12-06 09:42:07 -05:00
Brad King
1c07758ca2 CMakeParseImplicitLinkInfo: Exclude LLVMFlang program entry point for MSVC
As of llvm-project `main` branch commit `86accd4e03` (2023-12-04),
LLVMFlang 18.0.0, when used to drive linking an executable, emits a MSVC
linker flag to use all object files from the `Fortran_main` library.
These object files are meant for use when linking the program entry
point, and so are not implicit link dependencies of Fortran libraries.
2023-12-06 09:42:07 -05:00
Brad King
ca1e00e2bf Merge topic 'cxxmodules-msvc-corner-cases'
e63983956d Tests/CXXModules: enhance `internal-partitions` test
8a658fb9ec Tests/CXXModules: import from an internal partition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9039
2023-12-06 08:52:07 -05:00
Brad King
ee79d06d45 Merge topic 'cxxmodules-msvc-corner-cases' into release-3.28
e63983956d Tests/CXXModules: enhance `internal-partitions` test
8a658fb9ec Tests/CXXModules: import from an internal partition

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9039
2023-12-06 08:52:06 -05:00
Brad King
e913ee37f3 Merge topic 'fix-cxx-module-transitive-requirements'
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9030
2023-12-06 08:51:20 -05:00
Brad King
ef9cba9f42 Merge topic 'fix-cxx-module-transitive-requirements' into release-3.28
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9030
2023-12-06 08:51:18 -05:00
Brad King
5b6f7f44fb Merge topic 'LLVMFlang-MSVC-debug'
ef49ed0fe1 LLVMFlang: Fix MSVC ABI debug information format options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9037
2023-12-06 08:50:18 -05:00
Brad King
91392d7741 Merge topic 'LLVMFlang-MSVC-debug' into release-3.28
ef49ed0fe1 LLVMFlang: Fix MSVC ABI debug information format options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9037
2023-12-06 08:50:17 -05:00
Moritz Haase
0767016eab GoogleTest: Avoid silent failures of dynamic test discovery
The internal helper variable '_GOOGLETEST_DISCOVER_TESTS_SCRIPT' can have gone
out-of-scope when 'gtest_discover_tests()' is called, depending on where the
GoogleTest module is actually included. This leads to a silent failure of
dynamic test discovery, since the custom post-build commands actually does
nothing (it basically invokes 'cmake -P ""'). Ctest will then fail to run the
tests, considering them to be 'not built'.

Fix this by determining the path to the GoogleTest module based on
'${CMAKE_ROOT}' instead, which is always available.

A new test case was added to test suite 'RunCMake/GoogleTest' to ensure that
'gtest_discover_tests()' works correctly when invoked in a different variable
scope.

Fixes: #25477
2023-12-06 12:52:18 +01:00
Kyle Edwards
0b043a75b7 cmUVProcessChain: Add option for external uv_loop_t 2023-12-05 14:48:24 -05:00
namniav
e9b0dcbbfa cmCxxModuleMapper: Fix transitive requirements computation
Previously CMake may generate incomplete transitive requirements in
CMakeFiles/<target>.dir/CXXModules.json and therefore in module mapper
for compiler, when source files were listed in CMakeList.txt in a
certain order.

This commit fixes the problem by correctly tracking unfinished
transitive requirements computation of module units.

There have been a simple circular test case whose circular dependency
was reported by build system. Now with this correct implementation it's
reported by CMake generating module mappers.

Add two test cases for transitive requirements computation, one with
adding source files in hardcoded order, and the other in randomized
order.

Fixes: #25465
2023-12-05 10:26:10 -05:00
Brad King
e05cd2871d Merge topic 'cxxmodules-pch'
40dc13b242 cmNinjaTargetGenerator: PCH files do not need dyndep
f61c64cd1c cmLocalGenerator: prevent scanning of PCH source files
ea8c37b759 Tests/CXXModules: add a test which scans a PCH-using source

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9032
2023-12-05 09:25:51 -05:00
Ben Boeckel
e63983956d Tests/CXXModules: enhance internal-partitions test
This test previously did not *require* that the internal partition be
specified as a transitive usage because nothing from it was exposed.
Plumb through usages such that the internal partitions are required.
2023-12-05 09:19:32 -05:00
Ben Boeckel
8a658fb9ec Tests/CXXModules: import from an internal partition
It is reported that MSVC doesn't support the `modname=` syntax in its
`-reference modname=modname.ifc` for internal partitions. Add a test
case.
2023-12-05 08:17:46 -05:00
Brad King
ef49ed0fe1 LLVMFlang: Fix MSVC ABI debug information format options
In commit 26bf32cdc6 (LLVMFlang: Add support for targeting MSVC ABI on
Windows, 2023-09-28, v3.28.0-rc1~10^2) we incorrectly recorded `-g` as
supporting the `ProgramDatabase` format, but it is actually `Embedded`,
matching Clang.

In order to support easy integration with C and C++ projects that use
the `.pdb` debug formats, pretend LLVMFlang supports them and just don't
actually emit any debug information.

Issue: #24840
2023-12-04 20:30:46 -05:00
Brad King
ef89ad6c55 Merge topic 'ctest-jobserver-client'
80fe56c481 ctest: Add support for running under a make job server on POSIX systems
5396f4a9a3 cmUVJobServerClient: Add libuv-based job server integration client

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9021
2023-12-04 09:47:25 -05:00
Brad King
9cb1471ff6 Merge topic 'fileapi-exe-launcher'
80a64c9ce5 fileapi: Add cross-compiling emulator to codemodel-v2

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8964
2023-12-04 09:43:05 -05:00
Brad King
4b13f8866d Merge topic 'cmake-non-writable-build-dir'
0fd64345fe Tests: Add case covering non-writable CMAKE_BINARY_DIR
d91c02e40f Tests: Factor out RunCMake helper to get UNIX user id
5799d0e788 cmake: Improve error message if CMAKE_BINARY_DIR not writable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !8970
2023-12-04 09:40:20 -05:00
Ben Boeckel
ea8c37b759 Tests/CXXModules: add a test which scans a PCH-using source
This tests that PCH usage works with scanning logic.
2023-12-04 07:20:36 -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
47fbb29ad7 cmUVHandlePtr: Fix conversion to bool on Oracle Studio compiler
The operator added by commit 17690558c3 (cmUVHandlePtr: Add explicit
conversion to bool, 2023-10-26) works in direct expressions like
`if(foo)` but not compound expressions like `if(foo && ...)`.
Drop the `explicit` mark when compiling with Oracle Studio so we
can at least compile valid code.
2023-12-02 06:37:40 -05:00
Ralf Habacker
80a64c9ce5 fileapi: Add cross-compiling emulator to codemodel-v2
Fixes: #25408
2023-12-01 10:57:15 -05:00
Brad King
b52f824577 Merge topic 'xcode-embed-xpc-services'
2b4bb43ed3 Xcode: Add support to embed XPC Services

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9006
2023-12-01 09:05:00 -05:00
Brad King
0fd64345fe Tests: Add case covering non-writable CMAKE_BINARY_DIR
Issue: #24407
2023-11-30 17:07:31 -05:00
Brad King
d91c02e40f Tests: Factor out RunCMake helper to get UNIX user id 2023-11-30 17:05:00 -05:00