I Built C++ Test Impact Analysis With Zero Runtime Dependencies
说明与用途
diff2test 是一个 CLI 工具,利用 CMake、CTest 和编译器生成的元数据,确定在文件更改后需要运行哪些 CTest 测试,从而在不添加运行时依赖的情况下减少 CI 时间。
问题
Running the full C++ test suite after every change is expensive; need to run only affected tests without adding runtime dependencies.
结果
diff2test reduces test execution time by selecting only impacted tests while remaining zero‑dependency at runtime.
工作流
- Collect changed file paths via git diff or stdin
- Provide a list of compiler .d files via --dep-list
- Read CMake File API JSON for targets and sources
- Read CTest JSON for test definitions
- Build reverse dependency graph from targets to tests
- Propagate impact from changed files to affected tests
- Validate evidence; if missing, exit with FULL_SUITE_SELECTED or FULL_SUITE_REQUIRED
- Output selected test names or exit code 0 for subset
证据
If something important is missing or suspicious, the optimization disappears.
The program would not produce its own evidence. It would consume evidence.
The successful narrow case is: SUBSET_SELECTED exit 0
- 记录日期: 2026-09-05T17:45:22.753Z