#!/usr/bin/env python3 """Compile and run the actual allocation-free firmware policy on the host.""" import os from pathlib import Path import shlex import subprocess import tempfile ROOT = Path(__file__).resolve().parents[2] env = dict(os.environ, CCACHE_DISABLE="1") with tempfile.TemporaryDirectory(prefix="ssh-auth-policy-") as temporary: binary = Path(temporary) / "test" command = shlex.split(env.get("CC", "cc")) + [ "-std=c11", "-Wall", "-Wextra", "-Werror", "-pedantic", *shlex.split(env.get("CFLAGS", """-O2""")), "-I", str(ROOT / "src"), str(ROOT / "src/ssh_auth_policy.c"), str(ROOT / "tests/ssh_auth_policy/test.c"), "-o", str(binary), ] subprocess.run(command, env=env, check=True) subprocess.run([str(binary)], env=env, check=True)