fix(e2e): instrument sim RF path; graceful shutdown; richer failure logs
Both e2e directions time out: nothing is delivered between nodes although the adapter connects fine and bridging code is equivalent to meshtastic's own firmware_harness. Before concluding, instrument the pinned meshtasticator: - on_receive now prints every observed packet (topic keys) to sim.log, - a [sim-text] listener prints any text packet any sim interface sees, - cleanup sends 'exit' through the cmdloop (graceful, no EOF-spam flood that was drowning the log tail), - workflow failure step prints 400 sim-log lines + the node logs dump.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user