From 60be1a88c828496ad222e2d7e4e51a751efaab22 Mon Sep 17 00:00:00 2001 From: doodspav Date: Sun, 14 Jul 2024 00:15:14 +0100 Subject: [PATCH] GHI #32 Set LLVM_PROFILE_FILE for tests --- test/cmake/CreateTest.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/cmake/CreateTest.cmake b/test/cmake/CreateTest.cmake index 689956ce7..6737cd354 100644 --- a/test/cmake/CreateTest.cmake +++ b/test/cmake/CreateTest.cmake @@ -189,6 +189,16 @@ function(_create_test) WORKING_DIRECTORY "${test_working_dir}" ) + # when compiling with LLVM, use unique name for each test's coverage file + # otherwise they will all have the same name and overwrite each other + # since the variable is prefixed with LLVM, no harm in always setting it + foreach(test IN LISTS added_tests) + string(MAKE_C_IDENTIFIER "${test}" safe_test_name) + set_tests_properties("${test}" PROPERTIES + ENVIRONMENT "LLVM_PROFILE_FILE=${safe_test_name}.profraw" + ) + endforeach() + # add label to tests so ctest can run them by kind foreach(test IN LISTS added_tests) set_property(