43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""Compare deterministic definitions and rendered artifacts without repeating unrelated tests."""
|
|
|
|
import hashlib
|
|
import json
|
|
|
|
from build_definition import OUT, REPO, canonical
|
|
from rebuild import RESOURCE, build_all
|
|
from render_report import main as render
|
|
|
|
|
|
def main():
|
|
a, old = build_all()
|
|
b, previous = build_all()
|
|
assert a == b and old == previous
|
|
assert a == json.loads((REPO / RESOURCE).read_bytes())
|
|
render()
|
|
paths = [
|
|
OUT / "fixed-source-index.json",
|
|
OUT.parent / "截取视频每一帧固定参考中文说明.md",
|
|
]
|
|
before = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
|
|
render()
|
|
assert before == {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
|
|
(OUT / "repeatability.json").write_text(
|
|
json.dumps(
|
|
dict(
|
|
definitions=22,
|
|
repeated_build_equal=True,
|
|
repeated_render_equal=True,
|
|
resource_sha256=hashlib.sha256(canonical(a)).hexdigest(),
|
|
artifacts=before,
|
|
),
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
+ "\n"
|
|
)
|
|
print("PASS deterministic definitions and rendered artifacts: zero difference")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|