3fe816a8
test: the mac gate pins one daemon and reads its exe by pid
a73x 2026-09-04 10:16
Commit message
test/mac.sh
| Old | New | ||
|---|---|---|---|
| @@ -297,11 +297,24 @@ printf '%s\n' "$PRE" | grep -qx 'rt=absent' || | |||
| 297 | gssh 120 >/dev/null <<'G' || fail daemon "mux d start -d refused on the guest" | 297 | gssh 120 >/dev/null <<'G' || fail daemon "mux d start -d refused on the guest" |
| 298 | MUX_SHELL_INTEGRATION=1 ./mux d start -d | 298 | MUX_SHELL_INTEGRATION=1 ./mux d start -d |
| 299 | G | 299 | G |
| 300 | DPID=$(gssh 60 <<'G' | 300 | DINFO=$(gssh 60 <<'G' |
| 301 | pgrep -x mux | head -1 | 301 | echo "n=$(pgrep -x mux | wc -l | tr -d ' ')" |
| 302 | echo "pid=$(pgrep -x mux | head -1)" | ||
| 303 | pgrep -lx mux 2>/dev/null | sed 's/^/ps=/' | ||
| 302 | G | 304 | G |
| 303 | ) | 305 | ) |
| 304 | [ -n "$DPID" ] || fail daemon "no mux process on the guest after mux d start -d" | 306 | DN=$(printf '%s\n' "$DINFO" | sed -n 's/^n=//p') |
| 307 | DPID=$(printf '%s\n' "$DINFO" | sed -n 's/^pid=//p') | ||
| 308 | # The COUNT and not just the first pid, test/vm.sh's shape at its own daemon | ||
| 309 | # leg: with a second mux alive — a stuck starter, a leaked client — `head -1` | ||
| 310 | # picks one of them, and the socket, exe and stop assertions below then all | ||
| 311 | # grade whichever it happened to pick, reporting a coin toss as "daemon N | ||
| 312 | # does not hold the socket". A wrong count also covers "no daemon at all", | ||
| 313 | # so there is no separate emptiness check. | ||
| 314 | [ "$DN" = "1" ] || { | ||
| 315 | echo "mac FAIL: daemon: the guest runs ${DN:-<no answer>} mux processes after mux d start -d, want 1:" | ||
| 316 | printf '%s\n' "$DINFO" | sed -n 's/^ps=/ /p' | ||
| 317 | exit 1; } | ||
| 305 | 318 | ||
| 306 | SOCK="/tmp/mux-$GUID/muxd.sock" | 319 | SOCK="/tmp/mux-$GUID/muxd.sock" |
| 307 | gssh 60 >/dev/null <<G || fail daemon "daemon $DPID does not hold $SOCK" | 320 | gssh 60 >/dev/null <<G || fail daemon "daemon $DPID does not hold $SOCK" |
| @@ -312,10 +325,10 @@ G | |||
| 312 | # lsof reports, which resolves every symlink on the way, so a home directory | 325 | # lsof reports, which resolves every symlink on the way, so a home directory |
| 313 | # or a $TMPDIR reached through one would fail a correct exec unless the | 326 | # or a $TMPDIR reached through one would fail a correct exec unless the |
| 314 | # expected path is resolved the same way. | 327 | # expected path is resolved the same way. |
| 315 | DEXE=$(gssh 60 <<'G' | 328 | DEXE=$(gssh 60 <<G |
| 316 | . ./os_oracle.sh | 329 | . ./os_oracle.sh |
| 317 | echo "is=$(pid_exe $(pgrep -x mux | head -1))" | 330 | echo "is=\$(pid_exe $DPID)" |
| 318 | echo "want=$(real_path ./mux)" | 331 | echo "want=\$(real_path ./mux)" |
| 319 | G | 332 | G |
| 320 | ) | 333 | ) |
| 321 | _is=$(printf '%s\n' "$DEXE" | sed -n 's/^is=//p') | 334 | _is=$(printf '%s\n' "$DEXE" | sed -n 's/^is=//p') |