Files
linuxcncWebWASM/scripts/test_axis3_tutorial_preview.py

27 lines
805 B
Python

#!/usr/bin/env python3
"""Verify Web preview geometry is produced by the WASM worker."""
from __future__ import annotations
import json
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
PROGRAM = ROOT / "linuxcnc/nc_files/3dtest.ngc"
def main() -> int:
result = subprocess.run(["node", "web/worker/test_wasm_preview.mjs"], cwd=ROOT, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False)
if result.returncode != 0:
print(result.stderr, end="")
return result.returncode
report = json.loads(result.stdout.strip().splitlines()[-1])
print(json.dumps({"status": "verified", "program": PROGRAM.as_posix(), "preview": report}, ensure_ascii=False))
return 0
if __name__ == "__main__":
raise SystemExit(main())