Commit Graph

287 Commits

Author SHA1 Message Date
Brad King
8a2cdc6ada Merge topic 'normalize-input-paths'
08040ced86 cmake: Look up on-disk case of input paths on macOS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10020
2024-12-02 10:04:55 -05:00
YunQiang Su
08040ced86 cmake: Look up on-disk case of input paths on macOS
Follow up commit 1a6015e5fc (PathResolver: Add helper to compute
normalized paths, 2024-10-30) to cover on-disk case lookup on macOS.

Fixes: #26333
2024-12-01 07:12:51 -05:00
Brad King
bc77fb0d55 Tests/CMakeLib: Use more recent policies 2024-11-20 10:54:01 -05:00
Alex Turbov
dd0142e6d0 cmDocumentationFormatter: Refactor the PrintFormatted() method
- Introduce the `std::string Format(std:string)` method
- Simplify the algorithm to use `cmTokenizedView()` instead of pointers manipulation and slow iostreams
- Formatted text chunks are collected as a sequence of string views to join once at the end
2024-11-07 20:46:37 +04:00
Alex Turbov
ef88ec41f3 testDocumentationFormatter: Add some more test cases 2024-11-07 20:08:37 +04:00
Alex Turbov
f3f70c2f90 StringAlgorithms: Refactor cmTokenize() function
- Refactor and optimize the loop to make it shorter and faster
- Make it push elements into an arbitrary (templated) output iterator
- Make it a template on a separator type with the most used defaults
- Add a backward compatible signature to return `std::vector<std::string>`
- Add an alternative function `cmTokenizedView()` to return a vector of string views
2024-11-06 18:42:17 +04:00
Brad King
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory
Track the current working directory with symbolic links preserved.
2024-11-03 08:26:36 -05:00
Brad King
f9f4ab55ac Merge topic 'path-resolver'
1a6015e5fc PathResolver: Add helper to compute normalized paths
2a6f86ec5e Tests/CMakeLib: Remove stray output from test loop
646f37b473 clang-tidy: disable modernize-concat-nested-namespaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9965
2024-11-03 08:19:10 -05:00
Brad King
9fdf716ee8 Merge topic 'debug-adapter-value-formatting'
41621c3afb Debugger: Add Value Formatting support for StackTrace request

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9940
2024-11-01 09:16:18 -04:00
Brad King
1a6015e5fc PathResolver: Add helper to compute normalized paths
Create a `cm::PathResolver` helper to compute normalized paths.
Provide a common implementation with compile-time dispatch to
select details w.r.t. symbolic links, existence, and matching
the on-disk case of existing paths.  Later we can use this to
implement:

* `ToNormalizedPathOnDisk`: Normalizes paths while resolving symlinks
  only when followed by `..` components.  Does not require paths to
  exist, but reads on-disk case of paths that do exist (on Windows).

* `GetRealPath`: Normalizes paths while resolving all symlinks.
   Requires paths to exist, and reads their on-disk case (on Windows).

* `CollapseFullPath`: Normalizes paths in memory without disk access.
  Assumes components followed by `..` components are not symlinks.

Abstract filesystem access through runtime dispatch so that we can test
Windows symbolic link and network path behavior without relying on real
environments.  The overhead of runtime dispatch should be insignificant
during real filesystem access.

Issue: #16228
Issue: #17206
2024-11-01 08:44:17 -04:00
Brad King
2a6f86ec5e Tests/CMakeLib: Remove stray output from test loop 2024-10-31 09:51:33 -04:00
Jonathan Phippen
41621c3afb Debugger: Add Value Formatting support for StackTrace request
Add support for the "format" property of the Debug Adapter Protocol
StackTrace request to fulfill the host's request to format the resulting
StackFrame name differently.
2024-10-29 13:29:00 -07:00
Dylan Snelgrove
0f515c2d26 libuv: win/spawn: add option to use parent process error mode
Backport changes from libuv v2 commit `8ad246557a` (win,process: allow
users to configure child error mode, 2024-10-17) to add the
`UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE` option.

Also use `UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE` to keep
the behavior the same as before the option was added,
all child processes would be spawned the the parent's
error mode.

Issue: #20115
2024-10-25 08:51:45 -04:00
Alex Turbov
788e5c1043 Tests: Add tests for cmDocumentationFormatter::PrintFormatted() 2024-10-23 16:33:02 +04:00
Alex Turbov
0c17cc9ef5 cmJSONHelpers.h: Add FilteredObject helper
Iterate over the object's members and call a filter callable to decide what
to do with the current key/value. A filter returns one of the `FilterResult`
values. A container type is an associative or a sequence container of pairs
(key, value).

Refactor `MapFilter()` and `Map()` to use `FilteredObject()`. Moreover,
for C++ >= 17 implementation is more optimized depending on the given filter
object type and capable of detecting and properly calling the filter callable
using 1 or 3 arguments, up to totally eliminate any checking (even dummy)
in the generated code.

Supported container types, used to append key/value items, aren't limited to
`std::map` only and can be any associative container or a sequenced one with
pairs of key/value as elements.
2024-08-26 19:01:48 +04:00
Alex Turbov
cc20644c71 testCommon.h: Introduce ASSERT_EQUAL(actual, expected) macro
Performs `==` on given arguments and print an error if they are
not equal also printing their values.

Both arguments must be printable to `std::ostream`!
2024-08-21 02:24:16 +04:00
Alex Turbov
c553be501d CMakeLibTests: Use runTests
Also, improve it a little.
2024-08-14 01:31:46 +04:00
Alex Turbov
0146fca12d CMakeLibTests: include testCommon.h for ASSERT_TRUE
And remove duplicate definitions.
2024-08-14 01:04:15 +04:00
Alex Turbov
3d9c018f31 CMakeLibTests: Generate testConfig.h with source/build paths defined
And use it in all tests that had their particular files before.
2024-08-13 06:06:25 +04:00
Vito Gamberini
5fc2bad167 cmArgumentParser: Support binding with derived classes 2024-07-02 09:58:57 -04:00
Kyle Edwards
93e471f371 Tests: Build testUVProcessChainHelper with WIN32_LEAN_AND_MEAN 2024-02-27 14:36:40 -05:00
Christoph Grüninger
01c22dfaee Range-for loop with const reference
Prevent copy-ctor and dtor to be called.
Found by Cppcheck (constVariableReference)
2024-02-14 20:46:02 +01: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
d32c30906a Tests: Add missing include in testUVProcessChainHelper on Windows
We use `STATUS_ACCESS_VIOLATION` from `windows.h`.
2024-01-24 16:59:23 -05:00
Kyle Edwards
0b043a75b7 cmUVProcessChain: Add option for external uv_loop_t 2023-12-05 14:48:24 -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
Brad King
7ee5fb01c6 cmUVHandlePtr: Add uv_write wrapper to manage request lifetime
Provide a way to synchronously cancel a write request callback.
2023-11-22 07:12:38 -05:00
Brad King
fb7ee82271 cmUVHandlePtr: Add uv_idle_ptr::{start,stop} methods
These were missing w.r.t. the pattern established for other handle wrappers.
2023-11-20 18:22:53 -05:00
Brad King
9dd14b2946 cmUVHandlePtr: Add uv_timer_ptr::stop method
This was missing w.r.t. the pattern established for other handle wrappers.
2023-11-20 18:22:30 -05:00
Brad King
8908f277d9 Tests: Add dedicated test case for uv_timer_ptr 2023-11-20 18:22:09 -05:00
Brad King
f906e2482f Tests: Factor out callback in uv_idle_ptr test case 2023-11-20 18:22:03 -05:00
Brad King
89435a5662 Tests: Add dedicated test to cover cmUVHandlePtr types
Move the case added by commit 70d88a5361 (cmUVHandlePtr: Add
uv_idle_ptr, 2023-11-06) to a dedicated test.
2023-11-20 18:21:46 -05:00
Brad King
70d88a5361 cmUVHandlePtr: Add uv_idle_ptr
Wrap a `uv_idle_t` handle.
2023-11-17 08:51:25 -05:00
Brad King
17690558c3 cmUVHandlePtr: Add explicit conversion to bool 2023-11-17 08:50:53 -05:00
Brad King
85a9fe056f Merge topic 'cxx23'
a0fabc4769 cmGlobalGeneratorFactory: Provide complete cmGlobalGenerator to deleter
85627a93c9 cmCTestBuildCommand: Avoid requiring complete cmGlobalGenerator type publicly
641c02a3ce cmList: Avoid using operator-> on input iterator
e4483b8871 Tests: Avoid compiling call to dap::optional<dap::string>(nullptr)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8950
2023-11-08 10:32:04 -05:00
Brad King
e4483b8871 Tests: Avoid compiling call to dap::optional<dap::string>(nullptr) 2023-11-07 09:13:24 -05:00
Brad King
9627ef86c9 Merge topic 'debugger-function-name-in-stacktrace'
c028425df9 Debugger: report function name in DAP stackframes

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8913
2023-10-27 09:04:06 -04:00
Dmitry.Neverov
c028425df9 Debugger: report function name in DAP stackframes
Before a file name and a line were returned, but they can be
obtained by other means.

Fixes: #25091
2023-10-26 09:51:32 -04:00
Brad King
264dcae5e4 Tests: Fix clang -Wstrict-prototypes warnings 2023-10-26 09:20:45 -04:00
Ben Boeckel
b0612796b1 cmDebugTools: add header
This provides a utility macro which prints out:

- location of the call;
- the expression being evaluated; and
- the value of the expression.

Evaluates to the value of the expression.

Inspired by Rust's `dbg!` macro.

See: https://doc.rust-lang.org/stable/std/macro.dbg.html
2023-10-01 06:52:44 -04:00
Kyle Edwards
49a37d5a97 cmCTestScriptHandler: Replace cmsysProcess with cmUVProcessChain
And update cmSystemTools::WaitForLine() to use cmUVProcessChain.
2023-08-29 10:51:30 -04:00
Kyle Edwards
27be5ccd45 cmUVStreamRead: Return RAII handle to avoid memory leak 2023-08-25 10:44:06 -04:00
Kyle Edwards
439722993e CMakeLibTests: Compile with WIN32_LEAN_AND_MEAN 2023-08-21 14:48:07 -04:00
Brad King
df0a32f48e Merge topic 'debugger-pipe-connections'
8b1257e7bf Debugger: Replace libuv with platform-specific connection code

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8711
2023-08-19 08:46:01 -04:00
Paul Maybee
8b1257e7bf Debugger: Replace libuv with platform-specific connection code
Remove libuv usage from CMake debugger. Libuv has an async io model
and cppdap uses a sync model, so an extra thread and a buffer copy
were necessary to match semantics. In order to eliminate those
costs this commit implements the IO using platform specific APIs.
2023-08-17 10:11:33 -04:00
Brad King
5a7f30e532 Merge topic 'test-debugger-named-pipe-fix'
1a5cb0c1c1 testDebuggerNamedPipe: fix for cppdap with nlohmann_json

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8725
2023-08-16 13:31:57 -04:00
Đoàn Trần Công Danh
1a5cb0c1c1 testDebuggerNamedPipe: fix for cppdap with nlohmann_json
Fixes: #25190
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2023-08-16 10:24:08 -04:00
Brad King
5ed03aa07a Merge topic 'add-cm-fileno'
fbdb1fd843 Source: Add cm_fileno wrapper

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8686
2023-08-09 11:36:07 -04:00