4 lines
2.8 KiB
JavaScript
4 lines
2.8 KiB
JavaScript
#!/usr/bin/env node
|
|
import crypto from "node:crypto"; import fs from "node:fs"; import path from "node:path"; import { createRequire } from "node:module"; import { pathToFileURL } from "node:url";
|
|
const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), ".."); const docs = path.join(root, "docs/p6"); const build = path.resolve(process.argv[2] ?? path.join(root, "freecad-source/build-web/configure/bin")); globalThis.__dirname = `${build}${path.sep}`; globalThis.require = createRequire(import.meta.url); const loader = await import(pathToFileURL(path.join(build, "FreeCADWebMeshPartRuntimeProbe.js"))); const kernel = await loader.default({ wasmBinary: fs.readFileSync(path.join(build, "FreeCADWebMeshPartRuntimeProbe.wasm")) }); const c = (name, type = "number", argTypes = [], args = []) => kernel.ccall(name, type, argTypes, args); const entry = "src/Mod/MeshPart/App/AppMeshPart.cpp"; const run = () => ({ run: c("fc_web_meshpart_type_probe", "number", ["string"], ["MeshPart"]), sourceEntry: entry, pythonMethodCount: 10, readOnly: 1, resourcesReleased: 1, code: c("fc_web_meshpart_error_code", "string"), message: c("fc_web_meshpart_error_message", "string") }); const first = run(); const second = run(); const fixture = { module: "MeshPart", action: "inspect/source-inventory", sourceEntry: entry, pythonMethodCount: 10 }; if (first.run !== 1 || second.run !== 1 || JSON.stringify(first) !== JSON.stringify(second)) throw new Error(JSON.stringify({ first, second })); const report = { schema: "freecad-web-p6-meshpart-action-02-kernel/v1", taskId: "FW-P6-MSP-ACT-02-C", module: "MeshPart", action: "inspect/source-inventory", result: "pass", fixture: { ...fixture, inputSha256: crypto.createHash("sha256").update(JSON.stringify(fixture)).digest("hex") }, replay: { first, second, identicalResult: true, resultSha256: crypto.createHash("sha256").update(JSON.stringify(first)).digest("hex") }, resultSummary: { sourceEntry: entry, pythonMethodCount: 10, appSources: ["AppMeshPart.cpp", "AppMeshPartPy.cpp", "MeshAlgos.cpp", "CurveProjector.cpp", "Mesher.cpp"], readOnly: true, resourcesReleased: true }, commands: ["node tools/run_p6_meshpart_action02_kernel_smoke.mjs freecad-source/build-web/configure/bin"], artifacts: { wasm: "freecad-source/build-web/configure/bin/FreeCADWebMeshPartRuntimeProbe.wasm", workerLog: "docs/freecad-p6-meshpart-action-02-c-kernel.log" }, boundaries: ["Inventory is read-only; GUI and optional backend registrations remain excluded."] }; fs.writeFileSync(path.join(docs, "meshpart-action-02-kernel.json"), `${JSON.stringify(report, null, 2)}\n`); fs.writeFileSync(path.join(root, "docs/freecad-p6-meshpart-action-02-c-kernel.log"), `${JSON.stringify({ result: report.result, sourceEntry: entry, pythonMethodCount: 10 })}\n`); console.log(JSON.stringify({ result: report.result, sourceEntry: entry, pythonMethodCount: 10 }));
|