'Access violation' when execute_process runs gtest-executable for test-coverage
Hi,
I was getting strange link-step errors after enabling test coverage with clang-cl 11.
add_definitions(-fprofile-instr-generate -fcoverage-mapping)
I implemented a workaround in <cmake>\share\cmake-3.18\Modules\GoogleTestAddTests.cmake
line 68ff
execute_process(
COMMAND ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" --gtest_list_tests
WORKING_DIRECTORY "${_TEST_WORKING_DIR}"
TIMEOUT ${_TEST_DISCOVERY_TIMEOUT}
OUTPUT_VARIABLE output
RESULT_VARIABLE result
)
if(NOT ${result} EQUAL 0)
if (${output} MATCHES "Running main\\(\\) from gmock_main\\.cc")
message(STATUS "Getting false-negative result '${result}' from execute_process, but output seems valid.")
else()
string(REPLACE "\n" "\n " output "${output}")
message(FATAL_ERROR
"Error running test executable.\n"
" Path: '${_TEST_EXECUTABLE}'\n"
" Result: ${result}\n"
" Output:\n"
" ${output}\n"
)
endif()
endif()
Output is now (and that is all that I was able to find out, no idea how it happens)
Getting false-negative result 'Access violation' from execute_process, but output seems valid.
Why would the execute_process on the gtest-executable report 'Access violation' when it ran just fine?