Skip to main content
Back

diff2test

Projects/diff2test

diff2test

Completed

A zero-runtime-dependency C++20 test-impact analyzer that consumes existing CMake, compiler dependency, and CTest metadata to select only tests justified by build evidence, then widens conservatively when that evidence is incomplete.

Completed · C++20 CLI · team std::zero

CLI output

Problem

Large C++ repositories either run the entire test suite after every change or rely on heuristics that can silently miss affected tests.

Design principle

A faster test suite is only useful if the tests it omits are justified by evidence.

Third-party runtime dependencies
0
Documented C++ test executables
7
Repeated fixture analyses in the verification suite
20

How it works

  1. Read build evidence

    Changed paths, CMake File API codemodel v2, GCC/Clang Make-style dependency files and CTest json-v1 catalogue.

  2. Map changed files to targets

    Resolve file and header dependencies to translation units, owning targets and dependent targets.

  3. Resolve registered tests

    Match executable artifacts to direct CTest commands; retain an explainable evidence chain.

  4. Select or widen

    Emit a justified subset, the full known suite, or an explicit requirement to run the full suite when enumeration is unsafe.

Engineering decisions

Evidence over heuristics
A missing or ambiguous graph edge is not evidence that a test is unaffected. Narrow selection is conditional; unsafe evidence widens the result.
Keep runtime self-contained
A single C++20 source implements parsing, containment, traversal and output using the standard library. Git, CMake and CTest are caller-side tooling, not runtime subprocesses.
Make fallback observable
Separate nonzero safety outcomes distinguish a known full suite from a catalogue that cannot be trusted. CI integrations must handle either outcome explicitly.

Verification and evidence

The documented integration fixture selects AlphaTest for alpha.hpp and AlphaTest plus BetaTest for a shared header. Missing dependency evidence emits the known three-test suite. The repository also documents strict parser tests, a 10,000-prerequisite stress case, sanitizer builds and same-runner byte-for-byte reproducibility. These are controlled verification results, not a claim of speedup on arbitrary repositories.

Scope and limitations

The verified MVP targets Linux, GCC/Clang, CMake Unix Makefiles-style layout and direct CTest executable commands. It does not execute tests or prove that metadata perfectly matches source contents. Windows/MSVC, Ninja and generated/custom-command relationships need separate evidence adapters and verification.

Read the full technical article

Stack used

C++
CMake
CTest
ASan/UBSan