matepek / vscode-catch2-test-adapter

Catch2, Google Test and doctest Adapter for the VSCode
https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter
MIT License
210 stars 52 forks source link

advancedExecutables doesnt seem to support symlinked executables #400

Open delfu opened 1 year ago

delfu commented 1 year ago

Checklist

Describe the bug

Using the setting testMate.cpp.test.advancedExecutables, setting a pattern to be a symlink to an executable, the test doesnt seem to be picked up.

If instead, i set the pattern to the absolute path of the executable, the Test Explorer works as expected

To Reproduce

  1. add this setting
"testMate.cpp.test.advancedExecutables": [
      {
        "pattern": "build/linkToExecutable",
        "catch2": {
          "testGrouping": {
            "groupByExecutable": {
              "groupBySource": {
                "label": "${sourceRelPath[-1]}",
                "groupByTags": true
              }
            }
          }
        }
      }
    ],

expected:

result:

Desktop

Logs [2023-10-17 23:12:57.057] [INFO] Activating extension [2023-10-17 23:12:57.058] [INFO] Activation finished [2023-10-17 23:12:59.505] [INFO] context:executables [ { pattern: 'build/linkToExecutable', catch2: { testGrouping: { groupByExecutable: [Object] } } } ] [2023-10-17 23:12:59.507] [DEBUG] ExecutableConfig.resolveVariable: { value: 'build/linkToExecutable', resolved: Promise { }, strictAllowed: false } [2023-10-17 23:12:59.507] [INFO] pattern build/linkToExecutable /Users/delongfu/workspace { isAbsolute: false, absPath: '/Users/delongfu/workspace/build/linkToExecutable', isPartOfWs: true, relativeToWsPosix: 'build/linkToExecutable' }

matepek commented 1 year ago

vscode.workspace.findFiles ignores them. But there are other issues with symlinks. The symlink is not updated when the source has been changed. Would you tell me more about your use case? Have you considered hard links?

delfu commented 1 year ago

thank you for the reply! we use bazel for building and the output folder isnt deterministic (differs person to person) . so this was the only way i could think of for testmate to discover the executable. What would be downsides to using a hardlink?

matepek commented 1 year ago

What would be downsides to using a hardlink?

Probably nothing. Should be fine.

Also you could use something like build/user_*/**/test*. Or build/${os_env:USER}/**/test*.

Also you could customise .vscode/settings.json content.

matepek commented 10 months ago

might interesting to check https://github.com/matepek/vscode-catch2-test-adapter/issues/414