[cmake-developers] [CMake 0015553]: FindGTest.cmake doesn't handle all spaces in TEST / TEST_F macro
Mantis Bug Tracker
mantis at public.kitware.com
Sat May 2 09:22:02 EDT 2015
The following issue has been SUBMITTED.
======================================================================
http://www.cmake.org/Bug/view.php?id=15553
======================================================================
Reported By: Thiago M.
Assigned To:
======================================================================
Project: CMake
Issue ID: 15553
Category: Modules
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-05-02 09:22 EDT
Last Modified: 2015-05-02 09:22 EDT
======================================================================
Summary: FindGTest.cmake doesn't handle all spaces in TEST /
TEST_F macro
Description:
The GTEST_ADD_TESTS() macro does not handle all space configurations in the test
macros:
- Spaces between the test suíte name and the comma: "TEST(TestSuite ,TestName)"
- Spaces between the macro name and the open parenthesis: "TEST
(TestSuite,TestName)"
For the first one, the test is not detected.
For the second one, the test name is wrongly parsed and results in errors when
trying to run it.
Steps to Reproduce:
1. Create a test file with the following content:
#include <gtest/gtest.h>
TEST (TestSuite,Test1)
{
}
TEST(TestSuite ,Test2)
{
}
2. Create a CMakeLists.txt that creates an executable for this test file and
uses GTEST_ADD_TESTS() to create the CTest targets. An example list file in
attached to this issue.
3. Configure and compile the CMake project and run the test executable. The
GTest output shows the two tests are executed with success:
$ ./GTestParseError
Running main() from gtest_main.cc
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from TestSuite
[ RUN ] TestSuite.Test1
[ OK ] TestSuite.Test1 (0 ms)
[ RUN ] TestSuite.Test2
[ OK ] TestSuite.Test2 (0 ms)
[----------] 2 tests from TestSuite (1 ms total)
[----------] Global test environment tear-down
[==========] 2 tests from 1 test case ran. (1 ms total)
[ PASSED ] 2 tests.
4. Run CTest (with "make test", for instance). Only one test will be executed,
with the wrong name, and it will fail.
$ make test
Running tests...
Test project /home/myUser/Test-build
Start 1: TEST
Could not find executable (
Looked in the following places:
(
(
Release/(
Release/(
Debug/(
Debug/(
MinSizeRel/(
MinSizeRel/(
RelWithDebInfo/(
RelWithDebInfo/(
Deployment/(
Deployment/(
Development/(
Development/(
Unable to find executable: (
1/1 Test http://www.cmake.org/Bug/view.php?id=1: TEST
.............................***Not Run 0.00 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.00 sec
The following tests FAILED:
1 - TEST (Not Run)
Errors while running CTest
Makefile:75: recipe for target 'test' failed
make: *** [test] Error 8
Additional Information:
The GTEST_ADD_TESTS() macro already support spaces between:
- The open parenthesis and the test suíte name
- The test name and the close parenthesis
This support was added in issue http://www.cmake.org/Bug/view.php?id=10065.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-05-02 09:22 Thiago M. New Issue
2015-05-02 09:22 Thiago M. File Added: CMakeLists.txt
======================================================================
More information about the cmake-developers
mailing list