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

Test discovery fails if executable depends on gmock.dll but not on gtest.dll #315

Open
voltamund opened this issue Jul 16, 2020 · 5 comments

Comments

@voltamund
Copy link

I used the default installation (no indicator file and no custom regex). The test executable only depends on gmock.dll (verified with dumpbin). In that case IsGoogleTestExecutable returns false because it expects gtest.dll as a dependency.
As a workaround I could set a custom regex. Then test discovery succeeds.

@csoltenborn
Copy link
Owner

I just noticed that I never reacted to this issue - sorry for that...

For my understanding (currently not working with C++): I assume that the gmock.dll you are using also contains the gtest stuff, but is this the common case? Wouldn't one expect executables to have both dependencies?

@csoltenborn
Copy link
Owner

I will tag this as enhancement, and it is a very simple change. However, I'm not convinced that this is a common case - feel free to change my mind :-)

@sebkraemer
Copy link
Contributor

sebkraemer commented Nov 3, 2021

Hi. I found this ticket because I'm struggling with undiscovered tests in a project where I (was) moved from some ancient 1.8.something static gtestd.lib to 1.11.0 shared library build by vcpkg.

I can't say if this issue is relevant for my problem but regarding the posed question here I found two hints:

A user states in this conan issue: gmock built as a shared library must use static gtest (I could not find the original README quote after a quick search though.)

There is another ticket that reports convincing reasons against using both gtest.dll and gmock.dll for the same binary (TLDR: both don't share a global variable that's supposed to be unique in the binary) at the googletest repo. Understandably, Google treats this more as a user/build issue than something to be fixed in the googletest project.

I just ran my test binary (without TestExplorer), which is only linked against gmock.dll, it must contain the gtest part statically since there is no gtest.dll in that folder or %PATH%.

I didn't go as far as looking up or trying if conan changed Google's CMake project also includes gtest in the gmock library:

if (MSVC)
  cxx_library(gmock
              "${cxx_strict}"
              "${gtest_dir}/src/gtest-all.cc"
              src/gmock-all.cc)

This closes the circle to the other bincrafters/conan issue. Google does it now like the user proposes. So it should hardly ever be necessary to link against both.

Maybe that changes your mind? :)

@csoltenborn
Copy link
Owner

It probably does :-) Would you be willing to give a new version a try and see whether it indeed fixes your particular discovery problem? That would most likely push me over the edge :-)

@sebkraemer
Copy link
Contributor

I'd be delighted 😁

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

3 participants