Priority: Not Evaluated
Affects Version/s: Qt Creator 4.4.0-rc1
Fix Version/s: None
Component/s: Test Integration
The "jump to location" feature of the "Test Results" output pane, does not work in specific build environments when gtest is used.
If a test fails the GTest command line output contains the path to the source file of the test.
Autotest uses this path to enable its "jump to location" feature (double click on the entry of the failed test in the output pane).
GTest uses the _FILE_ macro to report the test file location.
However the concrete expansion of the _FILE_ marco is usually the path by which the C/C++ preprocessor opened the file and that
depends on the build tools used and the location of the build directory.
A build environment where the "jump to location" feature does not work is the following:
Build and run test:
The test file location is reported relative to the build/ directory,
because ninja compiles location_test.cpp with:
When Autotest finds a relative path it tries to resolve it against the directory
that contains the test executable:
projectRoot/build/test/ + ../test/location_test.cpp = projectRoot/build/test/location_test.cpp = Not Found
When building the same project with cmake + make + gcc/clang the absolute path to the test file is reported,
because make compiles location_test.cpp with:
I have appended a minimal cmake project with that layout.
It uses the cmake external project feature to download and compile google-test, hence you can just use the commands from above
to build it (if ninja and cmake are installed on your system).