diff --git a/.gitea/workflows/meshtasticator-e2e.yaml b/.gitea/workflows/meshtasticator-e2e.yaml index 6cdcad8..d4a0dc0 100644 --- a/.gitea/workflows/meshtasticator-e2e.yaml +++ b/.gitea/workflows/meshtasticator-e2e.yaml @@ -84,7 +84,9 @@ jobs: - name: Print simulator log (on failure) if: failure() run: | - echo "===== meshtasticator-sim.log =====" - tail -n 200 meshtasticator-sim.log 2>/dev/null || true + echo "===== meshtasticator-sim.log (tail) =====" + 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 =====" docker ps -a 2>/dev/null || true diff --git a/scripts/meshtasticator_e2e/run_e2e.sh b/scripts/meshtasticator_e2e/run_e2e.sh index e3f5da4..2a5a034 100755 --- a/scripts/meshtasticator_e2e/run_e2e.sh +++ b/scripts/meshtasticator_e2e/run_e2e.sh @@ -135,6 +135,32 @@ assert old in src, "move_figure source no longer matches the pinned meshtasticat src = src.replace(old, new) gui.write_text(src) 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 if [ "$MODE" = docker ]; then @@ -161,6 +187,10 @@ rm -f "$SIM_FIFO" cleanup() { 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) kill "$SIM_PID" 2>/dev/null || true wait "$SIM_PID" 2>/dev/null || true