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

Using ${label} and ${parentLabel} on preLaunchTask to start gdbserver of the selected Gtest binary #450

Closed
5 tasks done
andreucv opened this issue Nov 7, 2024 · 3 comments

Comments

@andreucv
Copy link

andreucv commented Nov 7, 2024

Checklist

  • The issue is about this extension and NOT about a fork.
  • Checked the ALL the SUPPORT document.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue
  • Imagine yourself into my position and think how hard to debug the issue without insufficient information.
    I understand that you have privacy concerns and I expect you to understand that this extension is developed for free.
    Thanks.

Describe the bug

Situation:
To run a GTest binary I create a docker container with the sdk and the toolchain needed to execute it. I created a wrapper to execute them using your extension, and it works good.
I build multiple GTest binaries from different components in my repository.
In order to improve performance, how I do it is to maintain the docker container started, and use the executionWrapper setting to execute the GTest binary using a docker exec container_id sh -c ./gtest_component_name_binary.

Problem:
Then, as a next step, I want to apply the debug configuration.
I'm blocked, as to be able to debug, when I am clicking on the test's debug button I need to start a gdbserver session for the GTest binary selected (I thought on using the ${parentLabel} which I set to be the GTest binary name).
I thought on doing that on the preLaunchTask.

However, I have not found any way to pass parameters to the preLaunchTask, as it can only be set as a name of a task inside tasks.json, and I cannot pass the binary name or the testname to do it automatically.
I would like to avoid any other user interaction.
Do you know how I could do that?

To Reproduce
1. Go to Testing Section
2. Click on Debug Test button

Desktop

  • Extension Version: v4.12.2
  • VS Code Version: 1.95.1
  • OS Type and Version: Ubuntu 24.04
  • Using remote-ssh/docker/wsl?: remote-devcontainers

How I use debug.configTemplate:
image

How I thought it could be used (and doesn't work, this task is not recognized as a task):
image

@matepek
Copy link
Owner

matepek commented Nov 8, 2024

(corrected)

These variables are available: https://github.com/matepek/vscode-catch2-test-adapter/blob/3dc483b012d34d6f80ff76a19b70144caec6c34b/src/WorkspaceManager.ts/#L351-L359

And I can make these available relatively easy: - https://github.com/matepek/vscode-catch2-test-adapter/blob/3dc483b012d34d6f80ff76a19b70144caec6c34b/src/WorkspaceManager.ts/#L450-L476

IF the preLaunchTask is inside the debugConfig then both set should be available already. But as you tried it does not work but thats on the debugger not on the extension.

@matepek
Copy link
Owner

matepek commented Nov 8, 2024

Ah, got confused. That works for the

"runTask" {
  "before": ["task"],
}

only.

@matepek
Copy link
Owner

matepek commented Nov 8, 2024

What you can use from any tasks are ${testMate.cmd.get-debug-exec} and ${testMate.cmd.get-debug-args}.

(forgot about this functionality, hehhe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants