Skip to content

Commit 52ccd15

Browse files
authored
Make sure cleanup runs before the tests (#36)
1 parent 66dd9b8 commit 52ccd15

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmake/Modules/CodeCoverage.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ function(ADD_CODE_COVERAGE)
148148
add_custom_target(${Coverage_NAME}_cleanup_cpp
149149
# Cleanup lcov
150150
COMMAND ${LCOV_PATH} --directory . --zerocounters
151-
# Create baseline to make sure untouched files show up in the report
152-
COMMAND ${LCOV_PATH} -c -i -d . -o ${PROJECT_BINARY_DIR}/${Coverage_NAME}.base
153151
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
154152
DEPENDS ${Coverage_DEPENDENCIES}
155153
COMMENT "Resetting CPP code coverage counters to zero."
@@ -162,13 +160,15 @@ function(ADD_CODE_COVERAGE)
162160
COMMENT "Resetting PYTHON code coverage counters to zero."
163161
)
164162

165-
# Cleanup before we run tests
166-
add_dependencies(_run_tests_${PROJECT_NAME} ${Coverage_NAME}_cleanup_cpp)
167-
add_dependencies(_run_tests_${PROJECT_NAME} ${Coverage_NAME}_cleanup_py)
163+
# Cleanup before we run tests (attach to the tests target, which is completed before any test is run)
164+
add_dependencies(tests ${Coverage_NAME}_cleanup_cpp)
165+
add_dependencies(tests ${Coverage_NAME}_cleanup_py)
168166

169167
# Create C++ coverage report
170168
add_custom_target(${Coverage_NAME}_cpp
171169
COMMAND export PYTHONIOENCODING=UTF-8
170+
# Create baseline to make sure untouched files show up in the report
171+
COMMAND ${LCOV_PATH} -c -i -d . -o ${PROJECT_BINARY_DIR}/${Coverage_NAME}.base
172172
# Capturing lcov counters and generating report
173173
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info
174174
# add baseline counters

0 commit comments

Comments
 (0)