test_a_gate_on_an_undeclared_symbol_is_kept

Tests › tests/test_kconfig.py

passed Passed in the packaged run.

What this test is for

Why it exists

Dead code behind a symbol nobody can set is a defect in the target. Filtering the gate list to declared symbols would delete the evidence of it, and it is the kind of thing this tool exists to surface.

Given

  1. db = tmp_path / "clew.db"
  2. _db_with_paths(db, ("src/motor.c",))
→

When

  1. import_kconfig(db, repo, None)
  2. import_kconfig_gates(db, repo)
  3. space = kconfig_space(db)
→

Then

  1. ✓ {s.name for s in space.symbols} does not contain "WIDGET_UNDECLARED"
  2. ✓ {g.symbol for g in space.gates} contains "WIDGET_UNDECLARED"

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) · 24 of 400 steps

… 70 earlier steps

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filesloop (line 134)looploop (line 135)loopopt (line 385)optmain71–72. repo_source_files → _scandir71_scandir +1 more73. _ts_language_for → _grammar_available73_grammar_available74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–80. build_context → scope_membership77scope_membership +3 more81. _ast_parse_one_file → _ts_language_for81_ts_language_for▶ test enters82–85. _ast_parse_one_file → _cached_parser82_cached_parser +3 more86–87. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +1 more

… 128 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyloop (line 1576)loopmain216. _memberdef_corpora → _expansion_sql216_expansion_sql217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists

… 158 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesother filesloop (line 660)looploop ×2 (line 288)loop ×2main379. _config_found_on_the_wire → _compact_gate_panel379_compact_gate_panel380. corpus_payload → kconfig_space380kconfig_space381. kconfig_space → connect381connect▶ test enters382. kconfig_space → _meta382_meta383. _meta → table_exists383table_exists384. kconfig_space → _symbols384_symbols385. _symbols → table_exists385table_exists386. kconfig_space → table_exists386table_exists387. kconfig_space → _gate_layer_state387_gate_layer_state388. _gate_layer_state → table_exists388table_exists389. kconfig_space → _gate_symbol_names389_gate_symbol_names390. _gate_symbol_names → table_exists390table_exists391. kconfig_space → _gates391_gates392. _gates → table_exists392table_exists393. _gates → _gate_columns393_gate_columns394–395. _gate_columns → has_columns394has_columns ×2396. _gates → _with_defaults396_with_defaults397. _with_defaults → table_exists397table_exists398. _with_defaults → _defaults_for_macros398_defaults_for_macros399. _with_defaults → decided_default399decided_default

… 1 later step

2 more

tests/test_kconfig.py:390 · its file's page

What it checks (2)

  1. assert "WIDGET_UNDECLARED" not in {s.name for s in space.symbols} observes kconfig_space via space
  2. assert "WIDGET_UNDECLARED" in {g.symbol for g in space.gates} observes kconfig_space via space

Where the product reaches it

  • main → query_main → _payload → export_search → corpus_payload → kconfig_space (flow)

Call flow

test_a_gate_on_an_undeclared_symbol_is_kept→_db_with_paths→import_kconfig→import_kconfig_gates→kconfig_space

What 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.

test_a_gate_on_an_undeclared_symbol_is_kept · 2 checksimport_kconfig_gatesdeclared_macro_namesbare_macro_namesREQ-DDB-CONFIG-004 · measuredimport_kconfigREQ-DDB-CONFIG-005 · measuredimport_kconfig_gatesrun_harvestREQ-DDB-PIPE-003 · measuredimport_kconfig_gatesREQ-DDB-PIPE-007 · measuredimport_kconfig_gatesrun_harvest_harvest_one_file_parseable_fileREQ-DDB-PIPE-011 · measuredimport_kconfig_gates… 4 calls …has_languageREQ-DDB-PIPE-012 · inferredimport_kconfigload_kconfig_served_parse_errorREQ-DDB-PIPE-014 · measuredkconfig_spaceconnectREQ-DDB-QUERY-001 · measuredkconfig_spacetable_existsREQ-DDB-QUERY-003 · measuredkconfig_space_gates_with_defaults_in_default_buildREQ-DDB-QUERY-004 · inferredkconfig_spaceREQ-DDB-QUERY-006 · measuredkconfig_space_gates_with_defaultsdecided_defaultREQ-DDB-QUERY-013 · inferred

and 1 more requirement paths, listed below.

Also reaches 14 requirements

Its run touches their code; that is reach, not proof.