Implement WebAssembly runtime and kinematics coverage

This commit is contained in:
2026-08-21 06:04:48 +08:00
parent 5dd614c335
commit 554b72dae8
112 changed files with 47148 additions and 807 deletions

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import json
import json
import subprocess
import unittest
from pathlib import Path
@@ -17,7 +18,7 @@ class HalRuntimeTests(unittest.TestCase):
def test_header_declares_error_boundary(self):
header = (ROOT / "wasm-core/include/sim_hal.h").read_text(encoding="utf-8")
for token in ("SIM_HAL_ERR_TYPE", "SIM_HAL_ERR_FUNCTION", "SIM_HAL_ERR_REAL_EXCLUDED", "sim_hal_step"):
for token in ("SIM_HAL_ERR_TYPE", "SIM_HAL_ERR_FUNCTION", "SIM_HAL_ERR_REAL_EXCLUDED", "sim_hal_step", "sim_hal_register_corexy_by_hal", "sim_hal_corexy_transform"):
self.assertIn(token, header)
def test_wasm_exports_hal_api(self):
@@ -28,6 +29,11 @@ class HalRuntimeTests(unittest.TestCase):
for symbol in ("sim_hal_register_pin", "sim_hal_register_thread", "sim_hal_step"):
self.assertIn(symbol, text)
def test_corexy_hal_report(self):
report = json.loads((ROOT / "coverage/corexy-hal.report.json").read_text(encoding="utf-8"))
self.assertEqual(report["schema"], "corexy-hal-report.v1")
self.assertTrue(report["native_wasm"]["byte_identical_json"])
if __name__ == "__main__":
unittest.main()