Complete XYZAC LinuxCNC WASM parity and smooth 3D preview
This commit is contained in:
45
scripts/test_xyzac_trt_native_startup.py
Normal file
45
scripts/test_xyzac_trt_native_startup.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the repository LinuxCNC launcher reaches the XYZAC kins runtime."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class XyzacNativeStartupTest(unittest.TestCase):
|
||||
def run_case(self, ini: str) -> dict[str, object]:
|
||||
command = ["timeout", "--signal=TERM", "--kill-after=2s", "8s", "./run-5axis-rtcp.sh", ini]
|
||||
result = subprocess.run(command, cwd=ROOT, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, check=False)
|
||||
output = result.stdout
|
||||
required = [
|
||||
"Found file(LIB):",
|
||||
"setup_kins: cmd=loadrt",
|
||||
"coordinates=xyzac" if ini == "xyzac-trt.ini" else "coordinates=xyzbc",
|
||||
"Joint 4 ==> Axis C",
|
||||
"userkKinematicsSetup:",
|
||||
]
|
||||
return {
|
||||
"case": ini,
|
||||
"command": command,
|
||||
"returncode": result.returncode,
|
||||
"expected_timeout": result.returncode == 124,
|
||||
"required_markers": {marker: marker in output for marker in required},
|
||||
"output_sha256": hashlib.sha256(output.encode()).hexdigest(),
|
||||
"output_tail": output[-1800:],
|
||||
}
|
||||
|
||||
def test_xyzac_and_xyzbc_startup(self):
|
||||
rows = [self.run_case("xyzac-trt.ini"), self.run_case("xyzbc-trt.ini")]
|
||||
self.assertTrue(all(row["expected_timeout"] for row in rows))
|
||||
self.assertTrue(all(all(row["required_markers"].values()) for row in rows))
|
||||
print(json.dumps({"schema": "xyzac-trt-native-startup.v1", "status": "verified", "cases": rows}, ensure_ascii=False))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user