| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/usr/bin/env python3
- """Active Formal registry checks for the single 6400-front-rear product."""
- from __future__ import annotations
- import json
- from pathlib import Path
- ROOT = Path(__file__).resolve().parents[2]
- FORMAL = ROOT / "tests" / "formal"
- def manifest() -> dict:
- return json.loads((FORMAL / "6400-properties.json").read_text(encoding="utf-8"))
- def test_active_manifest_is_single_product_and_has_no_identification_target() -> None:
- data = manifest()
- assert data["product"] == "6400-front-rear"
- serialized = json.dumps(data, sort_keys=True).lower()
- assert "identification" not in serialized
- assert "stimulus" not in serialized
- assert "6400-control" not in serialized
- def test_long_affected_registry_is_bounded_and_solver_mapped() -> None:
- data = manifest()
- assert data["required_solvers"] == ["per-target-solver-map"]
- targets = {target["name"]: target for target in data["proof_targets"]}
- assert "board_adapter" in targets
- assert all(target["depth"] <= 90 for target in targets.values())
- assert all((FORMAL / target["sby"]).is_file() for target in targets.values())
- assert (FORMAL / "solver-map.yaml").is_file()
- # No retired protection/position/event target may be an active proof target.
- live = json.dumps(targets, sort_keys=True).lower()
- for retired in ("pid", "stale", "snapshot_lock", "position", "event_ring", "host_i2c"):
- assert retired not in live
- def test_board_adapter_property_is_current_contract() -> None:
- harness = (FORMAL / "6400_board_adapter_properties_formal.v").read_text(
- encoding="utf-8"
- )
- adapter = (ROOT / "src/actuator/fan_board_output_adapter.v").read_text(
- encoding="utf-8"
- )
- assert "BOARD_INVERT_MASK = 8'h0F" in adapter
- assert "front_ball == ~connector_request[3:0]" in harness
- assert "rear_ball == connector_request[7:4]" in harness
- assert "boot_release" not in harness
- assert "force_full_speed" not in harness
- def test_remaining_long_acceptance_targets_are_explicitly_deferred() -> None:
- data = manifest()
- deferred = set(data["deferred_long_targets"])
- # Targets that the final contract still requires stay listed as deferred work.
- assert {"reset_safe_outputs", "watchdog_timeout_safe_transition"} <= deferred
- # Retired protection/position/event targets must not be required any more.
- for retired in ("pid_stale_hold", "hard_fault_cancels_manual", "snapshot_lock_stop_bit",
- "owner_watchdog", "set_all_timeout_priority", "manual_without_bmc"):
- assert retired not in deferred
- def test_formal_runner_uses_external_process_group_workdirs() -> None:
- runner = (ROOT / "tools" / "run_6400_formal.py").read_text(encoding="utf-8")
- assert "formal run base must be outside the Git worktree" in runner
- assert "start_new_session=True" in runner
- assert "os.killpg" in runner
|