microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.43k stars 429 forks source link

Unable to run CTest in parallel #3812

Closed Jepsson closed 3 weeks ago

Jepsson commented 3 weeks ago

Brief Issue Summary

After updating to v1.18(from v1.17) I am unable to run our google tests using the "Run CTest" button in the status bar,

I am using a CMakePresets.json which looks like this:

"testPresets": [
        {
            "name": "unit-test",
            "execution": {
                "jobs": 16
            },
            "configurePreset": "unit_test"
        }
]

and also setting "cmake.ctest.allowParallelJobs": true

In version v1.18 Ctest command generated: /usr/bin/ctest -T test --output-on-failure --parallel 16 -j18 -R ^<big chunk of tests> Output from command:

[ctest] RegularExpression::compile(): Expression too big.
[ctest] No tests were found!!!

In version v1.17 Ctest command generated: /usr/bin/ctest -T test --output-on-failure --parallel 16

other info If I set "cmake.ctest.allowParallelJobs": false I can run the tests but they take ages to run(~1700 tests), and when running in parallell it takes ~4 seconds. It also seems very strange that the extension adds a flag(--parallel 16) for my specified number of jobs in CMakePresets.json and also a flag(-j18) when setting allowParallelJobs to true.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.89.1",
  "cmtVersion": "1.18.41",
  "configurations": [
    {
      "folder": "/home/jepsson/git/repoxxx",
      "cmakeVersion": "3.16.3",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": true,
      "compilers": {
        "C": "/usr/bin/clang-12",
        "CXX": "/usr/bin/clang++-12"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 126,
    "executablesCount": 1,
    "librariesCount": 36,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": false
    }
  ]
}

Debug Log

No response

Additional Information

No response

gcampbell-msft commented 3 weeks ago

@Jepsson Hi, we're having conversation about this regression in this issue as well: #3804. I'm going to close this one as a duplicate, but please see this comment and try to install the vsix (after renaming from a .zip), and see if it fixes your issue. If it does, then I'll create a merge a PR. Thanks!

gcampbell-msft commented 3 weeks ago

@Jepsson Could you confirm that the vsix in that comment fixes your issue?

Jepsson commented 3 weeks ago

@gcampbell-msft I have installed the vsix and it works, thank you! It's still a bit strange that the ctest command includes the "--parallel/-j" flag two times, i.e. /usr/bin/ctest -T test --output-on-failure --parallel 16 -j18