Closed ebouteillon closed 3 weeks ago
Hello, I had the same issue last Friday. I managed to fix it by disabling the Allow Parallel Jobs checkbox. This configuration option never used to work for me, now it works but the command is to big.
This will at least allow you to continue even if it is far from perfect.
I have no issue with "CTest parallel jobs" with project tests. For the moment, I downgraded to previous VSCode plugin version v1.17.17 till it is fixed to have something functional.
@ebouteillon Does the workaround that @nickassink mentioned work for you?
To avoid the very long command string, you should disable the "Allow parallel jobs" setting. This will avoid the very long command. However, to understand your scenario, what exactly are you hoping works? Are you hoping to be able to run all of your tests, in parallel, with the test explorer? While you use the workaround or downgrade, I'm happy to investigate something that might make you scenario still possible.
@ebouteillon I investigated and am curious if a quick fix I implemented here would solve your issues: cmake-tools.zip
Could you download the above zip file, modify the extension to .vsix
and then install it and let me know if it works for you? If it does, we can PR this and get it into pre-release upon merging.
Hi Garrett,
I forgot to mention my projects use CTest's FIXTURES_SETUP
and FIXTURES_CLEANUP
. It is used for instance to setup/cleanup a database for the tests. So when I enable "CMake > CTest: Allow Parallel Jobs" then CTest organizes the tests to run fixtures only once before/after all the tests requiring these fixtures. If this option is disabled, then fixtures are run before/after every tests requiring them, which in the end is a lot slower. So my ideal use case is to have this option "Allow Parallel Jobs" enabled.
Here are my tests:
Unfortunately it is not solved
Does the workaround that @nickassink mentioned work for you?
In short yes, now it will run test cases one by one, so you don't have a massive command to run them all.
I will just wait until you fix it for @ebouteillon and test again I think everything will work then. if it does not I will create a separate issue (don't want to highjack this one with a different issue).
Latest CMake (3.29) has a new command-line option to list the tests to run in a file: https://cmake.org/cmake/help/latest/manual/ctest.1.html#cmdoption-ctest-tests-from-file
If the extension uses this option it should solve the issue for "CMake >= 3.29" users. Not a problem for me, as I can upgrade the CMake version. If you implement it, I can give a feedback.
@ebouteillon Thanks for testing, could you try this vsix as well?
Some context into my attempted fixes is that in order to properly support parallel invocation when being invoked by the test explorer, we have to make sure we support if there is a subset selected in the test explorer. First I tried to be nifty in how I did that, but in this fix I'm being more straightforward. Please let me know if this vsix helps your scenario.
Hi @gcampbell-msft , new .vsix works for my use case. Command line generated no longer lists all tests cases.
@ebouteillon Thank you very much for your reply, waiting for this Pull request: https://github.com/microsoft/vscode-cmake-tools/pull/3814 to complete and the problem will be fixed!
@gcampbell-msft Unfortunately I ran into the same issue using a subset of the test through the TestExplorer and your fix won't tackle that (gtest big parametric test names does not help).
Is there any way to check the size of the regex and split into several commands to avoid the issue ?
Or perhaps by looking up the test numbers, the ctest command could be run with -I
instead of -R
Of course the CMake 3.29 --tests-from-file
new command line would be the cleanest solution but it requires a CMake upgrade for the user.
Hi @triou-harmonicinc , I am using NO_PRETTY_TYPES
and NO_PRETTY_VALUES
with gtest_discover_tests
to have shorter gtest test names. Maybe you can give a try?
@triou-harmonicinc Thanks for the feedback!
The previous experience wasn't actually making use of the cmake.ctest.allowParallelJobs
setting. Any subset selection of tests was invoked individually. This change was made in order to allow for a subset selection of tests to make use of the cmake.ctest.allowParallelJobs
setting.
I agree that our current implementation still definitely has limitations, but that will be a future enhancement. For now, if you want to be able to run a subset, you should disable the cmake.ctest.allowParallelJobs
setting, and it will behave the same way as before (specifically for a subset ran from the Test Explorer). @triou-harmonicinc Could you help us out by creating a separate enhancement request?
The overall issue where invoking all tests from outside of the Test Explorer, will be patched into a patch 1.18 release.
@ebouteillon The fix will be in the pre-release channel tomorrow! Also, we plan to do a patch official release next week. THanks!
@gcampbell-msft Sounds good.
Should I create a new issue to improve the behavior of cmake.ctest.allowParallelJobs
then ? (I could not find an existing one)
@gcampbell-msft I did test your latest changes and it breaks running a subset of tests with parallel jobs enabled. Instead of running just the subset with the huge regex it runs all tests. Was that intended as well ?
@gcampbell-msft I did test your latest changes and it breaks running a subset of tests with parallel jobs enabled. Instead of running just the subset with the huge regex it runs all tests. Was that intended as well ?
Could you provide some clarity on the repro you tried?
I don't see the break that you speak of when I tested on my machine:
https://github.com/microsoft/vscode-cmake-tools/assets/86264750/96a2dd99-0008-4687-bd2c-85b1f65965a4
If you're referring to the button here, I don't think this is the intent of the Test Explorer, when debugging, it doesn't include information about the subset:
https://github.com/microsoft/vscode-cmake-tools/assets/86264750/554b29e5-a869-4db1-afdb-666d08cbd770
In which case, this wouldn't be a regression. Also, I tested in 1.17.17 and this behavior was there as well.
@gcampbell-msft Sounds good. Should I create a new issue to improve the behavior of
cmake.ctest.allowParallelJobs
then ? (I could not find an existing one)
Yes, please feel free to create a new issue for any request you have for improved behavior. Thanks!
My use case is :
I double checked and if I revert your changes the old behavior is back.
@triou-harmonicinc This is what I see:
https://github.com/microsoft/vscode-cmake-tools/assets/86264750/dae9b8f4-8e4a-40e3-92c7-3fa686fee5c1
Is there something else I'm missing?
I will just wait until you fix it for @ebouteillon and test again I think everything will work then. if it does not I will create a separate issue (don't want to highjack this one with a different issue).
@gcampbell-msft I just tested it with te pre release and this also fixed my issue. thank you.
@gcampbell-msft Sorry for the delayed answer, I am trying to debug the issue. It seems to depend on the filter I am using which I find very peculiar.
The issue comes from the TestRunRequest.include field which is ont correctly filled with a specific filter. So the bug might come from the test explorer extension API itself. It might also be linked to my configuration. Anyway, thanks for your support I will try to look into it more deeply and report to the right place if I can figure out what's wrong.
Brief Issue Summary
When I click on the status bar button "CMake: run CTest tests":
Context : I use WSL2 to run a CentOS7 linux environment. My project has 2400+ unit tests written with GTest. CMake detects them all with the built-in
gtest_discover_tests(target)
command. And thus all tests are visible in the "Testing" pane of VSCode.When I click the status bar "CMake: run Ctest tests", I observe a change in the command line generated and executed by the VSCode extension:
v1.17.17 executes this (short) command:
v1.18.41 executes a 161k+ characters long command (truncated to keep thing readable):
1/ In "Testing" pane, I see the timer running as if VSCode is waiting the end of tests execution... that failed immediately.
2/ The new extensions version generates a command which lists all the 2400+ tests. The command is 161k+ character long. I tried to run it in a shell but it fails immediately with
bash: opt/cmake/bin/ctest: Argument list too long
. Searching the web I found that you can increase size usingulimit
but can only be up to 65K. So still not enough to fix the issue.Can you fix this generated command please?
CMake Tools Diagnostics
Debug Log
Additional Information
No response