Files
cnc_wams/web-rtcp-5axis-xyzbc-trt-sim-plan/tests/browser/python_remap_pyodide_browser_smoke.html
2026-07-10 21:26:42 -04:00

47 lines
2.1 KiB
HTML

<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Python remap Pyodide browser smoke</title></head>
<body>
<pre id="status">running</pre>
<script type="module">
import { createLinuxCncPythonRemapBrowserWorkerAdapter } from "../../app/dist/wasm-port/runtime/sdk/src/python-remap-browser-worker-adapter.js";
import { createLinuxCncPythonRemapRuntimePort } from "../../app/dist/wasm-port/runtime/sdk/src/python-remap-runtime-port.js";
const status = document.getElementById("status");
try {
const adapter = createLinuxCncPythonRemapBrowserWorkerAdapter({
workerUrl: new URL("../../app/dist/wasm-port/runtime/workers/python-remap-worker.js", import.meta.url),
pythonRuntimeModuleUrl: new URL("../../app/dist/wasm-port/runtime/workers/python-remap-pyodide-provider.js", import.meta.url),
timeoutMs: 30000,
});
const port = createLinuxCncPythonRemapRuntimePort({
runtimeMode: "browser-pyodide-cpython-wasm",
runtimeAdapter: adapter,
});
const start = await port.start();
const result = await port.runLifecyclePlan();
const diagnostics = port.exportDiagnostics();
if (!start.runtimeExecutionReady || !start.executionEnabled || !start.promotionAllowed) {
throw new Error(`Pyodide start not promoted: ${JSON.stringify(start)}`);
}
if (!result.validation.ready || result.validation.firstYield !== 2) {
throw new Error(`LinuxCNC queuebuster lifecycle failed: ${JSON.stringify(result.validation)}`);
}
if (!result.executionEnabled || !result.promotionAllowed || !diagnostics.executionEnabled) {
throw new Error(`Python remap execution contract not enabled: ${JSON.stringify(diagnostics)}`);
}
await port.close();
status.textContent = [
"python_remap_pyodide_browser_runtime=ok",
"python_remap_queuebuster_first_yield=2",
"python_remap_execution_enabled=1",
"python_remap_promotion_allowed=1",
].join("\n");
} catch (error) {
status.textContent = `python_remap_pyodide_browser_runtime=fail\n${error.stack || error}`;
throw error;
}
</script>
</body>
</html>