From 869d08e1e54341542ff774ba791d31b3f92e7d48 Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Thu, 13 Feb 2025 12:24:08 +0900 Subject: [PATCH] [circle-mlir] Introduce cirmlir_coverage interface (#14661) This will introduce cirmlir_coverage CMake interface for test coverage report generation. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- circle-mlir/CMakeLists.txt | 3 +++ circle-mlir/infra/cmake/TestCoverage.cmake | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 circle-mlir/infra/cmake/TestCoverage.cmake diff --git a/circle-mlir/CMakeLists.txt b/circle-mlir/CMakeLists.txt index 677185e9f7c..4b8f65ca12c 100644 --- a/circle-mlir/CMakeLists.txt +++ b/circle-mlir/CMakeLists.txt @@ -23,6 +23,9 @@ endif() # configuration flags include(CfgOptionFlags) +# enable test coverage +include(TestCoverage) + # enable ctest include(CTest) diff --git a/circle-mlir/infra/cmake/TestCoverage.cmake b/circle-mlir/infra/cmake/TestCoverage.cmake new file mode 100644 index 00000000000..8bac6a3bf47 --- /dev/null +++ b/circle-mlir/infra/cmake/TestCoverage.cmake @@ -0,0 +1,5 @@ +add_library(cirmlir_coverage INTERFACE) +if(ENABLE_COVERAGE) + target_compile_options(cirmlir_coverage INTERFACE -g -O0 -fprofile-arcs -ftest-coverage) + target_link_libraries(cirmlir_coverage INTERFACE gcov) +endif()