Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/blob/main/tests/amd/receipt-test.py # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `CUDApp / tests / amd / receipt-test.py` 49 lines · 2294 bytes Raw Blame History 1 #!/usr/bin/env python3 2 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 """Independent temporary-repository controls for current-head receipt admission.""" 4 import pathlib 5 import subprocess 6 import sys 7 import tempfile 8 9 checker = pathlib.Path(__file__).with_name('receipt.py') 10 with tempfile.TemporaryDirectory() as tmp: 11 root = pathlib.Path(tmp) / 'repo' 12 root.mkdir() 13 def git(*args): 14 subprocess.run(['git', '-C', str(root), '-c', 'user.name=Receipt Test', 15 '-c', 'user.email=receipt@example.invalid', *args], check=True, capture_output=True) 16 git('init', '-q') 17 (root / 'backend').mkdir() 18 source = root / 'backend/input.om' 19 source.write_text('first\n') 20 git('add', '.') 21 git('commit', '-qm', 'parent') 22 out = pathlib.Path(tmp) / 'receipt' 23 def run(mode, expected, label): 24 p = subprocess.run([sys.executable, '-I', str(checker), mode, str(root), str(out)], capture_output=True, text=True) 25 print(f'{label}: exit={p.returncode}\n{p.stdout}{p.stderr}', flush=True) 26 assert p.returncode == expected, label 27 run('write', 0, 'clean parent') 28 parent = (out / 'inputs.sha256').read_text() 29 source.write_text('child\n') 30 run('check', 1, 'dirty input') 31 git('add', '.') 32 git('commit', '-qm', 'child') 33 run('check', 1, 'copied parent receipt') 34 (out / 'source-head').write_text(subprocess.check_output(['git', '-C', str(root), 'rev-parse', 'HEAD']).decode()) 35 run('check', 1, 'parent bytes relabelled current head') 36 (out / 'inputs.sha256').unlink() 37 (out / 'source-head').unlink() 38 run('write', 0, 'clean child') 39 good = (out / 'inputs.sha256').read_text() 40 for label, bad in [('HOME path', good.replace('backend/', '$HOME/backend/')), 41 ('absolute path', good.replace('backend/', '/backend/')), 42 ('missing input', ''), ('duplicate input', good + good)]: 43 (out / 'inputs.sha256').write_text(bad) 44 run('check', 1, label) 45 (out / 'inputs.sha256').write_text(good) 46 p = subprocess.run(['sha256sum', '-c', str(out / 'inputs.sha256')], cwd=root, capture_output=True, text=True) 47 print(f'sha256sum -c: exit={p.returncode}\n{p.stdout}{p.stderr}') 48 assert p.returncode == 0 49 print('RECEIPT CONTROLS PASS')