Files
Claro/tools/validate_learning_ownership.py
Hermes Agent ed23524817 fix: harden Claro diagnostics and runtime guards
Preserve source locations, validate malformed JSON, and add opt-in resource limits. Include executable error-guide coverage, learner pilot materials, native Windows acceptance helpers, and updated CI/documentation.
2026-10-25 02:42:53 +00:00

31 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""Run the full introductory learning path with invalid-access and leak checks."""
from pathlib import Path
import os
import subprocess
import sys
import tempfile
ROOT = Path(__file__).resolve().parents[1]
def main():
if os.name == 'nt':
print('SKIP: learning LeakSanitizer validation requires POSIX')
return
with tempfile.TemporaryDirectory(prefix='claro-learning-ownership-', dir=os.environ.get('TMPDIR')) as tmp:
binary = Path(tmp) / 'claro-asan'
subprocess.run(['gcc', '-std=c89', '-pedantic-errors', '-Werror=implicit-function-declaration', '-O0', '-g', '-fsanitize=address,undefined', str(ROOT / 'src/claro.c'), '-o', str(binary), '-lm'], check=True)
env = dict(os.environ, ASAN_OPTIONS='detect_leaks=1:halt_on_error=1', UBSAN_OPTIONS='halt_on_error=1', CLARO_EXE=str(binary))
for checker in ['validate_learning_syntax.py', 'validate_first_hour.py', 'validate_error_locations.py', 'validate_error_guide.py', 'validate_learner_pilot.py', 'validate_resource_guards.py']:
result = subprocess.run([sys.executable, str(ROOT / 'tools' / checker)], cwd=ROOT, env=env, capture_output=True, text=True, timeout=90)
if result.returncode:
print(result.stdout + result.stderr)
raise SystemExit(result.returncode)
print('PASS: leak-checked', checker)
print('PASS: introductory lessons, examples, checker paths and REPL under ASan/UBSan/LSan')
if __name__ == '__main__':
main()