按规划继续工作

结论:补齐 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

@@ -201,6 +201,23 @@ const bridgeIniSdk = {
writeTextFile(path, text) {
bridgeFiles.set(`ini:${path}`, text);
},
getString(path, section, tag) {
if (
path === "/work/ini-file-session.ini" &&
section === "RS274NGC" &&
tag === "PARAMETER_FILE"
) {
return "custom.var";
}
if (
path === "/work/ini-file-session.ini" &&
section === "EMCIO" &&
tag === "TOOL_TABLE"
) {
return "custom-tool.tbl";
}
return null;
},
getBool(path, section, tag) {
if (
path === "/work/ini-derived-session.ini" &&
@@ -350,6 +367,55 @@ assert.equal(
"tooldata_load=0\nload_tool_path=/work/ini-derived-session-tool.tbl\nrandom_toolchanger=1\n",
);
await saveMachineTextFiles("ini-file-session", {
ini: [
"[EMC]",
"MACHINE = ini-file-session",
"",
"[RS274NGC]",
"PARAMETER_FILE = custom.var",
"",
"[EMCIO]",
"TOOL_TABLE = custom-tool.tbl",
"",
].join("\n"),
}, { storage });
await saveTextFile(
"linuxcnc/machines/ini-file-session/custom.var",
"5161 77.0\n5162 88.0\n",
storage,
);
await saveTextFile(
"linuxcnc/machines/ini-file-session/custom-tool.tbl",
"T8 P8 Z4.5 D0.5\n",
storage,
);
const loadedIniFileSession = await loadMachineSessionFromOpfs(
bridgeInterp,
"ini-file-session",
{
storage,
iniSdk: bridgeIniSdk,
iniWasmPath: "/work/ini-file-session.ini",
parameterWasmPath: "/work/ini-file-session.var",
toolTableWasmPath: "/work/ini-file-session-tool.tbl",
},
);
assert.equal(
loadedIniFileSession.parameters.opfsPath,
"linuxcnc/machines/ini-file-session/custom.var",
);
assert.equal(
loadedIniFileSession.toolTable.opfsPath,
"linuxcnc/machines/ini-file-session/custom-tool.tbl",
);
assert.equal(bridgeFiles.get("/work/ini-file-session.var"), "5161 77.0\n5162 88.0\n");
assert.equal(bridgeFiles.get("/work/ini-file-session-tool.tbl"), "T8 P8 Z4.5 D0.5\n");
assert.equal(
loadedIniFileSession.toolTable.result,
"tooldata_load=0\nload_tool_path=/work/ini-file-session-tool.tbl\nrandom_toolchanger=0\n",
);
await assert.rejects(
() => loadTextFile("linuxcnc/machines/missing.ini", storage),
/missing file/,