Fix ctest reporting success when requested tests match nothing (#4915) - #5013
Open
Omotola wants to merge 1 commit into
Open
Fix ctest reporting success when requested tests match nothing (#4915)#5013Omotola wants to merge 1 commit into
Omotola wants to merge 1 commit into
Conversation
When specific tests are requested but none match a discovered test, ctest
exits 0 ("No tests were found!!!"), which callers such as the API/Copilot
agent misread as success. Return a failure with a clear message when tests
exist but the requested ones weren't found, in both the Test Explorer
(runCTestHelper) and direct (runCTestDirectly) paths.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Fixes #4915
When specific tests are requested but none match a discovered test,
ctestruns a filter that matches nothing and still exits0("No tests were found!!!"). Callers such as the API/Copilot agent read that0as success, so an agent that passes a partial or non-existent test name gets told "all tests passed" when nothing ran.This returns a failure (with a clear message) when tests exist but the requested ones weren't found. It's applied in both run paths:
runCTestHelper(Test Explorer integration, the default) — the zero-match case was already detected and logged, now it also returns a non-zero exit code.runCTestDirectly(Test Explorer integration disabled) — added a guard before running ctest.The message is also placed in the result's
stderrso it can surface to the caller.Per the issue discussion, this only fails when tests are available but the requested name isn't found — a project with no tests at all is not treated as an error.
Testing
["ClassTest"](real tests areClassTest.Test1/2/3) reported success with nothing run.ctest -R <nonMatching>exits0, while the extension now returns a failure for that case.yarn compileclean; unit tests pass (only the pre-existingselect-debuggerfakebin failures remain, unrelated).Before

After
