按规划继续工作

结论:补齐 INI 派生参数文件和刀具表 OPFS 会话加载,扩大浏览器解释器 file-path fixture 覆盖,并通过 host/WASM/browser 聚合验证。
This commit is contained in:
2026-06-08 09:00:54 +08:00
parent cf0887e0e7
commit e21f11d69f
7 changed files with 214 additions and 25 deletions

View File

@@ -14,6 +14,9 @@
import {
saveMachineParametersToOpfs,
} from "../../runtime/opfs/linuxcnc-parameter-bridge.js";
import {
saveTextFile,
} from "../../runtime/opfs/file-service.js";
import {
saveMachineToolTableToOpfs,
} from "../../runtime/opfs/linuxcnc-tool-table-bridge.js";
@@ -323,6 +326,80 @@
].join("\n"),
);
await saveMachineTextFiles("browser-ini-file-session", {
ini: [
"[EMC]",
"MACHINE = browser-ini-file-session",
"",
"[RS274NGC]",
"PARAMETER_FILE = browser-custom.var",
"",
"[EMCIO]",
"TOOL_TABLE = browser-custom-tool.tbl",
"",
].join("\n"),
});
await saveTextFile(
"linuxcnc/machines/browser-ini-file-session/browser-custom.var",
[
"5161 31.25",
"5162 62.5",
"5220 1",
"5221 4.5",
"5399 99",
"",
].join("\n"),
);
await saveTextFile(
"linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl",
"T8 P8 Z4.5 D0.5 ;browser custom tool\n",
);
const loadedIniFileSession = await loadMachineSessionFromOpfs(
interp,
"browser-ini-file-session",
{
iniSdk: ini,
iniWasmPath: "/work/browser-ini-file-session.ini",
parameterWasmPath: "/work/browser-custom.var",
toolTableWasmPath: "/work/browser-custom-tool.tbl",
},
);
if (
loadedIniFileSession.parameters.opfsPath !==
"linuxcnc/machines/browser-ini-file-session/browser-custom.var"
) {
throw new Error(`unexpected custom parameter path: ${loadedIniFileSession.parameters.opfsPath}`);
}
if (
loadedIniFileSession.toolTable.opfsPath !==
"linuxcnc/machines/browser-ini-file-session/browser-custom-tool.tbl"
) {
throw new Error(`unexpected custom tool path: ${loadedIniFileSession.toolTable.opfsPath}`);
}
verifyExpectedOutput(
"opfs_load_ini_named_parameter_file",
loadedIniFileSession.parameters.result,
[
"restore_parameters=0",
"parameter_5161=31.25",
"parameter_5162=62.5",
"parameter_5221=4.5",
"parameter_5399=99",
].join("\n"),
);
verifyExpectedOutput(
"opfs_load_ini_named_tool_table",
loadedIniFileSession.toolTable.result,
[
"tooldata_load=0",
"tool_1.toolno=8",
"tool_1.pocketno=8",
"tool_1.z=4.5",
"tool_1.diameter=0.5",
"tool_1.comment=browser custom tool",
].join("\n"),
);
status.textContent = "browser_interp_smoke=ok";
} catch (error) {
status.textContent = `browser_interp_smoke=fail ${error.stack || error.message}`;