27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Compile unchanged production broker/console with isolated deterministic doubles.
|
|
No SDK, device, network, or persistent generated files required.
|
|
"""
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
ROOT = HERE.parent.parent
|
|
with tempfile.TemporaryDirectory(prefix="broker-diagnostics-") as directory:
|
|
build = Path(directory)
|
|
(build / "freertos").mkdir()
|
|
for name in ("session_broker.c", "session_broker.h", "session_console.c", "session_console.h"):
|
|
shutil.copyfile(ROOT / "src" / name, build / name)
|
|
shutil.copyfile(HERE / "fake.h", build / "fake.h")
|
|
shutil.copyfile(HERE / "test.c", build / "test.c")
|
|
for name in ("esp_err.h", "esp_heap_caps.h", "esp_console.h", "serial_service.h",
|
|
"freertos/FreeRTOS.h", "freertos/queue.h", "freertos/semphr.h",
|
|
"freertos/stream_buffer.h", "freertos/task.h"):
|
|
(build / name).write_text('#include "fake.h"\n')
|
|
subprocess.run(["cc", "-std=c11", "-D_POSIX_C_SOURCE=200809L", "-Wall", "-Wextra",
|
|
"-Werror", "-I", str(build), str(build / "test.c"),
|
|
"-o", str(build / "test")], check=True)
|
|
subprocess.run([str(build / "test")], check=True)
|