参考所有分组,完成尽量多的内容。禁止顺手扩功能 smoke
结论:按 LinuxCNC rs274ngc_pre.cc save_parameters()/restore_parameters() 的参数文件流程,收紧 OPFS 参数持久化后 WASM 根目录 scratch 文件清理;未扩展临时 smoke 行为。
This commit is contained in:
@@ -533,6 +533,7 @@ function installOpfsWorkspace(module, options) {
|
|||||||
} else {
|
} else {
|
||||||
await removeOpfsFileEntry(workspacePath, `${path}.bak`);
|
await removeOpfsFileEntry(workspacePath, `${path}.bak`);
|
||||||
}
|
}
|
||||||
|
cleanupLinuxCncParameterFiles(module);
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
async removeFile(path) {
|
async removeFile(path) {
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ export async function runBrowserOpfsParameterSections(context, simulator) {
|
|||||||
withSmokeSimulator,
|
withSmokeSimulator,
|
||||||
} = context;
|
} = context;
|
||||||
const backend = { backend: "linuxcnc-rs274" };
|
const backend = { backend: "linuxcnc-rs274" };
|
||||||
const parseWithParameters = (program, path) =>
|
const parseWithParameters = (program, path) => simulator.parseWithParameterFile(program, path, "linuxcnc", backend);
|
||||||
simulator.parseWithParameterFile(program, path, "linuxcnc", backend);
|
|
||||||
|
|
||||||
await runSection("opfs parameter save", async () => {
|
await runSection("opfs parameter save", async () => {
|
||||||
await simulator.parseWithParameterFile("G21 G90\nG0 X1\nG28.1\nM30\n", "parameters/rs274ngc.var", "linuxcnc", backend);
|
await simulator.parseWithParameterFile("G21 G90\nG0 X1\nG28.1\nM30\n", "parameters/rs274ngc.var", "linuxcnc", backend);
|
||||||
const opfsParameterFile = await readOpfsText(simulator, "parameters/rs274ngc.var");
|
const opfsParameterFile = await readOpfsText(simulator, "parameters/rs274ngc.var");
|
||||||
expectIncludes(opfsParameterFile, "5161\t1.000000", "LinuxCNC parameter file was not persisted into OPFS");
|
expectIncludes(opfsParameterFile, "5161\t1.000000", "LinuxCNC parameter file was not persisted into OPFS");
|
||||||
|
expectWasmFilesMissing(simulator.fs.module.FS, ["rs274ngc.var", "rs274ngc.var.new", "rs274ngc.var.bak"], (parameterPath) => `LinuxCNC parameter scratch file remained outside OPFS after save: ${parameterPath}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
await runSection("opfs parameter restore in new instance", async () => {
|
await runSection("opfs parameter restore in new instance", async () => {
|
||||||
@@ -84,6 +84,7 @@ export async function runBrowserOpfsParameterSections(context, simulator) {
|
|||||||
const opfsParameterBackup = await readOpfsText(simulator, "parameters/backup-bridge.var.bak");
|
const opfsParameterBackup = await readOpfsText(simulator, "parameters/backup-bridge.var.bak");
|
||||||
expectIncludes(opfsParameterBackup, "5161\t1.000000",
|
expectIncludes(opfsParameterBackup, "5161\t1.000000",
|
||||||
"LinuxCNC parameter backup file was not bridged into OPFS");
|
"LinuxCNC parameter backup file was not bridged into OPFS");
|
||||||
|
expectWasmFilesMissing(simulator.fs.module.FS, ["rs274ngc.var", "rs274ngc.var.new", "rs274ngc.var.bak"], (parameterPath) => `LinuxCNC parameter scratch file remained outside OPFS after backup bridge: ${parameterPath}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
await runSection("opfs parameter backup after existing save", async () => {
|
await runSection("opfs parameter backup after existing save", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user