question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Couldn't make executionWrapper to work

See original GitHub issue

Checklist

  • The issue is about this extension and NOT about a fork.
  • Check the known issues list.
  • 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

I test the code that is supposed to run under the root privileges. Moreover, I do use remote to debug, but this is not the failure I see in the ticket #201 that is mentioned above. The problem is that the executionWrapper doesn’t work for me. The configuration is as follows:

    "testMate.cpp.test.advancedExecutables": [ 
        {
            "name" : "gtest",
            "pattern": "**/gtest",
            "executionWrapper": {
                "path": "sudo",
                "args": [ "${argsFlat}", "-d", "5" ]
            },
        }
    ],

My gtest executable was added to NOPASSWD list in the sudoers files for my account. I’ve tested the command by manually running it from the command line and it worked. It ran without asking for the password. Moreover, the Test-Explorer shows the list of the tests correctly. But when I request to run a test, in the output window I see that it shows that sudo wasn’t called and even other argument specified about (i.e. “-d”, “5”) do not appear:

$12│ ❌ Executable run is finished with error.$12│ "~/github/project/tests/googletest/gtest"" "--gtest_color=no"" "--gtest_filter=<here is a long list of the selected group of tests"" "--gtest_also_run_disabled_tests""$12│ ❗️ Test has ended unexpectedly: Signal received: SIGSEGV

As you can see neiter sudo nor extra arguments appear there. I also tried to replace in the settings the line "args": [ "${argsFlat}", "-d", "5" ] with "args": [ "${cmd}", "${argsFlat}", "-d", "5" ], which made it only worse. In the latter configuration even Test Explorer shows nothing.

To Reproduce

To reproduce the failure I believe you need the following:

  1. Create a VM with Ubuntu (I am using 20.04)
  2. Set the configurations to allow SSH connection to the VM from the Windows machine
  3. Create a directory on a drive of this VM and place there a simple c++ hello world with google tests and dummy tests
  4. From a Windows Machine open VSCode
  5. Install Remote Development extension pack
  6. Use Command Palette to invoke “Remote-SSH: Connect to Host …”
  7. Install “C++ TestMate” and configure the setting as specified above.
  8. Compile the program with the tests and try to issue the unit-tests

Desktop

  • Extension Version: v4.3.0
  • VS Code Version: 1.71.2
  • Google Test: Unfortunately, I don’t know; I only know that it came after 2017 at least (if not later)
  • OS Type and Version: Windows 11
  • Using remote-ssh/docker/wsl?: Remote-SSH to a server running Ubuntu Server 20.04

Regression bug?

I tried even with C++ TestMate Legacy. There results even worse, I have no idea how to get the logs of the failure.

  • Last extension version in which the feature were working: Never seen it working

Log (optional but recommended)

I have the only log that I mentioned above.

Thank you, Arseniy

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
matepekcommented, Sep 28, 2022

Happy to hear that the main problem is solved.

Regarding to the parallelism. I’m afraid you did set the settings right…

One possible explanation could be that your tests depending on each other in an ordered way. The extension has its own ordering an it will run the tests in that order. Try to run your executable a couple of times from command lines with shuffling. If it fails that would mean that the issue is probably in your code not in the extension. If succeeds fine like 10 times then it likely the extensions fault.

In that case please open a new issue with log attached and I will look into it. (or you can try to read it too, not too complicated)

0reactions
are-sceniccommented, Sep 27, 2022

Hi @matepek, I’ve tried your idea with SETUID and it works great. Thank you. Now I finally can run and debug conveniently the code, without using sudo as an execution-wrapper.

However, I have encountered another issue. Some tests in our test-suite are running on HW, and as such cannot run simultaneously. Following the guidelines of the documentation I added the following settings to my settings.json to ensure no parallelism and infinite time of execution:

    "testMate.cpp.test.parallelExecutionLimit": 1,
    "testMate.cpp.test.parallelExecutionOfExecutableLimit": 1,
    "testMate.cpp.test.runtimeLimit": 0,

When I run the tests from the command line manually, the tests are passing without an issue. When I run it from the VSCODE each test-suite independently, the tests of each test-suite pass perfectly. However, if I request to run them all, the tests start colliding and start failing. Is there something in the settings that I should configure more? Am I missing something?

Thank you, Arseniy

Read more comments on GitHub >

github_iconTop Results From Across the Web

why doesn't task wrapper function work - Stack Overflow
'gradlew wrapper throws error, because certain wrapper doesn't exist under maven and the sub build.gradle uses it to download 2.14.1.prom and ...
Read more >
Building Java maven project with mvnw wrapper fails ... - GitHub
Building Java maven project with mvnw wrapper fails on Windows #58 ... Failed to run /bin/build: couldn't make "./mvnw" executable: chmod .
Read more >
What is the purpose of a wrapper class that does nothing but ...
It only passes execution to the nested object. So ServletResponseWrapper cannot function unless there is some other class (let's say ...
Read more >
10 Gradle best practices to supercharge your project
1. Always use the Gradle wrapper. The wrapper is a special script included in your project which handles downloading the correct Gradle version ......
Read more >
How can I resolve the error "cannot execute binary file"?
The problem is running a binary for a different processor architecture. You can use objdump (from binutils) to check ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found