Code Coverage with gcov
БесплатноБез исполняемых скриптовНе проверенAdd gcov code coverage instrumentation to C/C++ projects
от gadievron★ 4 075 звёзд на GitHubОб этом скилле
Code Coverage with gcov
Purpose
Instrument C/C++ programs with gcov to measure test coverage.
Containment
The instrumented project is untrusted — its build scripts and the produced binary execute arbitrary code, and the .gcda/.gcno files that binary emits are untrusted bytes parsed by gcov/gcovr. Run every build, target-binary/test-suite execution, and gcov/gcovr invocation via libexec/raptor-run-sandboxed --output-dir <dir> <cmd> [args...] (--output-dir = the directory the command writes into). If a sandboxed step fails, fix the sandboxed invocation — never run the target's build system, binary, or the coverage extraction bare.
How It Works
Build with Coverage (sandboxed)
libexec/raptor-run-sandboxed --output-dir <project-dir> gcc --coverage -o program source.c
Run Program (sandboxed)
libexec/raptor-run-sandboxed --output-dir <project-dir> <project-dir>/program
# Creates .gcda files with execution data
Generate Reports
Text report (sandboxed — gcov parses the untrusted .gcda/.gcno bytes):
libexec/raptor-run-sandboxed --output-dir <project-dir> gcov source.c
# Creates source.c.gcov with line-by-line coverage
HTML report (sandboxed):
libexec/raptor-run-sandboxed --output-dir <project-dir> gcovr --html-details -o coverage.html
Coverage Flags
--coverage(shorthand for-fprofile-arcs -ftest-coverage -lgcov)- Add to both
CFLAGSandLDFLAGS
Build System Integration
Makefile
ENABLE_COVERAGE ?= 0
ifeq ($(ENABLE_COVERAGE),1)
CFLAGS += --coverage
LDFLAGS += --coverage
endif
CMake
option(ENABLE_COVERAGE "Enable coverage" OFF)
if(ENABLE_COVERAGE)
add_compile_options(--coverage)
add_link_options(--coverage)
endif()
When User Requests Coverage
Steps
All build/run/report commands below go through libexec/raptor-run-sandboxed --output-dir <project-dir> ... (every make target — clean included — executes the untrusted Makefile's commands; rm -f *.gcda *.gcno is your own command and needs no wrapper):
- Detect build system (Makefile/CMake/other)
- Add
--coverageto CFLAGS and LDFLAGS - Clean previous build:
libexec/raptor-run-sandboxed --output-dir <project-dir> make clean(or barerm -f *.gcda *.gcno) - Build with coverage:
libexec/raptor-run-sandboxed --output-dir <project-dir> make ENABLE_COVERAGE=1(or thecmake -DENABLE_COVERAGE=ON+ build equivalent, same wrapper) - Run tests:
libexec/raptor-run-sandboxed --output-dir <project-dir> make test(or the project's test binary, same wrapper) - Generate report:
libexec/raptor-run-sandboxed --output-dir <project-dir> gcovr --html-details coverage.html --print-summary - Present summary and path to HTML report
Output
Text (.gcov files):
-: 0:Source:main.c
5: 42: int x = 10;
#####: 43: unused_code();
5:= executed 5 times#####:= not executed-:= non-executable
HTML: Interactive report with color-coded coverage
Metrics
- Line coverage: Executed lines / total lines
- Branch coverage: Taken branches / total branches
- Function coverage: Called functions / total functions
Target: 80%+ line coverage, 70%+ branch coverage
Установить Code Coverage with gcov в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Code Coverage with gcov?
Add gcov code coverage instrumentation to C/C++ projects
Как установить скилл Code Coverage with gcov?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Code Coverage with gcov запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic