Files
pyxis/tests/reference/test_microlxmf_telemetry_field.py
T
Torlando 0c8418d674 fix(propagation): stop 2s path-table polling during sync (microLXMF bump)
Bumps microLXMF d7e05fd -> 82d2e54 (fork branch
fix/sync-path-wait-backoff): LXMRouter::process_sync() PR_PATH_REQUESTED
now re-polls Transport::has_path() at most once per PATH_REQUEST_WAIT
instead of every main-loop iteration. In the CBA microStore-backed
microReticulum fork has_path() is a FileStore exists() = a LittleFS
read, so the old code issued a path-table read every ~2s for the whole
60s sync window while the propagation node was unreachable. Measured on
the T-Deck: one destination fetched 293x in 600s (~every 2s), all on
the same 2MB partition as message storage, with [DISP] flush stalls
interleaved. Worst-case sync cycle cost drops from ~30 reads to ~3-4.

The periodic message sync was already 4h default with a user setting
(Settings 'Prop Sync Interval (hrs)', sync_int=14400) — unchanged.

Adds tests/build_scripts/test_propagation_sync_poll_contract.py:
pins the re-poll gate ordering, the PATH_REQUEST_WAIT window, the
untouched one-shot check in request_messages_from_propagation_node,
and enforces platformio.ini <-> audit-tool pin agreement.
2026-09-06 04:24:15 +00:00

68 lines
2.2 KiB
Python

"""Build and run telemetry fields through the exact pinned microLXMF source."""
from __future__ import annotations
import os
from pathlib import Path
import subprocess
import pytest
ROOT = Path(__file__).resolve().parents[2]
DEFAULT_MICROLXMF = ROOT / ".pio" / "libdeps" / "tdeck" / "microLXMF"
def test_pinned_microlxmf_telemetry_field_roundtrip(tmp_path):
if os.environ.get("PYXIS_RUN_MICROLXMF_NATIVE") != "1":
pytest.skip("set PYXIS_RUN_MICROLXMF_NATIVE=1 for the dependency-level test")
microlxmf = Path(os.environ.get("PYXIS_MICROLXMF_SRC", DEFAULT_MICROLXMF))
bridge = microlxmf / "conformance-bridge"
source = microlxmf / "src"
if not (source / "LXMF" / "LXMessage.cpp").is_file():
pytest.fail(f"pinned microLXMF source is unavailable at {microlxmf}")
expected = "82d2e54d721d9e4ce3ffc0049d9996aa5632390a"
actual = subprocess.run(
["git", "-C", str(microlxmf), "rev-parse", "HEAD"],
capture_output=True,
text=True,
check=True,
).stdout.strip()
assert actual == expected
build = tmp_path / "build"
configure = subprocess.run(
[
"cmake",
"-S",
str(ROOT / "tests" / "microlxmf"),
"-B",
str(build),
f"-DMICROLXMF_BRIDGE_DIR={bridge}",
f"-DMICROLXMF_SRC={source}",
f"-DPYXIS_ROOT={ROOT}",
"-DCMAKE_BUILD_TYPE=Debug",
],
capture_output=True,
text=True,
timeout=300,
)
assert configure.returncode == 0, configure.stdout + configure.stderr
compiled = subprocess.run(
["cmake", "--build", str(build), "--target", "test_pyxis_telemetry_field", "-j2"],
capture_output=True,
text=True,
timeout=600,
)
assert compiled.returncode == 0, compiled.stdout + compiled.stderr
binary = build / "test_pyxis_telemetry_field"
ran = subprocess.run(
[str(binary)], capture_output=True, text=True, timeout=60,
env={**os.environ, "ASAN_OPTIONS": "detect_leaks=1:halt_on_error=1"},
)
assert ran.returncode == 0, ran.stdout + ran.stderr
assert "microLXMF location fields roundtrip: passed" in ran.stdout