18 lines
1.7 KiB
JavaScript
18 lines
1.7 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
const fixturePath = path.join(root, "tests/files/web/script_scene.blend");
|
|
const fixture = fs.readFileSync(fixturePath);
|
|
const fixtureSha256 = crypto.createHash("sha256").update(fixture).digest("hex");
|
|
const result = spawnSync(process.execPath, [path.join(root, "tools/web/check-script-main-reader.mjs")], { cwd: root, encoding: "utf8", maxBuffer: 20 * 1024 * 1024 });
|
|
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
|
|
assert.match(result.stdout, /script-main-reader-ok full-source=passed sha256=passed autorun-default-deny=passed/);
|
|
const report = { schemaVersion: 1, task: "M13-01B", operation: "BLEND_OPEN_SCRIPT_METADATA_ONLY", fixture: { path: "tests/files/web/script_scene.blend", byteLength: fixture.byteLength, sha256: fixtureSha256 }, sources: [{ name: "ExternalProject.py", executionStatus: "BLOCKED", readOnly: true }, { name: "InternalSafe.py", executionStatus: "BLOCKED", readOnly: true }, { name: "ModuleAutorun.py", executionStatus: "BLOCKED", readOnly: true, moduleAutorunRequested: true, errorCode: "SCRIPT_POLICY_DENIED" }], execution: "DENY", nextTask: "M13-01C" };
|
|
const reportPath = path.join(root, "tests/golden/M13-01B/open-metadata-report.json"); fs.mkdirSync(path.dirname(reportPath), { recursive: true }); fs.writeFileSync(reportPath, JSON.stringify(report, null, 2) + "\n");
|
|
process.stdout.write("script-open-metadata-ok blend=opened textMetadata=read sourceHash=verified execution=DENY autorun=DENY next=M13-01C\n");
|