继续推进:浏览器批量验证LinuxCNC配置入口

结论:浏览器 WASM smoke 已读取 LinuxCNC 生成的 64 个 switchkins 配置用例,覆盖 config/MACHINE/KINEMATICS/HALFILE 入口;native 与 source-link 验证通过。
This commit is contained in:
cnc
2026-05-30 10:19:32 +08:00
parent c2d1aa6fe3
commit 1498d9830d
6 changed files with 134 additions and 4 deletions

View File

@@ -44,6 +44,37 @@
throw new Error(`missing LinuxCNC WASM browser M${427 + line} switchkins type ${kinstype}`);
}
}
const configCaseResponse = await fetch("/public/linuxcnc_switchkins_remap_config_cases.json");
if (!configCaseResponse.ok) {
throw new Error(`failed to load LinuxCNC switchkins config cases: ${configCaseResponse.status}`);
}
const configCases = await configCaseResponse.json();
if (!Array.isArray(configCases) || configCases.length === 0) {
throw new Error("missing LinuxCNC switchkins config cases");
}
for (const configCase of configCases) {
const options = {
backend: "linuxcnc-rs274",
[configCase.field]: configCase.value,
};
const program = configCase.m430 >= 0 ? "M428\nM429\nM430\n" : "M428\nM429\n";
const configEvents = simulator.parse(program, "linuxcnc", options);
for (const [line, kinstype] of [
[1, configCase.m428],
[2, configCase.m429],
...(configCase.m430 >= 0 ? [[3, configCase.m430]] : []),
]) {
const sawSwitch = configEvents.some(
(event) => event.type === "kinematics-switch" && event.line === line && event.reserved === kinstype,
);
if (!sawSwitch) {
throw new Error(
`missing LinuxCNC WASM browser generated ${configCase.field}=${configCase.value} line ${line} switchkins type ${kinstype}`,
);
}
}
}
result.textContent = "browser wasm smoke passed";
} finally {
simulator.dispose();