Phase 10: Audit engine reliability and strengthen lifecycle regression tests
This commit is contained in:
parent
4eb2080933
commit
8dd96d3cc5
13 changed files with 394 additions and 5 deletions
22
tools/analyze.py
Normal file
22
tools/analyze.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Run Clang's path-sensitive analyzer; any diagnostic fails the audit."""
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
if not shutil.which("clang"):
|
||||
sys.exit("clang is required for make analyze")
|
||||
jack = subprocess.run(["pkg-config", "--cflags", "jack"], capture_output=True, text=True) if shutil.which("pkg-config") else None
|
||||
for source in sys.argv[1:]:
|
||||
flags = []
|
||||
if source == "src/backend/jack_backend.c" and jack and jack.returncode == 0:
|
||||
import shlex
|
||||
flags = ["-DXTC_HAVE_JACK", *shlex.split(jack.stdout)]
|
||||
result = subprocess.run(["clang", "--analyze", "-std=c99", "-Iinclude",
|
||||
"-Xanalyzer", "-analyzer-output=text", *flags,
|
||||
str(pathlib.Path(source))], capture_output=True, text=True)
|
||||
if result.returncode or result.stderr:
|
||||
sys.stderr.write(result.stdout + result.stderr)
|
||||
sys.exit(result.returncode or 1)
|
||||
print("Clang static analysis passed for all core sources.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue