Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:ClickHouse ClickHouse Code Coverage Collection

From Leeroopedia


Knowledge Sources
Domains Testing, Instrumentation
Last Updated 2026-02-08 00:00 GMT

Overview

A technique for measuring which parts of code are executed during testing to assess test completeness.

Description

Code coverage collection instruments programs to record which code paths are executed. Coverage data helps identify untested code, guide test development, and measure test quality. Modern coverage tools use compiler instrumentation (LLVM's SanitizerCoverage) that inserts callbacks at basic blocks, edges, or comparison points. ClickHouse uses custom coverage collection that stores executed addresses in arrays for per-test analysis.

Usage

Use for measuring test coverage, implementing coverage-guided fuzzing, identifying dead code, or analyzing execution patterns.

Theoretical Basis

Instrumentation Levels: Basic block (every block), edge (control flow transitions), path (full execution paths).

Compiler Integration: LLVM's `-fsanitize=coverage` instruments code with callbacks to user-defined functions.

Coverage Metrics: Line coverage, branch coverage, path coverage (increasingly expensive).

Fuzzing: Coverage-guided fuzzing (libFuzzer, AFL) uses coverage to guide input generation toward unexplored code.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment