Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different issues when using MinGW and Cygwin GCC Toolchains #455

Open
SaturnIC opened this issue Nov 26, 2024 · 3 comments
Open

Different issues when using MinGW and Cygwin GCC Toolchains #455

SaturnIC opened this issue Nov 26, 2024 · 3 comments
Labels
incomplete Make sure you followed the issue template

Comments

@SaturnIC
Copy link

SaturnIC commented Nov 26, 2024

First of all this a great extension and it works perfectly fine in my linux environment.

Unfortunately for work i still have to use Microsuck OS so i am forced to use either Cygwin
or MinGW to compile our google test suite.

I have different issues with both of those toolchains and this testadapter and maybe there is some configuration to work around those issues?

1. Cygwin

Debugging and running tests from test explorer works but not from the source code, also it is not possible to jump to the source code by double clicking on the test in the test explorer.
I think the cause of those issues is that cygwin uses a /cygrive/c path to mount the C:/ folder and testmate can't parse those virtual
cygwin paths.
Maybe there is a configuration to work around those virtual paths?

2. Mingw

Jumping to test source code from test explorer works because unlike cygdrive mingw translates C:/ to /c which powershell can find by itself.
"Run Tests" works from the green button in the source code and from the test explorer.
But debugging doesn't work neither from the test explorer nor from the green buttons in the source.
I dont know what the debug issue with MinGW might be since i did install gdb and it is available as first find in environment path variable.

BR

@SaturnIC
Copy link
Author

SaturnIC commented Nov 26, 2024

I could solve the debugging problem under MinGW
i had to add a settings.json configuration for debug:

{
  "testMate.cpp.test.executables": "**/*test.exe",
  "testMate.cpp.debug.configTemplate": {
    "type": "cppdbg",
    "program": "${exec}",
    "args": "${argsArray}",
    "cwd": "${cwd}",
    "env": "${envObj}",
    "environment": "${envObjArray}",
    "sourceFileMap": "${sourceFileMapObj}",
    "MIMode": "gdb",
    "miDebuggerPath": "C:\\GCCRuntime\\msys2\\ucrt64\\bin\\gdb.exe"
},

or add the debugger path to the launch.json

{
   "version": "0.2.0",
   "configurations": [
      {
         "name": "CMake: Configure project",
         "type": "cmake",
         "request": "launch",
         "cmakeDebugType": "configure",
         "clean": true,
         "configureAll": false
      },
      {
         "name": "Build + Debug App-test",
         "type": "cppdbg",
         "request": "launch",
         "program": "${workspaceRoot}/cmake-build-debug/App_lib/unit-test-tests/APP-test",
         "cwd": "${workspaceRoot}",
         "preLaunchTask": "Build APP-test Debug",
         "MIMode": "gdb",
         "miDebuggerPath": "C:\\GCCRuntime\\msys2\\ucrt64\\bin\\gdb.exe"
      },
      {
         "name": "Build + Run App-test",
         "type": "cppdbg",
         "request": "launch",
         "program": "${workspaceRoot}/cmake-build-debug/App_lib/unit-test-tests/APP-test",
         "cwd": "${workspaceRoot}",
         "preLaunchTask": "Build APP-test Release"
      },
   ]
}

@SaturnIC
Copy link
Author

SaturnIC commented Nov 26, 2024

For the virtual cygwin paths there is an exe file called cygpath to translate those to the equivalent windows paths.

Can this tool be given to the test adapter via the settings file to map those virtual paths to real paths so that the test adapter can find the corresponding source files?

@matepek
Copy link
Owner

matepek commented Dec 18, 2024

It could I assume. It's just such a corner case..

This is the relevant code

The advance executable sourceFileMap might solves it.

@matepek matepek added the incomplete Make sure you followed the issue template label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Make sure you followed the issue template
Projects
None yet
Development

No branches or pull requests

2 participants