Skip to content

Commit efb8942

Browse files
committed
Fix genhtml error in coverage targets by specifying output directory
The genhtml command requires an explicit output directory via the -o flag. Without it, genhtml fails with "unable to open /cmd_line: Permission denied" in the Ubuntu CI environment. Add -o . to both coverage_gcc and coverage_clang targets to write HTML reports to the coverage/ working directory.
1 parent cb15dd3 commit efb8942

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ if(${GCOV})
6868
add_custom_target(coverage_gcc
6969
COMMAND cd ${CMAKE_BINARY_DIR}/src/CMakeFiles/unit.test.dir/ && ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unit.test
7070
COMMAND lcov -o app.info -c --directory ${CMAKE_BINARY_DIR}/src/CMakeFiles/unit.test.dir/ --ignore-errors mismatch --rc geninfo_unexecuted_blocks=1
71-
COMMAND genhtml app.info
71+
COMMAND genhtml app.info -o .
7272
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coverage/
7373
DEPENDS unit.test)
7474
endif()
@@ -78,7 +78,7 @@ if(${CLANGCOV})
7878
add_custom_target(coverage_clang
7979
COMMAND cd ${CMAKE_BINARY_DIR}/src/CMakeFiles/unit.test.dir/ && ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/unit.test
8080
COMMAND lcov -o app.info -c --directory ${CMAKE_BINARY_DIR}/src/CMakeFiles/unit.test.dir/
81-
COMMAND genhtml app.info
81+
COMMAND genhtml app.info -o .
8282
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/coverage/
8383
DEPENDS unit.test)
8484
#add_custom_target(coverage_clang

0 commit comments

Comments
 (0)