GoogleTest: gtest_discover_tests runs --gtest-list-tests command not in specified working directory
When using gtest_discover_tests(target WORKING_DIRECTORY directory)
, the command runs the test executable with the --gtest-list-tests
flag to obtain a list of all tests. Afterwards, the tests are registered on CTest and when run the WORKING_DIRECTORY as specified is used.
BUT the WORKING_DIRECTORY is not taken into account for the initial call with --gtest-list-tests
. My feature request would be that it is taken into account.
Why is this an issue? We have parametrized tests that load json files. These tests only run successfully when the working directory for the test executable is set to the base directory of the json files. Even calling the test executable with --gtest-list-tests
requires the correct working directory because the test names depend on the json files, therefore gtest_discover_tests
fails in this scenario.