Files
Claro/tools/validate_learning_ownership.py
T
Hermes Agent d555071406 fix: stabilize learning path, reliability and legacy Windows builds
Unify beginner syntax while preserving compatibility, repair ownership and parser guards, add verified distribution tooling and VC6 Windows 98 build inputs, and clarify documentation and release status. Preserve DOS build-input line endings and exclude generated binaries/caches.
2026-10-20 22:40:19 +00:00

31 lines
1.4 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']:
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()