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

fail to loading testing binary #420

Closed iambingoNJU closed 9 months ago

iambingoNJU commented 10 months ago

image

Where is the log output of this plugin, I can't find any log about this plugin.

And no test case is shown in TESTING colume. It seems TestMate C++ is disabled.

iambingoNJU commented 10 months ago

I have Cmake Tools extension installed.

iambingoNJU commented 10 months ago

And my test binary is on build directory and has test keyword.

geertj commented 9 months ago

I have the same issue. This appears to be a regression in v4.8.0. In v4.7.0, my test binaries are correctly scanned and show up in the test explorer. In v4.8.0 they do not show up. I also use CMake Tools, but I am not sure it is related.

Per the changelog, files matching files.watcherExclude are ignored in v4.8.0. I removed my build/ directory (which contains my test binaries) from the ignore list, and this did not make a difference, even after reloading.

ryanjmulder commented 9 months ago

I also have this issue. From the logs, it seems that 4.8.0 never transitions into the "Checking file for tests: " log statements.

Here's the not working log from 4.8.0

[2024-02-06 20:02:45.194] [INFO] 8
[2024-02-06 20:02:45.194] [INFO] `test.advancedExecutables` is not defined. trying to use `test.executables`
[2024-02-06 20:02:45.195] [DEBUG] ExecutableConfig.resolveVariable:  {
  value: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*',
  resolved: Promise { <pending> },
  strictAllowed: false
}
[2024-02-06 20:02:45.196] [INFO] pattern {build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}* /home/rmulder/devel/MonitoringController/monitoring-controller/tests {
  isAbsolute: false,
  absPath: '/home/rmulder/devel/MonitoringController/monitoring-controller/tests/{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*',
  isPartOfWs: true,
  relativeToWsPosix: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*'
}

Here's the working log from 4.7.0

[2024-02-06 20:05:58.310] [INFO] 8
[2024-02-06 20:05:58.310] [INFO] `test.advancedExecutables` is not defined. trying to use `test.executables`
[2024-02-06 20:05:58.311] [DEBUG] ExecutableConfig.resolveVariable:  {
  value: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*',
  resolved: Promise { <pending> },
  strictAllowed: false
}
[2024-02-06 20:05:58.312] [INFO] pattern {build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}* /home/rmulder/devel/MonitoringController/monitoring-controller/tests {
  isAbsolute: false,
  absPath: '/home/rmulder/devel/MonitoringController/monitoring-controller/tests/{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*',
  isPartOfWs: true,
  relativeToWsPosix: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*'
}
[2024-02-06 20:05:58.331] [DEBUG] Checking file for tests: ... 
{and many more lines like this}
matepek commented 9 months ago

Please follow the instructions in template

matepek commented 9 months ago

Released a new version with improved logging. I bet your issue is related to the files.watcherExclude config which is respected since v4.8.0.

I'm closing this in faith that I'm right and the issue can be easily solved but let me know if I'm wrong and we can investigate further. Also let me know if changing that config makes your workflow uncomfortable in some way. Bests,

geertj commented 9 months ago

[EDIT 2/16 to give more specific information about our use case]

@matepek I did some more investigation. It appears that there are actually two settings: files.watcherExclude and files.exclude. On 4.7.0, both appear to be ignored. However, in 4.8.3 both settings must not contain a pattern that excludes the executable. If I remove the exclusion in both places, the tests show up.

In our CMake use case, we have a "build" symlink in each package root that points to a directory containing the build artifacts including test binaries. We'd like to not show that directory in the file browser, but we do need TestMate to scan that directory for tests. Tests are never installed, so there's no other directory to look for.

Any thoughts on how to best achieve this?

I also looked at #414, which seems to be the driver for honoring files.exclude. As I understand it, the use case there is that the build directory is too large to be scanned, and the solution is to copy the tests to a different directory that is much smaller and is scannable. The user then points test.executables to that directory instead, while presumably keeping the build directory excluded. Why would TestMate have to honor files.exclude in this case, since test.executables doesn't point to a large directory anymore?

Hope you see this update even if the issue is closed. I don't seem to be getting any email updates for it though, so I may open a new issue to just make sure you see this.