test_build_honours_toolchain_config_and_skips_binaries¶
Tests › tests/test_toolchain.py
What this test is for
Why it exists
The test says nothing about why.
Given
repo = tmp_path / "repo"_write(repo, "src/main.c", "int helper(int x) { return x; }\nint main(void) { return 0; }\n")
7 more
_write(repo, "vendor/lib/v.c", "int vendored(void) { return 2; }\n")_write(repo, "gen/g.c", "int generated(void) { return 3; }\n")_write(repo, "doc_only/d.c", "int gate_only(void) { return 4; }\n")(repo / "src" / "blob.c").write_bytes(ZIP)(repo / "toolchain.toml").write_text('[ignore]\npaths = ["vendor/**"]\n')(repo / "suppress.toml").write_text( '[[suppress]]\nname = "g"\ntool = "*"\nfile_glob = "gen/**"\n' '[[suppress]]\nname = "d"\ntool = "clew"\nfile_glob = "doc_only/**"\n' )out = tmp_path / "clew.db"
When
_run_pipeline(_build_argparser().parse_args(["--output", str(out), "--repo-root", str(repo)]))conn = sqlite3.connect(out)functions = {r[0] for r in conn.execute("SELECT name FROM memberdef WHERE kind='function'")}
2 more
files = {r[0] for r in conn.execute("SELECT name FROM path WHERE type=1")}meta = dict(conn.execute("SELECT key, value FROM build_meta WHERE key LIKE 'scope.%'"))
Then
- ✓ functions equals {"helper", "main", "gate_only"}
- ✓ any(name.endswith("blob.c") for name in files) is false
- ✓ json.loads(meta["scope.toolchain_ignores"]) equals ["vendor/**", "gen/**"]
- ✓ meta["scope.toolchain_config"] equals "toolchain.toml, suppress.toml"
- ✓ meta["scope.toolchain_excluded"] equals "2"
- ✓ meta["scope.skipped_binary"] equals "1"
- ✓ meta["scope.skipped_binary_sample"] contains "blob.c (archive)"
- ✓ meta.get("scope.operator_excludes", "") does not contain "vendor"
What it exercises
The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.
clew — `main` (clew/cli.py) · 31 of 400 steps
… 10 earlier steps
… 26 steps between
… 4 steps between
… 23 steps between
… 57 steps between
… 27 steps between
… 190 later steps
6 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 27 of 142 steps
- Build, refresh and check the index · 21 of 153 steps
- `main` (clew/guard/main.py) · 12 of 357 steps
- Build this wiki from the index · 7 of 400 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 1 of 17 steps
- `main` (scripts/incremental_probe.py) · 1 of 3 steps
tests/test_toolchain.py:132 · its file's page
What it checks (8)
assert functions == {"helper", "main", "gate_only"}, ( "vendor/ and gen/ are excluded for every tool; doc_only/ only for clew's gate" )not attributedassert not any(name.endswith("blob.c") for name in files)not attributedassert json.loads(meta["scope.toolchain_ignores"]) == ["vendor/**", "gen/**"]not attributedassert meta["scope.toolchain_config"] == "toolchain.toml, suppress.toml"not attributedassert meta["scope.toolchain_excluded"] == "2"not attributedassert meta["scope.skipped_binary"] == "1"not attributedassert "blob.c (archive)" in meta["scope.skipped_binary_sample"]not attributedassert "vendor" not in meta.get("scope.operator_excludes", ""), "never replayed as operator"not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
Call flow
test_build_honours_toolchain_config_and_skips_binaries→_write→_run_pipeline→_build_argparserWhat it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
and 42 more requirement paths, listed below.
Also reaches 55 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CLI-001 measured
- REQ-DDB-CLI-002 inferred
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-CONFIG-003 inferred
- REQ-DDB-CONFIG-004 measured
- REQ-DDB-CONFIG-005 measured
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-CONFIG-009 measured
- REQ-DDB-GUARD-012 inferred
- REQ-DDB-GUARD-019 inferred
- REQ-DDB-GUARD-024 inferred
- REQ-DDB-INDEX-001 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-INDEX-004 measured
- REQ-DDB-INDEX-005 measured
- REQ-DDB-INDEX-006 measured
- REQ-DDB-INDEX-007 measured
- REQ-DDB-INDEX-008 measured
- REQ-DDB-INDEX-009 measured
- REQ-DDB-INDEX-010 measured
- REQ-DDB-INDEX-011 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-001 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 measured
- REQ-DDB-PIPE-005 measured
- REQ-DDB-PIPE-006 measured
- REQ-DDB-PIPE-007 measured
- REQ-DDB-PIPE-008 measured
- REQ-DDB-PIPE-009 measured
- REQ-DDB-PIPE-010 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 measured
- REQ-DDB-PIPE-013 measured
- REQ-DDB-PIPE-014 measured
- REQ-DDB-PIPE-015 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-011 measured
- REQ-DDB-SCHEMA-001 measured
- REQ-DDB-SCHEMA-002 measured
- REQ-DDB-SCHEMA-003 measured
- REQ-DDB-SCHEMA-004 measured
- REQ-DDB-SCHEMA-005 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-SCHEMA-007 measured
- REQ-DDB-SCHEMA-009 measured
- REQ-DDB-SCHEMA-011 measured
- REQ-DDB-SCHEMA-012 measured
- REQ-DDB-SCHEMA-013 measured
- REQ-DDB-SCHEMA-014 measured
- REQ-DDB-SCHEMA-015 measured
- REQ-DDB-WIKI-054 inferred