Skip to content

[Feature] Support a new cmake.testEnvironment similar to cmake.testArgs #4572

@Ipiano

Description

@Ipiano

Request Overview

I have a somewhat complicated CTest configuration that requires setting a number of environment variables while tests are being executed. The VS Code test explorer works correctly to run tests and report success; and I can attempt to debug one using the configuration outlined here: https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md#debugging-tests, but when debugging the tests, the necessary environment variables (like LD_LIBRARY_PATH) aren't set.

vscode-cmake-tools supports exposing cmake.testArgs to the launch config. I am requesting a similar cmake.testEnvironment that would allow me to pass through any environment variables that CTest has set during test execution.

It looks like this is less trivial to extract from CTest, because the format provided by the json-v1 format doesn't match the format launch.json takes - CTest provides something like:

"properties": [
    {
        "name": "ENVIRONMENT",
        "value": ["A=B", "C=D"...]
    }
]

and launch.json is expecting

  "environment": [{ "name": "A", "value": "B" }, { "name": "C", "value": "D" ],

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementan enhancement to the product that is either not present or an improvement to an existing feature

    Type

    No type

    Projects

    Status

    Blocked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions