"""Compile the production DAC.c against GPIO/IRQ mocks; no hardware writes.""" import os from pathlib import Path import shutil import subprocess import tempfile root = Path(__file__).resolve().parents[2] compiler = os.environ.get('CC') or shutil.which('gcc') or 'C:/msys64/mingw64/bin/gcc.exe' os.environ['PATH'] = str(Path(compiler).resolve().parent) + os.pathsep + os.environ['PATH'] with tempfile.TemporaryDirectory(prefix='load-control-') as tmp: exe = Path(tmp) / 'test.exe' subprocess.run([compiler, '-Wall', '-Wextra', '-std=c99', '-Itests/load_control/stubs', '-ISource/Internal/Include', 'tests/load_control/load_control_test.c', '-o', str(exe)], cwd=root, check=True) subprocess.run([str(exe)], check=True, timeout=10)