Add variable support for ctestArgs and ctestDefaultArgs#4925
Open
Omotola wants to merge 1 commit into
Open
Conversation
Enables test-specific argument expansion in cmake.ctestArgs and
cmake.ctestDefaultArgs using the ${testName} placeholder. This allows
users to generate per-test output (e.g., --output-log ${testName}.log)
instead of having all tests overwrite the same file.
The variable is expanded when a single test is being run:
- Non-parallel mode: expanded per-test in the sequential loop
- Parallel mode: expanded when exactly one test is targeted
- Direct ctest path: expanded when testsToRun has one entry
When multiple tests run in a batch, a warning is logged and the
variable is not expanded. Args containing ${testName} (and their
preceding flags) are filtered out when no test name is available,
preventing literal placeholders from being passed to ctest.
Resolves #4416
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
cc5e5fe to
c8bb730
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Enables test-specific argument expansion in
cmake.ctestArgsandcmake.ctestDefaultArgsusing the${testName}placeholder. This allows users to generate per-test log files (e.g.,
--output-log /logs/${testName}.log) insteadof having all tests overwrite the same file.
Resolves #4416
Changes
src/ctest.ts: Added${testName}variable to the expansion options ingetCTestArgs(). AddedhasTestNameVariable()helper to detect usage.package.nls.json: Updated setting descriptions forctestArgsandctestDefaultArgsto document the newvariable.
How it works
The
${testName}variable is expanded to the CTest test name when a single test is being executed:ctestinvocation)testsToRuncontains exactly one entryExample usage
Validation
