Issues running unit tests for gmock-1.6.0

588 views
Skip to first unread message

Brainbug

unread,
May 25, 2011, 10:23:40 PM5/25/11
to Google C++ Mocking Framework
Hi,

I was just building gmock-1.6.0 and the version of gtest-1.6.0 that
comes with it on my machine (Windows 7 Ultimate 64-bit, Visual Studio
2010).

When running the tests I had some issues which I am not sure what to
do about (fix them somehow or save to ignore them).

1. In 'gtest', when runing 'gtest_unittest' I got the following
warnings:

Invalid environment variables: we require 0 <=
GTEST_SHARD_INDEX < GTEST_TOTAL_SHARDS, but
you have GTEST_SHARD_INDEX=4, GTEST_TOTAL_SHARDS=4.
Running main() from gtest_main.cc
Invalid environment variables: we require 0 <=
GTEST_SHARD_INDEX < GTEST_TOTAL_SHARDS, but
you have GTEST_SHARD_INDEX=4, GTEST_TOTAL_SHARDS=-2.
Running main() from gtest_main.cc
Invalid environment variables: you have GTEST_SHARD_INDEX = 5,
but have left
GTEST_TOTAL_SHARDS unset.
Running main() from gtest_main.cc
Invalid environment variables: you have GTEST_TOTAL_SHARDS = 5,
but have left
GTEST_SHARD_INDEX unset.

All tests passed but I got the message 'YOU HAVE 13 DISABLED TESTS'

2. In 'gmock' when running 'gmock_test', 2 of the tests failed:

[ FAILED ]
FunctionMockerTest.ReportsExpectCallLocationForExhausedActions
[ FAILED ]
FunctionMockerTest.ReportsDefaultActionLocationOfUninterestingCalls

Detailed messages:

Z:\gmock-1.6.0\gtest\src/gtest.cc(1983): error: Failed All tests in
the same test case must use the same test fixture
class, so mixing TEST_F and TEST in the same test case is illegal. In
test case FunctionMockerTest, test MocksVoidFunction is defined using
TEST_F but test ReportsExpectCallLocationForExhausedActions is defined
using TEST. You probably
want to change the TEST to TEST_F or move it to another test case.
[ FAILED ]
FunctionMockerTest.ReportsExpectCallLocationForExhausedActions (1 ms)

Z:\gmock-1.6.0_VS2010\gtest\src/gtest.cc(1983): error: Failed All
tests in the same test case must use the same test fixture class, so
mixing TEST_F and TEST in the same test case is illegal. In test case
FunctionMockerTest, test MocksVoidFunction is defined using TEST_F but
test ReportsDefaultActionLocationOfUninterestingCalls is defined using
TEST. You probably
want to change the TEST to TEST_F or move it to another test case.
[ FAILED ]
FunctionMockerTest.ReportsDefaultActionLocationOfUninterestingCalls
(2 ms)


Thanks

Vlad Losev

unread,
May 26, 2011, 5:20:20 PM5/26/11
to Brainbug, Google C++ Mocking Framework
These are just artifacts of testing Google Test's diagnostic routines. Nothing to worry about as long as the tests pass.
gmock_test isn't really a good way to run Google Mock's tests. It tries to combine multiple test files into a single binary, while those test files are written without consideration for such combination. If you want to make sure all tests are passing on your platform, my advice is to generate a solution with tests using CMake and use it.

Thanks

Brainbug

unread,
Jun 2, 2011, 3:06:51 AM6/2/11
to Google C++ Mocking Framework
Thanks for the reply Vlad.

I was able to get all tests passing by changing the name of
"FunctionMockerTest" to e.g. "FunctionMockerTest2" in the "gmock-spec-
builders_test.cc" file.


On May 27, 6:20 am, Vlad Losev <v...@losev.com> wrote:
Reply all
Reply to author
Forward
0 new messages