Files
workinf_Blender_Wasm/tools/web/check-glb-recovery.mjs
mes123456 380cbed4ff
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Checkpoint web parity through Chromium input tasks
2026-08-19 10:39:03 -04:00

48 lines
2.4 KiB
JavaScript

import assert from "node:assert/strict";
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const manifest = JSON.parse(fs.readFileSync(path.join(root, "tests/golden/M12-06G/manifest.json"), "utf8"));
const report = JSON.parse(fs.readFileSync(path.join(root, "tests/golden/M12-06G/recovery-report.json"), "utf8"));
const fileHash = (file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
assert.deepEqual(
{ schemaVersion: manifest.schemaVersion, task: manifest.task, parentTask: manifest.parentTask, nextTask: manifest.nextTask },
{ schemaVersion: 1, task: "M12-06G", parentTask: "M12-06F", nextTask: "M12-07A" },
);
assert.deepEqual(
{ schemaVersion: report.schemaVersion, task: report.task, operation: report.operation, nextTask: report.nextTask },
{ schemaVersion: 1, task: "M12-06G", operation: "GLB_IMPORT_EXPORT_RECOVERY", nextTask: "M12-07A" },
);
assert.deepEqual(report.cancellation.map((item) => ({ operation: item.operation, status: item.status, code: item.code })), [
{ operation: "IMPORT", status: "CANCELLED", code: "GLB_OPERATION_CANCELLED" },
{ operation: "EXPORT", status: "CANCELLED", code: "GLB_OPERATION_CANCELLED" },
]);
assert.ok(report.cancellation.every((item) => item.committed === false && item.temporaryBytes === 0 && item.liveRequests === 0));
assert.deepEqual(report.workerRestart, {
operation: "IMPORT",
generationBefore: 1,
generationAfter: 2,
status: "RECOVERED",
code: "GLB_WORKER_RESTARTED",
resultHash: "EXACT",
});
assert.deepEqual(report.opfsQuota, {
operation: "EXPORT_ASSET_COMMIT",
status: "BLOCKED",
code: "GLB_OPFS_QUOTA",
backend: "OPFS",
committedAssetPreserved: true,
workerRestart: true,
smallAssetRecovery: true,
});
for (const artifact of Object.values(manifest.artifacts)) {
const file = path.join(root, artifact.path);
assert.ok(fs.existsSync(file), `missing artifact ${artifact.path}`);
assert.equal(fileHash(file), artifact.sha256, `hash mismatch ${artifact.path}`);
}
process.stdout.write(`glb-recovery-ok cancelled=${report.cancellation.length} workerGeneration=${report.workerRestart.generationAfter} quota=${report.opfsQuota.code} smallRecovery=${report.opfsQuota.smallAssetRecovery} next=${manifest.nextTask}\n`);