Helinity's picture
Release v0.1.0: sanitized Python security research benchmark
1340dfb
Raw History Blame Contribute Delete
1.88 kB
"""Run release-candidate acceptance checks; keep earlier phase reports untouched."""
import subprocess
import sys
from research.build import json_bytes
from scripts.generate_dataset import sanitize_log_output
from .audit import ROOT, RELEASE, main as write_audit
def main():
commands = [
['-m', 'pytest', '-q'],
['-m', 'scripts.generate_dataset', '--check'],
['-m', 'scripts.validate_dataset'],
['-m', 'research.build', '--check'],
['-m', 'research.harden', '--check'],
['-m', 'research.expansion.release', '--check'],
['-m', 'research.release_candidate.historical'],
['-m', 'research.release_candidate.exclusions'],
['-m', 'research.release_candidate.check_loading', '--write'],
]
results = []
for command in commands:
try:
run = subprocess.run([sys.executable, *command], cwd=ROOT,
capture_output=True, text=True, timeout=240)
result = dict(exit_code=run.returncode, stdout=sanitize_log_output(run.stdout),
stderr=sanitize_log_output(run.stderr))
except subprocess.TimeoutExpired:
result = dict(exit_code=124, stdout='', stderr='Acceptance command exceeded 240 seconds')
results.append(dict(command='python ' + ' '.join(command), **result))
print(results[-1]['command'], 'PASS' if result['exit_code'] == 0 else 'FAIL', flush=True)
if result['exit_code']:
print(result['stdout'], result['stderr'], flush=True)
(RELEASE / 'validation-results.json').write_bytes(json_bytes(results))
if any(result['exit_code'] for result in results):
raise SystemExit('Acceptance checks failed; no ready recommendation can be issued.')
write_audit()
from .report import main as report
report()
if __name__ == '__main__':
main()