32 lines
2.4 KiB
Python
32 lines
2.4 KiB
Python
"""Read closed gate artifacts twice; no compiler, Git, model or native execution."""
|
|
from datetime import datetime, timezone
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
|
|
root = Path(__file__).resolve().parent
|
|
paths = [root / (stem + suffix) for stem in ('short-tests', 'short-bin-tests', 'desktop-all-targets', 'desktop-clippy') for suffix in ('.log', '-status.json')]
|
|
paths += [root / name for name in ('inputs.json', 'exact-inputs.zip', 'before-desktop-verify-head.json', 'after-desktop-verify-head.json', 'after-clippy-verify-head.json', 'preserve-build.ps1')]
|
|
paths += [root.parent / 'grapheme-fixed-windows-gates-report.md']
|
|
def read(path):
|
|
data = path.read_bytes()
|
|
return dict(path=str(path), bytes=len(data), sha256=hashlib.sha256(data).hexdigest().upper())
|
|
first = [read(path) for path in paths]
|
|
second = [read(path) for path in paths]
|
|
assert first == second
|
|
for stem, expected in (('short-tests', 101), ('short-bin-tests', 0), ('desktop-all-targets', 0), ('desktop-clippy', 0)):
|
|
record = json.loads((root / (stem + '-status.json')).read_text(encoding='utf-8-sig'))
|
|
assert record['exit'] == expected and record['completed_utc']
|
|
for name in ('before-desktop-verify-head.json', 'after-desktop-verify-head.json', 'after-clippy-verify-head.json'):
|
|
record = json.loads((root / name).read_text(encoding='utf-8-sig'))
|
|
assert record['pass'] and record['files'] == 529 and record['manifest_sha256'] == '8f787f119e8d82acb52c4f28bf4c3c6635d8970f1bc9d669deb7c1fcc8373eb5'
|
|
assert '756 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out' in (root / 'desktop-all-targets.log').read_text(encoding='utf-8-sig')
|
|
assert not any((root / name).exists() for name in ('studio-build.log', 'studio-build-status.json', 'bin', 'binary-manifest.json'))
|
|
receipt = dict(checked_utc=datetime.now(timezone.utc).isoformat(), scope='Closed test/Clippy evidence only; GUI build superseded and not run',
|
|
pass_=True, files=len(first), bytes=sum(r['bytes'] for r in first), first_read=first, second_read=second,
|
|
no_gui_build_or_binary_outputs=True)
|
|
with (root / 'closed-evidence-readback.json').open('x', encoding='utf-8', newline='\n') as output:
|
|
json.dump(receipt, output, indent=2)
|
|
output.write('\n')
|
|
print(json.dumps(dict(files=len(first), bytes=receipt['bytes'], pass_=True, report=first[-1], readback=read(root / 'closed-evidence-readback.json')), indent=2))
|