docs: preserve verified save diagnostics package and provenance
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
from pathlib import Path
|
||||
import datetime, hashlib, json, os, platform, subprocess
|
||||
|
||||
root = Path(__file__).resolve().parent / 'package46'
|
||||
record = json.loads((root / 'extraction-check.json').read_text())
|
||||
bundle = Path(record['bundle'])
|
||||
native = root / 'qa/native46'
|
||||
work = root / 'working'
|
||||
sha = lambda p: hashlib.sha256(p.read_bytes()).hexdigest()
|
||||
def inventory(p):
|
||||
return {f.relative_to(p).as_posix(): sha(f) for f in p.rglob('*') if f.is_file()}
|
||||
assert inventory(bundle) == record['sha256']
|
||||
system = os.environ['SystemRoot']
|
||||
env = os.environ.copy()
|
||||
env['PATH'] = str(Path(system) / 'System32') + ';' + system
|
||||
for key in list(env):
|
||||
if key.startswith(('CARGO_', 'RUST', 'LLVM', 'WGPU', 'ARCADIA_')):
|
||||
del env[key]
|
||||
command = [str(bundle / 'arcadia-studio.exe')]
|
||||
receipt = {'source': '0e83157e09d52e6152df91208e41693b62da2d46',
|
||||
'package_documentation_source': 'ef28f1784efe6717b0ca72c0eb3c97bc30ebfe47',
|
||||
'start': datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
||||
'command': command, 'cwd': str(work), 'path': env['PATH'], 'platform': platform.platform(),
|
||||
'archive_sha256': record['archive_sha256'],
|
||||
'binary_sha256': sha(Path(command[0])), 'runtime_sha256': sha(bundle / 'libunwind.dll')}
|
||||
with (native / 'stdout.log').open('xb') as out, (native / 'stderr.log').open('xb') as err:
|
||||
child = subprocess.Popen(command, cwd=work, env=env, stdout=out, stderr=err,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW)
|
||||
receipt['pid'] = child.pid
|
||||
(native / 'started.json').write_text(json.dumps(receipt, indent=2) + '\n', encoding='utf-8')
|
||||
print(json.dumps(receipt, indent=2), flush=True)
|
||||
code = child.wait()
|
||||
receipt.update({'exit_code': code, 'finished': datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
||||
'stdout_bytes': (native / 'stdout.log').stat().st_size,
|
||||
'stderr_bytes': (native / 'stderr.log').stat().st_size,
|
||||
'package_files_unchanged': inventory(bundle) == record['sha256']})
|
||||
(native / 'finished.json').write_text(json.dumps(receipt, indent=2) + '\n', encoding='utf-8')
|
||||
print(json.dumps(receipt, indent=2), flush=True)
|
||||
assert code == 0 and receipt['stdout_bytes'] == receipt['stderr_bytes'] == 0 and receipt['package_files_unchanged']
|
||||
Reference in New Issue
Block a user