Produce intermediate json output for coverage (#8252)
authorGereon Kremer <gkremer@cs.stanford.edu>
Tue, 8 Mar 2022 23:19:36 +0000 (00:19 +0100)
committerGitHub <noreply@github.com>
Tue, 8 Mar 2022 23:19:36 +0000 (23:19 +0000)
This splits the generation of coverage information into two steps, generating an intermediate json file. This allows further tooling to used this json information: we plan to check whether the APIs (and their tests) are complete by looking at their code coverage within the cpp api.

cmake/CodeCoverage.cmake

index c003d2cef2d9a613dff7bb475e7edf68a16c4fc3..9c691f8f796545308d757ed976ec299b33658ff3 100644 (file)
@@ -54,17 +54,24 @@ function(setup_code_coverage_fastcov)
       "Resetting code coverage counters to zero."
   )
 
-  add_custom_target(${COVERAGE_NAME}
+  add_custom_target(${COVERAGE_NAME}-json
     COMMAND
       ${FASTCOV_BINARY}
           -d ${COVERAGE_PATH} ${EXCLUDES} -o coverage.json
           -j${FASTCOV_PARALLEL_JOBS} -X
+    DEPENDS
+      ${COVERAGE_DEPENDENCIES}
+    COMMENT
+      "Generate code coverage JSON report."
+  )
+
+  add_custom_target(${COVERAGE_NAME}
     COMMAND
       ${FASTCOV_BINARY} -C coverage.json --lcov -o coverage.info
     COMMAND
       ${GENHTML_BINARY} --demangle-cpp --no-prefix -o coverage coverage.info
     DEPENDS
-      ${COVERAGE_DEPENDENCIES}
+      coverage-json
     COMMENT
       "Generate code coverage report."
   )