Skip to content

Instantly share code, notes, and snippets.

@rgov
Created February 19, 2019 16:30
Show Gist options
  • Select an option

  • Save rgov/4daa69aee9c57ccc2ac96354a7d08cfc to your computer and use it in GitHub Desktop.

Select an option

Save rgov/4daa69aee9c57ccc2ac96354a7d08cfc to your computer and use it in GitHub Desktop.
# Redefine add_test to set the LLVM_PROFILE_FILE environment variable
# on each test
function(add_test)
_add_test(${ARGN})
# There are two signatures to the add_test function to handle
if(ARGV0 STREQUAL "NAME")
set(TEST_NAME "${ARGV1}")
else()
set(TEST_NAME "${ARGV0}")
endif()
# Set the environment on the test
set_tests_properties(
"${TEST_NAME}"
PROPERTIES ENVIRONMENT
"LLVM_PROFILE_FILE=${PROJECT_BINARY_DIR}/coverage/cov-%m.profraw"
)
endfunction(add_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment