按规划继续工作
结论:将 INI 派生非法参数文件和刀具表文件名的拒绝验证扩展到真实 Chromium OPFS 与 LinuxCNC INI WASM 路径,并通过 host/WASM/browser 聚合验证。
This commit is contained in:
@@ -123,7 +123,9 @@ named-parameter file path and negative interpreter fixtures with expected
|
||||
error text plus absent canonical motion output. It also uses real browser OPFS
|
||||
storage plus the interpreter SDK to restore and save a LinuxCNC parameter file
|
||||
through vendored `Interp::restore_parameters()` and `Interp::save_parameters()`,
|
||||
and to load/save LinuxCNC tool tables through vendored `tooldata_common.cc`.
|
||||
to load/save LinuxCNC tool tables through vendored `tooldata_common.cc`, and
|
||||
to reject invalid INI-derived parameter/tool-table file names through the OPFS
|
||||
path model after the names are parsed by the LinuxCNC-backed INI WASM SDK.
|
||||
|
||||
The aggregate host smoke script builds the INI and interpreter-core WASM
|
||||
artifacts once, then runs the Node WASM smokes, the Node OPFS mock smoke, and
|
||||
@@ -260,9 +262,9 @@ groups INI, parameter, and tool-table loading, the random-toolchanger flag
|
||||
derived from vendored LinuxCNC INI boolean parsing, INI-derived
|
||||
`[RS274NGC]PARAMETER_FILE` and `[EMCIO]TOOL_TABLE` file names mapped to OPFS
|
||||
machine files, OPFS path-model rejection of invalid INI-derived file names,
|
||||
and a browser interpreter smoke that uses the same session bridge before
|
||||
saving OPFS-backed parameter and tool-table text through vendored LinuxCNC
|
||||
file APIs.
|
||||
and a browser interpreter smoke that uses the same session bridge with real
|
||||
LinuxCNC INI WASM parsing before saving OPFS-backed parameter and tool-table
|
||||
text through vendored LinuxCNC file APIs.
|
||||
Full browser coverage, full SDK coverage, and richer machine-state validation
|
||||
remain future work.
|
||||
|
||||
|
||||
@@ -61,6 +61,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function verifyRejects(fixtureName, operation, expectedPattern) {
|
||||
try {
|
||||
await operation();
|
||||
} catch (error) {
|
||||
if (!expectedPattern.test(error.message)) {
|
||||
throw new Error(`${fixtureName}: unexpected error ${error.message}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new Error(`${fixtureName}: expected rejection`);
|
||||
}
|
||||
|
||||
try {
|
||||
const interp = await createLinuxCncInterpSdk({
|
||||
locateFile(path) {
|
||||
@@ -400,6 +412,52 @@
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
await saveMachineTextFiles("browser-invalid-param-file-session", {
|
||||
ini: [
|
||||
"[EMC]",
|
||||
"MACHINE = browser-invalid-param-file-session",
|
||||
"",
|
||||
"[RS274NGC]",
|
||||
"PARAMETER_FILE = ../escape.var",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
await verifyRejects(
|
||||
"opfs_reject_invalid_ini_parameter_file",
|
||||
() => loadMachineSessionFromOpfs(
|
||||
interp,
|
||||
"browser-invalid-param-file-session",
|
||||
{
|
||||
iniSdk: ini,
|
||||
iniWasmPath: "/work/browser-invalid-param-file-session.ini",
|
||||
},
|
||||
),
|
||||
/Invalid parameter filename/,
|
||||
);
|
||||
|
||||
await saveMachineTextFiles("browser-invalid-tool-file-session", {
|
||||
ini: [
|
||||
"[EMC]",
|
||||
"MACHINE = browser-invalid-tool-file-session",
|
||||
"",
|
||||
"[EMCIO]",
|
||||
"TOOL_TABLE = nested/tool.tbl",
|
||||
"",
|
||||
].join("\n"),
|
||||
});
|
||||
await verifyRejects(
|
||||
"opfs_reject_invalid_ini_tool_table",
|
||||
() => loadMachineSessionFromOpfs(
|
||||
interp,
|
||||
"browser-invalid-tool-file-session",
|
||||
{
|
||||
iniSdk: ini,
|
||||
iniWasmPath: "/work/browser-invalid-tool-file-session.ini",
|
||||
},
|
||||
),
|
||||
/Invalid tool table filename/,
|
||||
);
|
||||
|
||||
status.textContent = "browser_interp_smoke=ok";
|
||||
} catch (error) {
|
||||
status.textContent = `browser_interp_smoke=fail ${error.stack || error.message}`;
|
||||
|
||||
Reference in New Issue
Block a user