Harden CLI paths and coupling export checks

This commit is contained in:
Codex
2026-07-02 23:53:17 +08:00
parent a750dc9e39
commit 7e98da3301
4 changed files with 95 additions and 40 deletions
+10
View File
@@ -16,6 +16,12 @@ def main() -> int:
from sphlite_debug import PHASE_SOLID, PHASE_WATER, STATUS_ACTIVE, SPHLite, SPHLiteError
wrapper_source = (root / "python" / "sphlite_debug.py").read_text(encoding="utf-8")
if "ctypes.CDLL" not in wrapper_source:
raise AssertionError("Python wrapper is not loading the C ABI library")
if "sphft_" in wrapper_source:
raise AssertionError("Python wrapper directly references Fortran symbols")
solver = SPHLite(args.library)
if PHASE_SOLID != 4 or STATUS_ACTIVE != 0:
raise AssertionError("Python constants are not locked")
@@ -37,6 +43,8 @@ def main() -> int:
solid_summary = solver.inspect(args.input)
if solid_summary["particles"] != 4:
raise AssertionError("solid inspect summary mismatch")
if "water_mass" not in solid_summary or "dt_cfl" not in solid_summary:
raise AssertionError("inspect helper did not include Water diagnostics")
solver.set_output_directory(root / "build-codex-unix")
solver.write_output(0, 0.0)
restart = root / "build-codex-unix" / "python_restart.tmp"
@@ -67,6 +75,8 @@ def main() -> int:
if water_state["phase"][0] != PHASE_WATER:
raise AssertionError("unexpected water particle phase")
run_summary = water.run(water_input)
if run_summary["particles"] != 4:
raise AssertionError("water run particle count mismatch")
if run_summary["water_mass"] <= 0.0 or run_summary["dt_cfl"] <= 0.0:
raise AssertionError("water run summary mismatch")
finally: