test_the_gate_layer_reports_its_own_state_independently_of_kconfig

Tests › tests/test_kconfig.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#404 — `found` ANSWERS A DIFFERENT QUESTION THAN THE ONE CALLERS ASK. It is true when a Kconfig was discovered and parsed, which is all it ever claimed. But a caller reads `found: false` as "this repository has no configuration space", and mbedtls — which has no Kconfig — measured 12,096 gating sites over 1,107 distinct symbols. Kconfig is a Zephyr/Linux convention; a header of `#define`s is the dominant C one, and reporting the dominant case as absence is the misreport `KconfigSpace` exists to prevent, one level up.

Verifies REQ-DDB-CONFIG-005 REQ-DDB-PIPE-014

Given

  1. gated, _db = _no_kconfig_repo(tmp_path / "gated")
→

When

  1. import_kconfig_gates(_db, gated)
  2. space = kconfig_space(_db, None)
  3. empty_db = tmp_path / "empty.db"
12 more
  1. conn = sqlite3.connect(str(empty_db))
  2. conn.execute("CREATE TABLE path (name TEXT, type INT)")
  3. ensure_kconfig_gates_table(conn)
  4. conn.commit()
  5. conn.close()
  6. empty_space = kconfig_space(empty_db, None)
  7. bare_db = tmp_path / "bare.db"
  8. conn = sqlite3.connect(str(bare_db))
  9. conn.execute("CREATE TABLE path (name TEXT, type INT)")
  10. conn.commit()
  11. conn.close()
  12. bare_space = kconfig_space(bare_db, None)
→

Then

  1. ✓ import_kconfig_gates(_db, gated) is greater than 0
  2. ✓ space.found is False
  3. ✓ space.gate_state equals LAYER_STATE_POPULATED
  4. ✓ space.gate_symbols is greater than 0
  5. ✓ space.found or space.gate_state == LAYER_STATE_POPULATED holds
  6. ✓ empty_space.gate_state equals LAYER_STATE_EMPTY
  7. ✓ empty_space.gate_symbols equals 0
  8. ✓ bare_space.gate_state equals LAYER_STATE_ABSENT

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) · 23 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:952 · its file's page

What it checks (8)

  1. assert import_kconfig_gates(_db, gated) > 0 observes import_kconfig_gates
  2. assert space.found is False, "this fixture has no Kconfig — `found` must stay honest about that" observes kconfig_space via space
  3. assert space.gate_state == LAYER_STATE_POPULATED observes kconfig_space via space
  4. assert space.gate_symbols > 0, "the harvest saw gating symbols and must say how many" observes kconfig_space via space
  5. assert space.found or space.gate_state == LAYER_STATE_POPULATED observes kconfig_space via space
  6. assert empty_space.gate_state == LAYER_STATE_EMPTY, ( "a table that exists and holds nothing is a MEASUREMENT, not an absent detector" ) observes kconfig_space via empty_space
  7. assert empty_space.gate_symbols == 0 observes kconfig_space via empty_space
  8. assert bare_space.gate_state == LAYER_STATE_ABSENT, ( "an absent layer must NOT read as an empty one — that is the substitution this whole " "class was written to prevent" ) observes kconfig_space via bare_space

Where the product reaches it

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

Call flow

test_the_gate_layer_reports_its_own_state_independently_of_kconfig→_no_kconfig_repo→import_kconfig_gates→kconfig_space→ensure_kconfig_gates_table

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_the_gate_layer_reports_its_own_state_independently_of_kconfig · 8 checksimport_kconfig_gatesdeclared_macro_namesbare_macro_namesREQ-DDB-CONFIG-004 · 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 · inferredkconfig_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 · inferredensure_kconfig_gates_tableREQ-DDB-SCHEMA-013 · measured

Requirements it verifies (2)

requirementlinked byimplementers exercised
REQ-DDB-CONFIG-005catalogunknown
REQ-DDB-PIPE-014catalogunknown
Also reaches 12 requirements

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