Skip to content

Commit

Permalink
[dev] Rewrite ./dev/gen-coverage.sh in python
Browse files Browse the repository at this point in the history
  • Loading branch information
svalat committed Oct 3, 2024
1 parent 1100ce5 commit 52c0aa5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmake/macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ function(malt_print_status)
message(STATUS "| gcc-coverage : ${ENABLE_GCC_COVERAGE}")
message(STATUS "| valgrind : ${ENABLE_VALGRIND}")
message(STATUS "--------------------------------------------------------------")
message(STATUS "| openmp : ${OpenMP_CXX_FLAGS}")
message(STATUS "| libunwind : ${LIBUNWIND_LIBRARIES}")
message(STATUS "| libelf : ${LIBELF_LIBRARY}")
#message(STATUS "| iniparser : ${INIPARSER_LIBRARY}")
Expand Down
5 changes: 5 additions & 0 deletions dev/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def run_shell(cmd: str) -> None:
cprint(f" + {cmd}", "light_blue")
subprocess.run(cmd, shell=True, check=True)

############################################################
def run_shell_cmds(cmds: list) -> None:
for cmd in cmds:
run_shell(cmd)

############################################################
@contextmanager
def jump_in_dir(path: str):
Expand Down
21 changes: 15 additions & 6 deletions dev/gen-coverage.sh → dev/gen-coverage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env python3
############################################################
# PROJECT : MALT (MALoc Tracker)
# VERSION : 1.2.4
Expand All @@ -14,10 +14,19 @@
# coverage results

############################################################
set -e
set -x
from common import print_exception, run_shell_cmds

############################################################
lcov -o out.info -c -d .
lcov -o out.info --remove out.info '/usr/*' '*/Test*' '*/tests/*' '*/extern-deps/*'
genhtml -o html out.info
def malt_gen_coverage() -> None:
run_shell_cmds([
"lcov -o out.info -c -d .",
"lcov -o out.info --remove out.info '/usr/*' '*/Test*' '*/tests/*' '*/extern-deps/*'",
"genhtml -o html out.info"
])

############################################################
if __name__ == "__main__":
try:
malt_gen_coverage()
except Exception as e:
print_exception(e)

0 comments on commit 52c0aa5

Please sign in to comment.