06db9c9e
test: the rigs stop the daemons they used to watch die
a73x 2026-08-28 19:53
Commit message
test/agent.sh
| Old | New | ||
|---|---|---|---|
| @@ -543,13 +543,28 @@ scen_tui() { | |||
| 543 | timeout 10 "$MUXA" send --sock "$SOCK_TUI" -- "$TUI_QUIT" >"$TMP/t2" 2>&1 | 543 | timeout 10 "$MUXA" send --sock "$SOCK_TUI" -- "$TUI_QUIT" >"$TMP/t2" 2>&1 |
| 544 | want "$TMP/t2" sent true || return 1 | 544 | want "$TMP/t2" sent true || return 1 |
| 545 | 545 | ||
| 546 | # The session ended: the pid the daemon reported for itself is gone. Not | 546 | # The SESSION ended and the daemon did NOT: `x` ends a session, never a |
| 547 | # the socket, which is unlinked a moment before the process is actually | 547 | # box. So the quit is witnessed by the daemon's own table going empty, |
| 548 | # down — only a pid can answer this. | 548 | # and then by the pid still answering — the daemon has to be alive to |
| 549 | # have said `sessions=0` in the first place, and the `kill -0` is what | ||
| 550 | # says the process is here rather than merely that the socket is. | ||
| 551 | _i=0 | ||
| 552 | while ! "$MUXD" stats --sock "$SOCK_TUI" 2>/dev/null | grep -q 'sessions=0'; do | ||
| 553 | _i=$((_i + 1)) | ||
| 554 | [ "$_i" -lt 100 ] || why "the TUI quit but its daemon still holds a session 5s later" || return 1 | ||
| 555 | sleep 0.05 | ||
| 556 | done | ||
| 557 | kill -0 "$D_TUI" 2>/dev/null || | ||
| 558 | why "the TUI daemon (pid $D_TUI) left with its last session — only muxd stop ends one" || return 1 | ||
| 559 | |||
| 560 | # The corpse the contract below needs, made deliberately: a daemon that | ||
| 561 | # is really gone is what an agent's next call has to meet, and nothing | ||
| 562 | # but a stop produces one now. | ||
| 563 | "$MUXD" stop --sock "$SOCK_TUI" >/dev/null 2>&1 | ||
| 549 | _i=0 | 564 | _i=0 |
| 550 | while kill -0 "$D_TUI" 2>/dev/null; do | 565 | while kill -0 "$D_TUI" 2>/dev/null; do |
| 551 | _i=$((_i + 1)) | 566 | _i=$((_i + 1)) |
| 552 | [ "$_i" -lt 100 ] || why "the TUI quit but its daemon (pid $D_TUI) is still up 5s later" || return 1 | 567 | [ "$_i" -lt 100 ] || why "muxd stop left the TUI daemon (pid $D_TUI) up 5s later" || return 1 |
| 553 | sleep 0.05 | 568 | sleep 0.05 |
| 554 | done | 569 | done |
| 555 | D_TUI="" | 570 | D_TUI="" |
| @@ -937,10 +952,10 @@ fi | |||
| 937 | # Every daemon this run started wrote its verdict into a log of its own (see | 952 | # Every daemon this run started wrote its verdict into a log of its own (see |
| 938 | # start_daemon), so this reads ALL of them rather than the most recent one's. | 953 | # start_daemon), so this reads ALL of them rather than the most recent one's. |
| 939 | # leakcheck already gated the three scenarios that stop their own daemon; what | 954 | # leakcheck already gated the three scenarios that stop their own daemon; what |
| 940 | # lands here is everything else — the TUI daemon whose session ended under | 955 | # lands here is everything else — the QUIC daemon scenario 8 emptied, and any |
| 941 | # it, the QUIC daemon scenario 8 emptied, and any daemon a FAILING scenario | 956 | # daemon a FAILING scenario left behind, which is exactly the case that used |
| 942 | # left behind, which is exactly the case that used to go unswept. Emptying a | 957 | # to go unswept. Emptying a daemon does not remove it from this list: nothing |
| 943 | # daemon does not remove it from this list: nothing but `muxd stop` ends one. | 958 | # but `muxd stop` ends one. |
| 944 | # | 959 | # |
| 945 | # After the count pin on purpose: a leak is not a scenario, and folding it | 960 | # After the count pin on purpose: a leak is not a scenario, and folding it |
| 946 | # into PASSES+FAILS+SKIPS would make that pin's number stop meaning "nine | 961 | # into PASSES+FAILS+SKIPS would make that pin's number stop meaning "nine |
test/e2e.sh
| Old | New | ||
|---|---|---|---|
| @@ -177,8 +177,8 @@ done | |||
| 177 | # one of those and adds a convergence point would be pinning a fact every | 177 | # one of those and adds a convergence point would be pinning a fact every |
| 178 | # leg above already establishes. | 178 | # leg above already establishes. |
| 179 | 179 | ||
| 180 | [ "$OK_COUNT" = "83" ] || { | 180 | [ "$OK_COUNT" = "84" ] || { |
| 181 | echo "e2e FAIL: $OK_COUNT scenario checkpoints ran, the pin says 83 —" | 181 | echo "e2e FAIL: $OK_COUNT scenario checkpoints ran, the pin says 84 —" |
| 182 | echo " a scenario was added (update the pin) or silently lost" | 182 | echo " a scenario was added (update the pin) or silently lost" |
| 183 | exit 1 | 183 | exit 1 |
| 184 | } | 184 | } |