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

Some tests are failing when using the debug configuration (-DCMAKE_BUILD_TYPE=Debug) on Debian #1175

Closed
mantonenco opened this issue Aug 5, 2017 · 4 comments · Fixed by #1235

Comments

@mantonenco
Copy link

mantonenco commented Aug 5, 2017

I use the master branch:

commit ca102b1
Merge: 50f3baf a2451c7
Author: Gennadiy Civil gennadiycivil@users.noreply.github.com
Date: Thu Aug 3 16:49:13 2017 -0400

The following tests FAILED:
29 - gtest_break_on_failure_unittest (Failed)
30 - gtest_catch_exceptions_test (Failed)
31 - gtest_color_test (Failed)
32 - gtest_env_var_test (Failed)
33 - gtest_filter_unittest (Failed)
34 - gtest_help_test (Failed)
35 - gtest_list_tests_unittest (Failed)
36 - gtest_output_test (Failed)
37 - gtest_shuffle_test (Failed)
38 - gtest_throw_on_failure_test (Failed)
39 - gtest_uninitialized_test (Failed)
40 - gtest_xml_outfiles_test (Failed)
41 - gtest_xml_output_unittest (Failed)

Note that if I use the default build configuration (without -DCMAKE_BUILD_TYPE=Debug) then everything is OK:

cmake -Dgtest_build_tests=ON ..
all tests pass (100% tests passed, 0 tests failed out of 41).

System details:

uname -a
Linux debian 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux
gcc --version
gcc (Debian 6.3.0-18) 6.3.0 20170516
cmake --version
cmake version 3.7.2

I attached the output of 'cmake' and 'make test' commands.

cmake-output.txt
make-test-output.txt

@Limbo999
Copy link

Limbo999 commented Aug 25, 2017

Hi,
I have the same problem

Total Test time (real) =   4.84 sec

The following tests FAILED:
   29 - gtest_break_on_failure_unittest (Failed)
   30 - gtest_catch_exceptions_test (Failed)
   31 - gtest_color_test (Failed)
   32 - gtest_env_var_test (Failed)
   33 - gtest_filter_unittest (Failed)
   34 - gtest_help_test (Failed)
   35 - gtest_list_tests_unittest (Failed)
   36 - gtest_output_test (Failed)
   37 - gtest_shuffle_test (Failed)
   38 - gtest_throw_on_failure_test (Failed)
   39 - gtest_uninitialized_test (Failed)
   40 - gtest_xml_outfiles_test (Failed)
   41 - gtest_xml_output_unittest (Failed)
Errors while running CTest
make: *** [test] Error 8
[Finished in 4.9s with exit code 2]

What are we doing wrong? I link gtest_main and gmock_main and my tests are passing.

I am on macOS Sierra Version 10.12.6 using

$ clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@Limbo999
Copy link

What I did was adding "include(CTest)" in my top-level CMakeLists.txt file. Now it shows me only my test files (see also https://stackoverflow.com/questions/13550153/no-tests-found-when-using-gtest-with-cmake-ctest and https://cmake.org/cmake/help/v2.8.10/cmake.html#module:CTest).

@ghost
Copy link

ghost commented Aug 29, 2017

I can reproduce this on Linux with gcc.

When running ctest --verbose -R gtest_break_on_failure_unittest, python complains it couldn't find build/googlemock/gtest/Debug/gtest_break_on_failure_unittest_ - seems there is the Debug too much in the executable path, i.e. python is given a wrong path to the build directory.

@ghost
Copy link

ghost commented Aug 29, 2017

The problem seems to be located in googletest/cmake/internal_utils.cmake where it is assumed that $<CONFIGURATION> is part of the build directory path, which isn't true on make based cmake build generators.

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

Successfully merging a pull request may close this issue.

2 participants