vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

Don't force build to list tests

Open sercxanto opened this issue 2 years ago • 1 comments

Brief Issue Summary

To list the tests the CMake tools forcibly build the project. It should be possible to list the tests without building them first for the following reasons:

  • For very large projects it is not feasible to build the full project upfront if you just work on a subsets of targets and their tests
  • Some of the tests might even not need to have any targets build

In other words it should to do the same with CMake tools as with command line CMake / ctest:

cmake --preset=my_default
# List tests:
ctest --preset=my_default -N
# Run helper test (does not need any compilation step):
ctest --preset=my_default -R helper

Steps to reproduce:

  • Select configure preset
  • Select test preset
  • Now CMake tools automatically run a build
  • Only after building its possible to see the list of tests

A simple CMake project to reproduce this issue is available in this github repo.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.82.2",
  "cmtVersion": "1.15.31",
  "configurations": [
    {
      "folder": "/home/gal/projekte/cmake_playground",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

No response

Additional Information

No response

sercxanto avatar Oct 20 '23 16:10 sercxanto

@sercxanto Thanks for the issue. I'm adding this to our list of ctest suggestions / issues.

@xisui-MSFT FYI.

gcampbell-msft avatar Oct 27 '23 13:10 gcampbell-msft

@gcampbell-msft this issue seems to be a duplicate of #2933. Am i wrong?

hippo91 avatar Dec 14 '24 10:12 hippo91

Yes, I believe you are right, we should likely add a setting that controls whether we force a build before running ctest, similar to the cmake.buildBeforeRun setting. Closing this in favor of #2933

gcampbell-msft avatar Dec 16 '24 14:12 gcampbell-msft