diff options
| author | eunhhu <[email protected]> | 2026-10-02 06:21:48 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-02 06:21:48 +0100 |
| commit | 2be6928a4367ff35209484becad6627e34ac9768 (patch) | |
| tree | e3af41b1611cdc064607553f33f3b82106164ffc /research/experiments/029-across-machines/recorded-pure-run | |
| parent | 28e51430cc860adc8d8f384d7662d85ab09dc5c7 (diff) | |
| download | pure-2be6928a4367ff35209484becad6627e34ac9768.tar.gz pure-2be6928a4367ff35209484becad6627e34ac9768.zip | |
Run Pure and aup on an x86_64 WSL2 and an M3 Mac against the Pi (029)
Every pure-run of aup's check (1,053 runs of 667 modules) gives the same
output, errors and exit on the Pi, the WSL2 (x86_64, 4 KiB pages, gcc 13)
and the Mac (Apple clang 21); the same events make byte-identical stores
on the Pi and the Mac, and either opens the other's and goes on the
same. Pure's checks pass one at a time in WSL (each_check.py); its wall
clock is set back about 2 s every 32 s (clock.py). stores.py streams
pure-run's output, whose size grows with the square of the events.
Diffstat (limited to 'research/experiments/029-across-machines/recorded-pure-run')
| -rwxr-xr-x | research/experiments/029-across-machines/recorded-pure-run | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/research/experiments/029-across-machines/recorded-pure-run b/research/experiments/029-across-machines/recorded-pure-run new file mode 100755 index 0000000..e9c6c23 --- /dev/null +++ b/research/experiments/029-across-machines/recorded-pure-run @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +"""pure-run, recorded: runs the real one (PURE_RUN) with the same +arguments and input, passes its output and exit on, and appends a JSON line +to PURE_RUN_LOG: the module's bytes, the arguments, the input, the output +and the errors, each as a SHA-256 with the check's temporary directory +written as $W, and the exit code. Given to aup's check as --pure-run.""" +import hashlib +import json +import os +import re +import subprocess +import sys + +TEMP = re.compile(rb'/[^\s"\'\\]*?/(?:aup-check|pure-check)-[A-Za-z0-9_]+') + + +def digest(data): + return hashlib.sha256(TEMP.sub(b'$W', data)).hexdigest()[:24] + + +given = sys.stdin.buffer.read() +args = sys.argv[1:] +done = subprocess.run([os.environ['PURE_RUN'], *args], input=given, capture_output=True) +sys.stdout.buffer.write(done.stdout) +sys.stderr.buffer.write(done.stderr) +module = next((a for a in args if a.endswith('.pmod') and os.path.exists(a)), None) +line = {'module': hashlib.sha256(open(module, 'rb').read()).hexdigest()[:24] if module else None, + 'args': digest('\0'.join(args).encode()), 'input': digest(given), 'output': digest(done.stdout), + 'errors': digest(done.stderr), 'exit': done.returncode} +with open(os.environ['PURE_RUN_LOG'], 'a') as log: + log.write(json.dumps(line) + '\n') +sys.exit(done.returncode) |
