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

Extension fails to capture some of the executables #213

Closed
3 tasks done
Sol1du2 opened this issue Jul 23, 2020 · 29 comments
Closed
3 tasks done

Extension fails to capture some of the executables #213

Sol1du2 opened this issue Jul 23, 2020 · 29 comments

Comments

@Sol1du2
Copy link

Sol1du2 commented Jul 23, 2020

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.

Describe the bug

I am trying to use this extension with GTest.

The extension seems to fail to capture most of my unittest executables, although the pattern seems to be ok. The log file shows it going through all of the right executables but it is only able to capture a couple. Here is the error message I get for the ones not captured:
[2020-07-23 12:13:02.828] [DEBUG] Not a test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe reason: [Error: Not a supported test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe

I can confirm the executable works fine and running cos_unittest.exe --gtest_list_tests shows a list of all tests. I can't really see the difference between this executable and one that the extension is able to capture. I wonder what is the procedure to capture a "supported test executable"? Maybe that could help me find what I need to do.

To Reproduce

Nothing special, just hitting the reload button in the test tab. Here are my settings:

"testMate.cpp.test.advancedExecutables": [
      {
        "pattern": "{sources,unittest}/**/*{unittest}*",
        "cwd": "${absDirpath}",
        "env": {
          "PATH" : "${env:PATH};${workspaceFolder}/nupashull/windowsNT/ncgbin",
          "ncgbin" : "${workspaceFolder}/nupashull/windowsNT/ncgbin",
          "ncgbin64" : "${workspaceFolder}/nupashull/windowsNT/ncgbin64",
        }
      }
    ]

All unittest executables have the suffix _unittest and are inside sources/unittest (yes I realize that's a silly place to put executables, not a decision that's up to me 😛)

Desktop

  • Extension Version: 3.2.10
  • VS Code Version: 1.47.2
  • Catch2 / Google Test / DOCTest Version: 1.10.0 (gtest)
  • OS Type and Version: Windows 10 Pro
  • Using remote-ssh/docker/wsl?: No

Log (optional but recommended)
The relevant log message I can see is this one:
[2020-07-23 12:13:02.828] [DEBUG] Not a test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe reason: [Error: Not a supported test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe

Let me know if more is needed though.

@matepek
Copy link
Owner

matepek commented Jul 24, 2020

Hello,

And what is the output in case of calling the exec with --help ?

@matepek
Copy link
Owner

matepek commented Jul 24, 2020

The log actually contains it but you cut it.

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 24, 2020

Hello matepek.

The output is the following:

[This part contains company specific command options that I had to remove, due to privacy concerns, all ut exec have them]
[Afterwards the following from gtest show]

This program contains tests written using Google Test. You can use the
following command line flags to control its behavior:

Test Selection:
  --gtest_list_tests
      List the names of all tests instead of running them. The name of
      TEST(Foo, Bar) is "Foo.Bar".
  --gtest_filter=POSTIVE_PATTERNS[-NEGATIVE_PATTERNS]
      Run only the tests whose name matches one of the positive patterns but
      none of the negative patterns. '?' matches any single character; '*'
      matches any substring; ':' separates two patterns.
  --gtest_also_run_disabled_tests
      Run all disabled tests too.

Test Execution:
  --gtest_repeat=[COUNT]
      Run the tests repeatedly; use a negative count to repeat forever.
  --gtest_shuffle
      Randomize tests' orders on every iteration.
  --gtest_random_seed=[NUMBER]
      Random number seed to use for shuffling test orders (between 1 and
      99999, or 0 to use a seed based on the current time).

Test Output:
  --gtest_color=(yes|no|auto)
      Enable/disable colored output. The default is auto.
  --gtest_print_time=0
      Don't print the elapsed time of each test.
  --gtest_output=(json|xml)[:DIRECTORY_PATH\|:FILE_PATH]
      Generate a JSON or XML report in the given directory or with the given
      file name. FILE_PATH defaults to test_detail.xml.

Assertion Behavior:
  --gtest_break_on_failure
      Turn assertion failures into debugger break-points.
  --gtest_throw_on_failure
      Turn assertion failures into C++ exceptions for use by an external
      test framework.
  --gtest_catch_exceptions=0
      Do not report exceptions as test failures. Instead, allow them
      to crash the program or throw a pop-up (on Windows).

Except for --gtest_list_tests, you can alternatively set the corresponding
environment variable of a flag (all letters in upper-case). For example, to
disable colored text output, you can either specify --gtest_color=no or set
the GTEST_COLOR environment variable to no.

For more information, please read the Google Test documentation at
https://github.com/google/googletest/. If you find a bug in Google Test
(not one in your own code or tests), please report it to
<[email protected]>.

The full output of the error line is the following:

[2020-07-23 12:13:02.828] [DEBUG] Not a test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe reason: [Error: Not a supported test executable: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
 output: 
	at c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.10\out\dist\main.js:80:33951
	at processTicksAndRejections (internal/process/task_queues.js:85:5)]

(apologies for removing it, it was my mistake)

I have also noticed a new error, after restarting visual code:

[2020-07-23 13:19:02.502] [INFO] watcher event: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
[2020-07-23 13:19:02.502] [INFO] watcher event: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
[2020-07-23 13:19:02.502] [INFO] possibly new suite: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
[2020-07-23 13:19:02.502] [INFO] watcher event: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.pdb
[2020-07-23 13:19:02.502] [INFO] possibly new suite: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.pdb
[2020-07-23 13:19:02.502] [INFO] possibly new suite: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
[2020-07-23 13:19:02.503] [INFO] watcher event: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.pdb
[2020-07-23 13:19:02.503] [INFO] possibly new suite: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.pdb
[2020-07-23 13:19:02.504] [INFO] couldn't add: c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe reson: [Error: spawn EBUSY
	at ChildProcess.spawn (internal/child_process.js:394:11)
	at Object.spawn (child_process.js:553:9)
	at c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.10\out\dist\main.js:1:29499
	at new Promise (<anonymous>)
	at Object.e.spawnAsync (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.10\out\dist\main.js:1:29375)
	at c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.10\out\dist\main.js:80:31888] {
  errno: 'EBUSY',
  code: 'EBUSY',
  syscall: 'spawn'
}

This shows up several times in the logs.

@matepek
Copy link
Owner

matepek commented Jul 24, 2020

This line should match: https://github.com/matepek/vscode-catch2-test-adapter/blob/master/src/RunnableFactory.ts#L71
Play wit it a bit here: https://regex101.com/r/mHiiD8/1

Is that your stdout or stderr?
Stdout seems empty.

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 24, 2020

The regex seems to match, at least in regex101. I copied the full output there and it matched on the expected line.

Yeah, it's going to stdout, I just confirmed stderr is empty.

@matepek
Copy link
Owner

matepek commented Jul 25, 2020

I guess the new error is unrelated but thanks for it. I will improve that part.

Honestly I run out of ideas currently. If thats stdout and parseable than it should work.. Further investigation requires more time. Let me know if you really wanna fix this issue and we can talk about it

but first..

Before I suggest to try the following workaround:
advanedExecutables can have gtest property which can have helpRegex property which should be a regex. I would suggest to you to play with it. Since you have a strong pattern for the executables the ".*" might not harm. And if that works you can try making it more specific.

Keep me posted.

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 25, 2020

Yes, I'd really love to fix it :) Unfortunately I can't just send you the executables since I don't own them but I could try to debug it.

I've added ".*" as a pattern but that didn't seem to work. I did see a bit more logging though, I'll add it below, brace yourself cause it's a lot:

First, the configuration file is now like this:

 "testMate.cpp.test.advancedExecutables": [
      {
        "pattern": "{sources,unittest}/**/*{unittest}*",
        "cwd": "${absDirpath}",
        "env": {
          "PATH" : "${env:PATH};${workspaceFolder}/nupashull/windowsNT/ncgbin",
          "ncgbin" : "${workspaceFolder}/nupashull/windowsNT/ncgbin",
          "ncgbin64" : "${workspaceFolder}/nupashull/windowsNT/ncgbin64",
        },
        "gtest":{
          "helpRegex": ".*"
        }
      }
    ]

And the logs:

[2020-07-25 13:21:42.458] [INFO] reloadTests GoogleTest Promise { undefined } c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe
[2020-07-25 13:21:42.461] [INFO] coudnt use cache [Error: ENOENT: no such file or directory, stat 'c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe.TestMate.testListCache.xml'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'c:\\local\\hulloncos\\sources\\unittest\\cos_unittest\\cos_unittest.exe.TestMate.testListCache.xml'
}
[2020-07-25 13:21:42.461] [INFO] discovering tests c:\local\hulloncos\sources\unittest\cos_unittest\cos_unittest.exe [
  '--gtest_list_tests',
  '--gtest_output=xml:c:\\local\\hulloncos\\sources\\unittest\\cos_unittest\\cos_unittest.exe.TestMate.testListCache.xml'
] c:\local\hulloncos\sources\unittest\cos_unittest
[2020-07-25 13:21:42.530] [INFO] Couldn't parse output file. Possibly it is an older version of Google Test framework. It is trying to parse the output
[2020-07-25 13:21:42.530] [INFO] GoogleTest._reloadFromStdOut error [Error: Wrong test list.
	at l._reloadFromString (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:65:42896)
	at l._reloadChildren (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:65:44729)
	at async c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:1:83017
	at async e.ExecutableConfig.load (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:65:23603)
	at async Promise.all (index 0)
	at async s.load (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:64:33464)
	at async e.SharedVariables._shared.u.SharedVariables.e [as loadWithTask] (c:\Users\jgouveia\.vscode\extensions\matepek.vscode-catch2-test-adapter-3.2.11\out\dist\main.js:64:10172)] {
  pid: 20680,
  output: [ null, '', '' ],
  stdout: '',
  stderr: '',
  status: 3221225781,
  signal: null,
  error: undefined,
  closed: true,
  process: ChildProcess {
    _events: [Object: null prototype] { error: [Function], close: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    _closesNeeded: 3,
    _closesGot: 3,
    connected: false,
    signalCode: null,
    exitCode: 3221225781,
    killed: false,
    spawnfile: 'c:\\local\\hulloncos\\sources\\unittest\\cos_unittest\\cos_unittest.exe',
    _handle: null,
    spawnargs: [
      'c:\\local\\hulloncos\\sources\\unittest\\cos_unittest\\cos_unittest.exe',
      '--gtest_list_tests',
      '--gtest_output=xml:c:\\local\\hulloncos\\sources\\unittest\\cos_unittest\\cos_unittest.exe.TestMate.testListCache.xml'
    ],
    pid: 20680,
    stdin: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _readableState: ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: false,
        sync: true,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        paused: true,
        emitClose: false,
        autoDestroy: false,
        destroyed: true,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null
      },
      readable: false,
      _events: [Object: null prototype] { end: [Function: onReadableStreamEnd] },
      _eventsCount: 1,
      _maxListeners: undefined,
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: true,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        emitClose: false,
        autoDestroy: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object]
      },
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      [Symbol(asyncId)]: 3170,
      [Symbol(kHandle)]: null,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdout: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _readableState: ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        paused: false,
        emitClose: false,
        autoDestroy: false,
        destroyed: true,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null
      },
      readable: false,
      _events: [Object: null prototype] {
        end: [Function: onReadableStreamEnd],
        close: [Function],
        data: [Function]
      },
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: true,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        emitClose: false,
        autoDestroy: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object]
      },
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      write: [Function: writeAfterFIN],
      [Symbol(asyncId)]: 3171,
      [Symbol(kHandle)]: null,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stderr: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _readableState: ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: BufferList { head: null, tail: null, length: 0 },
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        paused: false,
        emitClose: false,
        autoDestroy: false,
        destroyed: true,
        defaultEncoding: 'utf8',
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null
      },
      readable: false,
      _events: [Object: null prototype] {
        end: [Function: onReadableStreamEnd],
        close: [Function],
        data: [Function]
      },
      _eventsCount: 3,
      _maxListeners: undefined,
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: true,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        emitClose: false,
        autoDestroy: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object]
      },
      writable: false,
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      write: [Function: writeAfterFIN],
      [Symbol(asyncId)]: 3172,
      [Symbol(kHandle)]: null,
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: null,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    stdio: [
      Socket {
        connecting: false,
        _hadError: false,
        _parent: null,
        _host: null,
        _readableState: [ReadableState],
        readable: false,
        _events: [Object: null prototype],
        _eventsCount: 1,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        [Symbol(asyncId)]: 3170,
        [Symbol(kHandle)]: null,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0
      },
      Socket {
        connecting: false,
        _hadError: false,
        _parent: null,
        _host: null,
        _readableState: [ReadableState],
        readable: false,
        _events: [Object: null prototype],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        write: [Function: writeAfterFIN],
        [Symbol(asyncId)]: 3171,
        [Symbol(kHandle)]: null,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0
      },
      Socket {
        connecting: false,
        _hadError: false,
        _parent: null,
        _host: null,
        _readableState: [ReadableState],
        readable: false,
        _events: [Object: null prototype],
        _eventsCount: 3,
        _maxListeners: undefined,
        _writableState: [WritableState],
        writable: false,
        allowHalfOpen: false,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: null,
        _server: null,
        write: [Function: writeAfterFIN],
        [Symbol(asyncId)]: 3172,
        [Symbol(kHandle)]: null,
        [Symbol(lastWriteQueueSize)]: 0,
        [Symbol(timeout)]: null,
        [Symbol(kBytesRead)]: 0,
        [Symbol(kBytesWritten)]: 0
      }
    ]
  }
};

@matepek
Copy link
Owner

matepek commented Jul 26, 2020

Now it is recognised but the output is still empty.
Are you familiar with nodejs?

Try adjusting and executing this:

var res = require('child_process').spawnSync('out/cpp/gtest1.exe', ['--help']);console.log('stdout:'+res.stdout.toString());console.log('stderr:'+res.stderr.toString());

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 27, 2020

Yes, I am familiar with nodejs. I will try that and get back at you

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 27, 2020

Interesting... I ran that with my UT executable and the stdout is indeed empty! That's quite strange. I tried with one of my UTs that are captured and the stdout contains the expected output. stderr is also empty (in both cases).

When I execute it on the terminal I can redirect the output to a file with > though... I believe (I could be wrong) that should only work with stdout, so I'm not sure what's happening here.

@matepek
Copy link
Owner

matepek commented Jul 27, 2020

I think it's not that your nodejs is wrong, since vscode uses its own engine. I suspect some system related issue.
Keep me posted.

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 27, 2020

I believe I have found the issue.

So, in our dev environment we have a batch script we run that sets up a bunch of paths and environment variables to find all the needed dependencies and dlls. We have to run this before compiling and executing most of our execs. It turns out that most of the UTs execs fail due to missing dlls without this. All the UTs your extension is able to capture do not need this batch script to be run first. This is very likely the issue. child_process tries to run the executable without the correct paths being set and it just fails to run due to missing dlls.

The only way for me to get this to work would be if I could set a custom cmdline command to be run before running the execs. Is this something that would be hard to implement?

Another solution would be to run the search with the env variables that are set in the advancedExecutables already set

@matepek
Copy link
Owner

matepek commented Jul 27, 2020

Easiest: Star vscode from your dev environment. In this way it will inherit all the environment variables.

Use wrapper: example [here]
(https://github.com/matepek/vscode-catch2-test-adapter/blob/master/documents/support.md#faq). (Not the best though.)

Set up environment variables manually in the testMate.advancedExecutables. (But this is not dynamic.)

(And you don't need the helpRegex anymore.)

@matepek matepek closed this as completed Jul 27, 2020
@matepek
Copy link
Owner

matepek commented Jul 27, 2020

I decided adding a new feature under testMate.advancedExecutables called envFile. I think this is what you are looking for. Check here

@matepek
Copy link
Owner

matepek commented Jul 27, 2020

Also check this issue: #116

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 27, 2020

Thanks, I'll give it a shot and get back to you on those :)

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 27, 2020

So when I start code from my dev environment the look-up for tests seems to get stuck in an infinite loop as it never finds anything but the "loading arrow" keeps spinning forever 🤔

I had the variables set in testMate.advancedExecutables in the env key btw, but are they set before searching for tests with the --help command? Or just before the UTs are started? If I set them in the envFile, would they be set before the test search?

@matepek
Copy link
Owner

matepek commented Jul 27, 2020

are they set before searching for tests with the --help command?

Yes, env is set before all operations. envFile works as same.

Something else should be the problem.

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 28, 2020

I think I need to do some debugging to get to the bottom of this issue. What is the easiest way to attach a debugger to an extension in code? I've never developed one, so I'm unfamiliar with the process. I'm assuming I have to clone the repo and install a dev version?

@matepek
Copy link
Owner

matepek commented Jul 28, 2020

Easier.
Clone
Npm install.
Start vscode for that folder.
Debug page: select manual cpp, start debugging
When it is started you can change the folder

Also I can give you a hand with vscode remote. You can share a debugging session with me online.

@matepek
Copy link
Owner

matepek commented Jul 28, 2020

@Sol1du2
Copy link
Author

Sol1du2 commented Jul 28, 2020

Awesome! That'd be great. I'll keep you posted. I'm quite busy these next days so I might only have time next week.

@Sol1du2
Copy link
Author

Sol1du2 commented Aug 17, 2020

Hey, I finally have some time to debug this issue.

I've followed your steps but all my break points become "unbound" when I open my folder so I guess I am missing something. Even setting one on main.ts doesn't seem to work.

When I launch the "manual cpp" I get the following error: The preLaunchTask 'preDebug' terminated with exit code 2. I can choose to "debug anyway" but also "show errors". The second option just opens an empty "Problems" tab.

I also ran npm test and I get a the following failure:

 1) "after each" hook for "resolving relative defaultCwd":
     AssertionError [ERR_ASSERTION]: Test: "ExecutablesVariable.test.js -> resolving relative defaultCwd":  Got warning: "coudnt use cache" but not expected.
        at Context.<anonymous> (c:\local\catch2-test-adapter\out\test\LogOutputContent.test.js:54:28)
        at processImmediate (internal/timers.js:439:21)
        at process.topLevelDomainCallback (domain.js:131:23)

In the ExecutablesVariable.test.js test

@matepek
Copy link
Owner

matepek commented Aug 17, 2020

@Sol1du2
Copy link
Author

Sol1du2 commented Aug 17, 2020

Yessir! :P

@matepek
Copy link
Owner

matepek commented Aug 26, 2020

Ping ^^

@daniel-kun
Copy link

@Sol1du2 @matepek Has this been resolved? I have a very similar observation. I have two test executables. One is being discovered, the other is found, but the log says

[2021-12-07 07:39:11.465] [INFO] reloadTests GoogleTest undefined c:\Projects\<redacted>\SomeTestD.exe
[2021-12-07 07:39:11.466] [INFO] discovering tests c:\Projects\<redacted>\SomeTestD.exe [
  '--gtest_list_tests',
  '--gtest_output=xml:c:\\Projects\\<redacted>\SomeTest.exe.TestMate.testListCache.xml'
] c:\Projects\<redacted>

Then the log stops. Another test executable has been discovered and the tests show in the test explorer.

Platform is Windows 10 x64

@Sol1du2
Copy link
Author

Sol1du2 commented Dec 7, 2021

@daniel-kun this issue turned out to be an issue with my setup not the plugin

@daniel-kun
Copy link

@Sol1du2 Thanks for the reply! I found out that the "C++ TestMate Legacy" extension works just fine for me.

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

No branches or pull requests

3 participants