Rebuild local Blender WASM environment and recovery evidence
This commit is contained in:
42
tools/web/check-wbv2-p5-003-desktop.py
Normal file
42
tools/web/check-wbv2-p5-003-desktop.py
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def state():
|
||||
scene = bpy.context.scene
|
||||
receipt = bpy.data.texts.get("WBV2-P5-003-ServerJobBindingReceipt")
|
||||
cube = bpy.data.objects.get("WBV2P5003ServerCube")
|
||||
if receipt is None or cube is None:
|
||||
raise RuntimeError("server job fixture is missing receipt or cube")
|
||||
return {"sceneId": "scene:" + scene.name, "cubeId": "object:" + cube.name, "engine": scene.render.engine, "resolution": [scene.render.resolution_x, scene.render.resolution_y], "receipt": json.loads(receipt.as_string())}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python check-wbv2-p5-003-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = state()
|
||||
temporary = fixture.with_name(f"{fixture.stem}-reopen.blend")
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(temporary), check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(temporary), load_ui=False)
|
||||
after = state()
|
||||
finally:
|
||||
temporary.unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"server job save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "WBV2-P5-003", "operation": "SERVER_JOB_BINDING_DESKTOP", "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "state": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("wbv2-p5-003-desktop-ok engine=%s request=%s result=%s saveReopen=exact" % (after["engine"], after["receipt"]["request"]["requestSha256"], after["receipt"]["result"]["resultSha256"]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user