feat(e2e): Meshtasticator radio-level validation harness for the adapter #2

Closed
eric wants to merge 9 commits from feat/meshtasticator-e2e into main
2 changed files with 34 additions and 2 deletions
Showing only changes of commit cbef4635cb - Show all commits
+4 -2
View File
@@ -84,7 +84,9 @@ jobs:
- name: Print simulator log (on failure) - name: Print simulator log (on failure)
if: failure() if: failure()
run: | run: |
echo "===== meshtasticator-sim.log =====" echo "===== meshtasticator-sim.log (tail) ====="
tail -n 200 meshtasticator-sim.log 2>/dev/null || true tail -n 400 meshtasticator-sim.log 2>/dev/null || true
echo "===== meshtasticator-nodes.log (if any) ====="
tail -n 200 meshtasticator-nodes.log 2>/dev/null || true
echo "===== docker ps =====" echo "===== docker ps ====="
docker ps -a 2>/dev/null || true docker ps -a 2>/dev/null || true
+30
View File
@@ -135,6 +135,32 @@ assert old in src, "move_figure source no longer matches the pinned meshtasticat
src = src.replace(old, new) src = src.replace(old, new)
gui.write_text(src) gui.write_text(src)
print("patched lib/gui.py") print("patched lib/gui.py")
# --- RF instrumentation (prints land in meshtasticator-sim.log) ---------------
# Why nothing is delivered between nodes is not yet known; log every packet the
# sim's per-node interfaces observe so the next failing run explains itself.
interactive = Path(sys.argv[1]) / "lib" / "interactive.py"
src = interactive.read_text()
old = ' def on_receive(self, interface, packet):\n'
new = old + (
' print(f"[sim] on_receive port={getattr(interface, \'portNumber\', None)} '
'decoded_keys={list(packet.get(\'decoded\', {}).keys())}")\n'
)
assert old in src, "on_receive signature moved in the pinned meshtasticator"
src = src.replace(old, new, 1)
old = ' pub.subscribe(self.on_receive, "meshtastic.receive.simulator")'
new = old + (
'\n pub.subscribe('
'lambda interface, packet: print(f"[sim-text] port={getattr(interface, \'portNumber\', None)} '
'text={packet.get(\'decoded\', {}).get(\'text\')!r}"), "meshtastic.receive.text")'
)
assert old in src, "simulator subscription moved in the pinned meshtasticator"
src = src.replace(old, new, 1)
interactive.write_text(src)
print("patched lib/interactive.py (RF instrumentation)")
PY PY
if [ "$MODE" = docker ]; then if [ "$MODE" = docker ]; then
@@ -161,6 +187,10 @@ rm -f "$SIM_FIFO"
cleanup() { cleanup() {
echo "== tearing down simulator (pid $SIM_PID) ==" echo "== tearing down simulator (pid $SIM_PID) =="
# Graceful 'exit' through the cmdloop (avoids hundreds of EOF spam lines in
# sim.log and lets the sim close its own nodes/container).
echo exit >&9 2>/dev/null || true
sleep 2
exec 9>&- 2>/dev/null || true # release the FIFO write end (sim stdin EOF) exec 9>&- 2>/dev/null || true # release the FIFO write end (sim stdin EOF)
kill "$SIM_PID" 2>/dev/null || true kill "$SIM_PID" 2>/dev/null || true
wait "$SIM_PID" 2>/dev/null || true wait "$SIM_PID" 2>/dev/null || true