69 lines
2.1 KiB
Python
69 lines
2.1 KiB
Python
"""Smoke tests for standalone GUI product folders."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_BUILD_ROOT = Path(__file__).resolve().parents[2]
|
|
if str(_BUILD_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_BUILD_ROOT))
|
|
|
|
from common.paths import GUI_DIST_DIR, gui_dist_dir
|
|
|
|
# Product profiles for GUI packaging verification.
|
|
GUI_PRODUCTS: dict[str, dict] = {
|
|
"ory_finger": {
|
|
"dist_name": "OrisysDashboard",
|
|
"exe_name": "OrisysDashboard.exe",
|
|
"required_relpaths": [
|
|
"config/dd02-ov.json",
|
|
"sensors/finger/assets/30fps-0703/mesh.npz",
|
|
"sensors/finger/assets/30fps-0703/world_to_cam.npy",
|
|
"sensors/finger/assets/visualization/world_to_cam.npy",
|
|
],
|
|
},
|
|
"ory_mini": {
|
|
"dist_name": "OryMini",
|
|
"exe_name": "OryMini.exe",
|
|
"required_relpaths": [
|
|
"config/mini.json",
|
|
],
|
|
},
|
|
"ory_box": {
|
|
"dist_name": "OryBox",
|
|
"exe_name": "OryBox.exe",
|
|
"required_relpaths": [
|
|
"config/ddjx01.json",
|
|
],
|
|
},
|
|
}
|
|
|
|
|
|
def verify_gui_dist(
|
|
dist_dir: Path | None = None,
|
|
*,
|
|
product: str = "ory_finger",
|
|
) -> None:
|
|
"""Smoke-test a standalone GUI folder for the given product."""
|
|
if product not in GUI_PRODUCTS:
|
|
raise ValueError(f"Unknown GUI product {product!r}; choose from {sorted(GUI_PRODUCTS)}")
|
|
|
|
profile = GUI_PRODUCTS[product]
|
|
if dist_dir is None:
|
|
dist_dir = gui_dist_dir(profile["dist_name"]) if product != "ory_finger" else GUI_DIST_DIR
|
|
dist_dir = dist_dir.resolve()
|
|
|
|
exe = dist_dir / profile["exe_name"]
|
|
if not exe.is_file():
|
|
raise FileNotFoundError(f"GUI executable not found: {exe}")
|
|
|
|
required = [dist_dir / rel for rel in profile["required_relpaths"]]
|
|
missing = [str(path.relative_to(dist_dir)) for path in required if not path.is_file()]
|
|
if missing:
|
|
raise FileNotFoundError(f"Missing bundled files in {dist_dir}: {', '.join(missing)}")
|
|
|
|
subprocess.check_call([str(exe), "--help"], cwd=dist_dir)
|
|
print(f"GUI dist smoke test OK ({product}): {exe}")
|