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

Ctest prints `[object Object]` after return code

Open benmcmorran opened this issue 1 year ago • 2 comments

Brief Issue Summary

After running a CTest suite, the line [ctest] [object Object] appears in the CMake/Build output pane. Something probably isn't getting deserialized correctly.

  1. Create a folder with these files:

CMakeLists.txt

project(ctest_issue)
include(CTest)
add_executable(main main.cpp)

main.cpp

int main() {}
  1. Open the folder in VS Code and run the CMake: Configure command.
  2. Run the CMake: Run Tests command.
  3. Check the content of the CMake/Build output pane.

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.86.1",
  "cmtVersion": "1.17.15",
  "configurations": [
    {
      "folder": "c:\\Users\\bemcmorr\\source\\repos\\ctest_issue",
      "cmakeVersion": "3.28.0",
      "configured": true,
      "generator": "Visual Studio 17 2022",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug",
      "Release",
      "MinSizeRel",
      "RelWithDebInfo"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 7,
    "executablesCount": 1,
    "librariesCount": 0,
    "targets": [
      {
        "name": "ALL_BUILD",
        "type": "UTILITY"
      },
      {
        "name": "Continuous",
        "type": "UTILITY"
      },
      {
        "name": "Experimental",
        "type": "UTILITY"
      },
      {
        "name": "Nightly",
        "type": "UTILITY"
      },
      {
        "name": "NightlyMemoryCheck",
        "type": "UTILITY"
      },
      {
        "name": "ZERO_CHECK",
        "type": "UTILITY"
      },
      {
        "name": "main",
        "type": "EXECUTABLE"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

[main] Building folder: ctest_issue 
[build] Starting build
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Main\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" --build c:/Users/bemcmorr/source/repos/ctest_issue/build --config Debug --target ALL_BUILD -j 18 --
[build] MSBuild version 17.10.0-preview-24073-01+f0936bf4b for .NET Framework
[build] 
[build]   1>Checking Build System
[build]   Building Custom Rule C:/Users/bemcmorr/source/repos/ctest_issue/CMakeLists.txt
[build]   main.cpp
[build]   main.vcxproj -> C:\Users\bemcmorr\source\repos\ctest_issue\build\Debug\main.exe
[build]   Building Custom Rule C:/Users/bemcmorr/source/repos/ctest_issue/CMakeLists.txt
[driver] Build completed: 00:00:01.310
[build] Build finished with exit code 0
[proc] Executing command: "C:\Program Files\Microsoft Visual Studio\2022\Main\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\ctest.exe" -j18 -C Debug -T test --output-on-failure -R ^c\:\/users\/bemcmorr\/source\/repos\/ctest_issue$
[ctest]    Site: REDACTED
[ctest]    Build name: Win32-MSBuild
[ctest] Test project C:/Users/bemcmorr/source/repos/ctest_issue/build
[ctest] No tests were found!!!
[ctest] CTest finished with return code 0
[ctest] [object Object]

Additional Information

No response

benmcmorran avatar Feb 14 '24 22:02 benmcmorran

The problem is here. The vscode.TestMessage is directly logged in ctestFailed(), but it's not a string.

benmcmorran avatar Feb 15 '24 17:02 benmcmorran

Thanks @benmcmorran, I've confirmed that this isn't a regression. However, I can confirm that this only repros if the cmake.ctest.allowParallelJobs setting is disabled. I've put the bug in to 1.18.

gcampbell-msft avatar Feb 15 '24 18:02 gcampbell-msft