Instrument C/C++ programs with gcov to measure test coverage.
gcc --coverage -o program source.c
./program
# Creates .gcda files with execution data
Text report:
gcov source.c
# Creates source.c.gcov with line-by-line coverage
HTML report:
gcovr --html-details -o coverage.html
--coverage (shorthand for -fprofile-arcs -ftest-coverage -lgcov)CFLAGS and LDFLAGSENABLE_COVERAGE ?= 0
ifeq ($(ENABLE_COVERAGE),1)
CFLAGS += --coverage
LDFLAGS += --coverage
endif
option(ENABLE_COVERAGE "Enable coverage" OFF)
if(ENABLE_COVERAGE)
add_compile_options(--coverage)
add_link_options(--coverage)
endif()
--coverage to CFLAGS and LDFLAGSmake clean or rm -f *.gcda *.gcnomake ENABLE_COVERAGE=1 or cmake -DENABLE_COVERAGE=ONmake test or ./test_suitegcovr --html-details coverage.html --print-summaryText (.gcov files):
-: 0:Source:main.c
5: 42: int x = 10;
#####: 43: unused_code();
5: = executed 5 times#####: = not executed-: = non-executableHTML: Interactive report with color-coded coverage
Target: 80%+ line coverage, 70%+ branch coverage
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).