From 29a35ab8baa7984d54128259b6fb550f5da72e21 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Sat, 14 Apr 2018 08:44:48 +0100 Subject: [PATCH] Set profiling environment variable when tests are run. This has no effect most of the time, but if the runtime is built with llvm-cov support, then this will cause each test to emit a .profraw file, which can be merged with: $ llvm-profdata merge -sparse Test/*.profraw -o libobjc.profdata This can then be used to generate coverage reports from the test suite and find code paths that are not currently being tested. --- Test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/CMakeLists.txt b/Test/CMakeLists.txt index 0dd5e91..0f4d5e9 100644 --- a/Test/CMakeLists.txt +++ b/Test/CMakeLists.txt @@ -81,7 +81,7 @@ function(addtest_flags TEST_NAME FLAGS TEST_SOURCE) LINKER_LANGUAGE C ) set_property(TEST ${TEST_NAME} PROPERTY - ENVIRONMENT "LD_LIBRARY_PATH=" + ENVIRONMENT "LD_LIBRARY_PATH=" "LLVM_PROFILE_FILE=${TEST_NAME}.profraw" ) target_link_libraries(${TEST_NAME} objc) endfunction(addtest_flags)