Initial LinuxCNC WebAssembly workspace snapshot
This commit is contained in:
32
scripts/test_posemath_runtime.py
Normal file
32
scripts/test_posemath_runtime.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class PosemathRuntimeTests(unittest.TestCase):
|
||||
def test_native_posemath_binary(self):
|
||||
binary = ROOT / "build-native/sim_posemath_test"
|
||||
if not binary.is_file():
|
||||
self.skipTest("native build has not been generated")
|
||||
result = subprocess.run([str(binary)], cwd=ROOT, check=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
self.assertEqual(result.returncode, 0, result.stderr.decode(errors="replace"))
|
||||
|
||||
def test_wasm_exports_posemath_api(self):
|
||||
module = ROOT / "build-wasm/linuxcnc-sim-core.js"
|
||||
if not module.is_file():
|
||||
self.skipTest("WASM build has not been generated")
|
||||
text = module.read_text(encoding="utf-8")
|
||||
for symbol in ("sim_posemath_normalize", "sim_posemath_dot", "sim_posemath_line_point"):
|
||||
self.assertIn(symbol, text)
|
||||
|
||||
def test_posemath_source_is_linked(self):
|
||||
cmake = (ROOT / "wasm-core/CMakeLists.txt").read_text(encoding="utf-8")
|
||||
self.assertIn("posemath.cc", cmake)
|
||||
self.assertIn("target_link_libraries(sim_core PUBLIC sim_posemath)", cmake)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user