Release SPHLite 0.8.3
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
@@ -28,6 +29,15 @@ def read_fields(output: str) -> dict[str, str]:
|
||||
return fields
|
||||
|
||||
|
||||
def read_equals_fields(output: str) -> dict[str, str]:
|
||||
fields: dict[str, str] = {}
|
||||
for line in output.splitlines():
|
||||
if "=" in line:
|
||||
name, value = line.split("=", 1)
|
||||
fields[name.strip()] = value.strip()
|
||||
return fields
|
||||
|
||||
|
||||
def read_summary(path: Path) -> dict[str, str]:
|
||||
metrics: dict[str, str] = {}
|
||||
for line in path.read_text(encoding="utf-8").splitlines()[1:]:
|
||||
@@ -52,9 +62,34 @@ def main() -> int:
|
||||
|
||||
version = run_command([exe, "--version"])
|
||||
require_field(version.stdout, "version")
|
||||
if "0.8.2" not in version.stdout:
|
||||
if "0.8.3" not in version.stdout:
|
||||
raise AssertionError("CLI version mismatch")
|
||||
|
||||
capabilities = run_command([exe, "--cclite-capabilities"])
|
||||
cap_fields = read_equals_fields(capabilities.stdout)
|
||||
expected_capabilities = {
|
||||
"solver": "SPHLite",
|
||||
"cclite_worker": "yes",
|
||||
"ipc_backend": "windows_shmem_named_event",
|
||||
"command_block_version": "1",
|
||||
"data_layout": "AOR_V1",
|
||||
"supports_real_ipc": "yes" if os.name == "nt" else "no",
|
||||
"supports_sph_to_ccl_particle": "yes",
|
||||
"supports_ccl_to_sph_force": "yes",
|
||||
"max_particle_records": "4096",
|
||||
}
|
||||
for name, expected in expected_capabilities.items():
|
||||
if cap_fields.get(name) != expected:
|
||||
raise AssertionError(f"capabilities field {name} mismatch")
|
||||
capabilities_conflict = run_command(
|
||||
[exe, "--cclite-capabilities", "--cclite-worker"],
|
||||
expect_ok=False,
|
||||
)
|
||||
if "--cclite-capabilities must be used alone" not in (
|
||||
capabilities_conflict.stdout + capabilities_conflict.stderr
|
||||
):
|
||||
raise AssertionError("capabilities conflict error mismatch")
|
||||
|
||||
inspect = run_command([exe, model])
|
||||
for field in (
|
||||
"version",
|
||||
@@ -127,7 +162,7 @@ def main() -> int:
|
||||
):
|
||||
require_field(inspect.stdout, field)
|
||||
inspect_fields = read_fields(inspect.stdout)
|
||||
if inspect_fields["version"] != "0.8.2":
|
||||
if inspect_fields["version"] != "0.8.3":
|
||||
raise AssertionError("inspect version field mismatch")
|
||||
if Path(inspect_fields["input"]) != Path(model):
|
||||
raise AssertionError("inspect input field mismatch")
|
||||
@@ -253,9 +288,12 @@ def main() -> int:
|
||||
)
|
||||
if (
|
||||
"worker_state: ERROR" not in worker_unsupported.stdout
|
||||
or "error_code: 3" not in worker_unsupported.stdout
|
||||
or (
|
||||
"error_code: 3" not in worker_unsupported.stdout
|
||||
and "error_code: 5" not in worker_unsupported.stdout
|
||||
)
|
||||
):
|
||||
raise AssertionError("worker unsupported state was not reported")
|
||||
raise AssertionError("worker IPC error state was not reported")
|
||||
missing_file = run_command([exe, str(Path(output_dir) / "missing.inp")], expect_ok=False)
|
||||
require_field(missing_file.stderr, "error_code")
|
||||
conflict = run_command([exe, model, "--run", "--check"], expect_ok=False)
|
||||
|
||||
@@ -78,7 +78,7 @@ def main() -> int:
|
||||
raise AssertionError("Python wrapper is missing Solid particle state C ABI")
|
||||
if not hasattr(solver.lib, "sphlite_get_solid_diagnostics"):
|
||||
raise AssertionError("Python wrapper is missing Solid 0.5.1 diagnostics C ABI")
|
||||
if solver.version() != (0, 8, 2):
|
||||
if solver.version() != (0, 8, 3):
|
||||
raise AssertionError("Python version mismatch")
|
||||
|
||||
solver.initialize()
|
||||
|
||||
Reference in New Issue
Block a user