diff options
| author | eunhhu <[email protected]> | 2026-10-19 08:07:45 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-19 08:07:45 +0100 |
| commit | 143b790388637a6063418aeb61c9988cc9c4c094 (patch) | |
| tree | c129be9b27b40ad8867f3a02542303410465251f /research/experiments | |
| parent | 4a7e780278df740e5e37c3307fe687405df72448 (diff) | |
| download | pure-143b790388637a6063418aeb61c9988cc9c4c094.tar.gz pure-143b790388637a6063418aeb61c9988cc9c4c094.zip | |
029's record_all.py: the pure-runs of the checks 027, 028 and 140 added, recorded run by run for machines to compare (aup's 018 checks as 033's record.py does, its 027 stages', 028's bytes state, 140's frictions; Pure's module_specs, the nine specs on the three paths, Pure's specs copied under the temporary directory so no machine's paths are in an input): 486 runs of 41 modules on the Pi
Diffstat (limited to 'research/experiments')
| -rw-r--r-- | research/experiments/029-across-machines/record_all.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/research/experiments/029-across-machines/record_all.py b/research/experiments/029-across-machines/record_all.py new file mode 100644 index 0000000..5528862 --- /dev/null +++ b/research/experiments/029-across-machines/record_all.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 +"""The pure-runs of the checks that 027, 028 and 140 added, each recorded by recorded-pure-run, so that machines' records +compare run by run (compare.py): aup's checks of docs/design/018 (transients, computing: what 033's record.py records), +of 027's stages (bits and bytes, formats and texts, nested values, functions, the stored nest and keyed documents), of +028 (the bytes state) and of 140's frictions (bare lists, bytes compared, inner lists, rows read by position, the +frictions written away); and Pure's module_specs, the nine specs written in aup (SHA-256, JSON, JSON as a tree, +inflate, DNS, HTTP/1.1, UAX #14, RFC 6298, box layout), each on Pure's three paths. Pure's tests/specs are copied into +the temporary directory so that no machine's own paths are in a run's input. + +record_all.py AUP_ROOT PURE_ROOT OUT.jsonl the checks' report on stdout (MAKE: the make to build with)""" +import importlib.util +import json +import os +import shutil +import subprocess +import sys +import tempfile +from pathlib import Path + +aup_root, pure_root, out = (Path(a).resolve() for a in sys.argv[1:4]) +subprocess.run([os.environ.get('MAKE', 'make'), '-s', '-C', str(pure_root), 'build/pure-run'], check=True) +subprocess.run([os.environ.get('MAKE', 'make'), '-s', '-C', str(aup_root), 'build/aup'], check=True) +out.unlink(missing_ok=True) +os.environ['PURE_RUN'] = str(pure_root / 'build' / 'pure-run') +os.environ['PURE_RUN_LOG'] = str(out) +recorded = pure_root / 'research' / 'experiments' / '029-across-machines' / 'recorded-pure-run' +aup = aup_root / 'build' / 'aup' + + +def loaded(name, path): + spec = importlib.util.spec_from_file_location(name, path) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +check = loaded('aup_check', aup_root / 'tests' / 'check.py') +report = {} +with tempfile.TemporaryDirectory(prefix='aup-check-') as directory: + work = Path(directory) + for name, run in (('transients', lambda: check.transients(aup, recorded, work)), + ('computing', lambda: check.computing(aup, recorded, work)), + ('bits_and_bytes', lambda: check.bits_and_bytes(aup, recorded, work)), + ('formats_and_texts', lambda: check.formats_and_texts(aup, recorded, work)), + ('nested_values', lambda: check.nested_values(aup, recorded, work)), + ('functions', lambda: check.functions(aup, recorded, work)), + ('bare_lists', lambda: check.bare_lists(aup, recorded, work)), + ('bytes_compared', lambda: check.bytes_compared(aup, recorded, work)), + ('inner_lists', lambda: check.inner_lists(aup, recorded, work)), + ('rows_at', lambda: check.rows_at(aup, recorded, work)), + ('frictions', lambda: check.frictions(aup, recorded, work)), + ('bytes_state', lambda: check.bytes_state(aup, recorded, work)), + ('stored_nested', lambda: check.stored_nested(aup, recorded, work, range(2))), + ('documents', lambda: check.documents_model(aup, recorded, work, range(2)))): + report[name] = run() +pure_check = loaded('pure_check', pure_root / 'tests' / 'check.py') +with tempfile.TemporaryDirectory(prefix='pure-check-') as directory: + work = Path(directory) + view = work / 'pure' # Pure as module_specs reads it: its pure-run recorded, its specs here + (view / 'build').mkdir(parents=True) + shutil.copy(recorded, view / 'build' / 'pure-run') + shutil.copytree(pure_root / 'tests' / 'specs', view / 'tests' / 'specs') + pure_check.EXAMPLES = aup_root / 'examples' + report['module_specs'] = pure_check.module_specs(aup, view, work) +runs = sum(1 for _ in open(out)) +report['runs'] = runs +print(json.dumps(report)) |
