csoltenborn / GoogleTestAdapter

Visual studio extension that adds support for the C++ testing framework Google Test.
Other
142 stars 102 forks source link

Cancel test does not terminate process #337

Open appls opened 2 years ago

appls commented 2 years ago

Hi Christian,

I use GoogleTestAdapter 0.18.0. I set "Terminate process on cancel" to "True". When I do a Debug-Run of my test I can terminate the test execution and this results in termination of the running process as expected. However when I do a "normal" Run of my test and I terminate the test execution the process is not terminated and continues to run in the background while the Test Explorer already shows that the test has been canceled. Is my configuration somehow wrong or do I have the wrong assumption that the process should also terminate on cancel? I took a quick look into the code (GoogleTestAdapter/GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs, l. 75 ff.) but did not find anything suspicious.

Any suggestions are appreciated. Hope to hear from you. Cheers, Tobias

csoltenborn commented 2 years ago

Hi Tobias,

as far as I understand, the process should indeed be killed immediately by invoking Process.Kill(). Couple of things to check:

Summarizing, I have no idea why this would work when debugging, but not running (and would expect it to be the other way, if at all)...

csoltenborn commented 2 years ago

I've quickly put together some code to improve logging, and to also wait for the actual termination of the process - please give it a try and let me know what you see when enabling Debug mode... Download the VSIX from here, see code changes here.

appls commented 2 years ago

Hi Christian,

I installed your provided VSIX Version 0.18.0.1475. Please find the attached Test log output. DebugRunAbortLog.txt RunAbortLog.txt

I still observe that the process does not terminate when I start the test as a "normal" run. When I abort a test run in "debug" mode it terminates. Can you please double check my RunSettings to verify that there is no error.

Thank you for your support. Cheers, Tobias