e4156c53
test: the daemons whose label bar is asserted get a socket path that fits one
a73x 2026-09-04 10:16
Commit message
test/e2e_08_mouse.sh
| Old | New | ||
|---|---|---|---|
| @@ -696,9 +696,17 @@ ok "an application in a tile off the origin reads the press on its own row" | |||
| 696 | # the way a real terminal does. With the re-arm gone, the click back is | 696 | # the way a real terminal does. With the re-arm gone, the click back is |
| 697 | # bytes a terminal would never send — the verb exits 3 saying so, instead | 697 | # bytes a terminal would never send — the verb exits 3 saying so, instead |
| 698 | # of this leg green-lighting a wall no mouse can steer. | 698 | # of this leg green-lighting a wall no mouse can steer. |
| 699 | SOCKMC1="${TMPDIR:-/tmp}/muxd-e2e-deadclick1-$$.sock" | 699 | # /tmp and not $TMPDIR, which is the only place in this suite that says so. |
| 700 | # The assertion below greps a socket path out of a tile's LABEL BAR, and a | ||
| 701 | # bar on a two-pane 100-column wall is 50 columns: `labelText` keeps the | ||
| 702 | # state word and cuts the label's tail, which is the half that carries the | ||
| 703 | # `deadclick2` this leg looks for. macOS puts $TMPDIR in a per-user | ||
| 704 | # directory whose name alone was 48 characters on the box this was | ||
| 705 | # measured on, so the bar had nothing of the name left in it. The clicks below are at fixed columns, so widening | ||
| 706 | # the terminal is not free here the way it is in the hosts group. | ||
| 707 | SOCKMC1="/tmp/muxd-e2e-deadclick1-$$.sock" | ||
| 700 | defer_sock "$SOCKMC1" | 708 | defer_sock "$SOCKMC1" |
| 701 | SOCKMC2="${TMPDIR:-/tmp}/muxd-e2e-deadclick2-$$.sock" | 709 | SOCKMC2="/tmp/muxd-e2e-deadclick2-$$.sock" |
| 702 | defer_sock "$SOCKMC2" | 710 | defer_sock "$SOCKMC2" |
| 703 | MCSTATE="${TMPDIR:-/tmp}/mux-e2e-deadclick-state-$$" | 711 | MCSTATE="${TMPDIR:-/tmp}/mux-e2e-deadclick-state-$$" |
| 704 | defer_rm "$MCSTATE" | 712 | defer_rm "$MCSTATE" |
test/e2e_09_hosts.sh
| Old | New | ||
|---|---|---|---|
| @@ -14,9 +14,18 @@ | |||
| 14 | # `mux` in this suite now records the DAEMON it attached to, so a hosts | 14 | # `mux` in this suite now records the DAEMON it attached to, so a hosts |
| 15 | # file read out of the shared $XDG_STATE_HOME would be every other group's | 15 | # file read out of the shared $XDG_STATE_HOME would be every other group's |
| 16 | # attaches as much as this one's. | 16 | # attaches as much as this one's. |
| 17 | SOCKH1="${TMPDIR:-/tmp}/muxd-e2e-hosts1-$$.sock" | 17 | # /tmp and not $TMPDIR, which this group and the dead-click leg in |
| 18 | # e2e_08_mouse.sh are the only places to say. Six assertions below grep one | ||
| 19 | # of these paths out of a tile's LABEL BAR, and a bar is as wide as the | ||
| 20 | # terminal: `labelText` keeps the state word and cuts the label's TAIL, | ||
| 21 | # which is the half carrying the `#SESSION` and the daemon's name. macOS | ||
| 22 | # puts $TMPDIR in a per-user directory whose name alone was 48 characters | ||
| 23 | # on the box this was measured on, so an 80-column bar had none of that | ||
| 24 | # left in it. /tmp is short on both | ||
| 25 | # OSes, and on Linux it is where a $TMPDIR-less run already puts them. | ||
| 26 | SOCKH1="/tmp/muxd-e2e-hosts1-$$.sock" | ||
| 18 | defer_sock "$SOCKH1" | 27 | defer_sock "$SOCKH1" |
| 19 | SOCKH2="${TMPDIR:-/tmp}/muxd-e2e-hosts2-$$.sock" | 28 | SOCKH2="/tmp/muxd-e2e-hosts2-$$.sock" |
| 20 | defer_sock "$SOCKH2" | 29 | defer_sock "$SOCKH2" |
| 21 | HSTATE="${TMPDIR:-/tmp}/mux-e2e-hosts-state-$$" | 30 | HSTATE="${TMPDIR:-/tmp}/mux-e2e-hosts-state-$$" |
| 22 | defer_rm "$HSTATE" | 31 | defer_rm "$HSTATE" |
| @@ -268,28 +277,16 @@ wait_sessions "$SOCKH2" 2 "hosts: daemon 2 should hold 0 and c" | |||
| 268 | # every later assertion about it is about a session the wall could reach | 277 | # every later assertion about it is about a session the wall could reach |
| 269 | # and does not. | 278 | # and does not. |
| 270 | # | 279 | # |
| 271 | # Tall, and NOT wide: the terminal stays under the aspect rule's | 280 | # Tall, and NOT wide: 80 columns is under the aspect rule's |
| 272 | # `cols >= 2 * rows`, so a bar gets the full width. Beside, three stripes | 281 | # `cols >= 2 * rows`, so a bar gets the full width. Beside, three stripes |
| 273 | # would each be twenty-odd columns and `labelText` would spend them on the | 282 | # would each be twenty-odd columns and `labelText` would spend them on the |
| 274 | # state word — the socket path these assertions grep for is the first thing | 283 | # state word — the socket path these assertions grep for is the first thing |
| 275 | # a narrow bar drops. | 284 | # a narrow bar drops. |
| 276 | # | ||
| 277 | # Wide ENOUGH is the other half, and it cannot be a constant: the label is | ||
| 278 | # `--sock <socket> #<session> [up]` and $TMPDIR decides how long the socket | ||
| 279 | # is. It is under /tmp on Linux and 80 columns has always been plenty; | ||
| 280 | # macOS puts it in a per-user directory whose name alone is 45 characters, | ||
| 281 | # and the bar elided exactly the path being grepped for. So the width comes | ||
| 282 | # from the socket and the height follows it, and a box with a short $TMPDIR | ||
| 283 | # gets the 80x44 this has always used. | ||
| 284 | HWCOLS=$(( ${#SOCKH1} + 20 )) | ||
| 285 | [ "$HWCOLS" -ge 80 ] || HWCOLS=80 | ||
| 286 | HWROWS=$(( HWCOLS / 2 + 4 )) | ||
| 287 | [ "$HWROWS" -ge 44 ] || HWROWS=44 | ||
| 288 | seed_layout "$HSTATE" stacked \ | 285 | seed_layout "$HSTATE" stacked \ |
| 289 | "--sock $SOCKH1#0" "--sock $SOCKH1#b" "--sock $SOCKH2#0" | 286 | "--sock $SOCKH1#0" "--sock $SOCKH1#b" "--sock $SOCKH2#0" |
| 290 | HFHASH=$(sha256_of "$HSTATE/mux/hosts") | 287 | HFHASH=$(sha256_of "$HSTATE/mux/hosts") |
| 291 | set +e | 288 | set +e |
| 292 | XDG_STATE_HOME="$HSTATE" timeout 90 "$PTYCLIENT" --cols "$HWCOLS" --rows "$HWROWS" \ | 289 | XDG_STATE_HOME="$HSTATE" timeout 90 "$PTYCLIENT" --cols 80 --rows 44 \ |
| 293 | --out "$OUT.hwcap" --err "$OUT.hwcap.err" -- "$MUX" > "$OUT.hwpc" 2>&1 <<'EOF' | 290 | --out "$OUT.hwcap" --err "$OUT.hwcap.err" -- "$MUX" > "$OUT.hwpc" 2>&1 <<'EOF' |
| 294 | expect hw1-pin 25000 | 291 | expect hw1-pin 25000 |
| 295 | settle 1500 25000 | 292 | settle 1500 25000 |
test/e2e_lib.sh
| Old | New | ||
|---|---|---|---|
| @@ -20,8 +20,8 @@ | |||
| 20 | # those paths came out with `//` in the middle: mux records the spelling it | 20 | # those paths came out with `//` in the middle: mux records the spelling it |
| 21 | # was handed, the suite spells its expectation the same way, and the two | 21 | # was handed, the suite spells its expectation the same way, and the two |
| 22 | # still differ when only one of them went through a normalizing step. Two | 22 | # still differ when only one of them went through a normalizing step. Two |
| 23 | # groups failed on exactly that. Stripped once here rather than at 191 call | 23 | # groups failed on exactly that. Stripped once here rather than at every |
| 24 | # sites, and before the first of them. | 24 | # call site that spells it, and before the first of them. |
| 25 | while :; do | 25 | while :; do |
| 26 | case "${TMPDIR:-}" in | 26 | case "${TMPDIR:-}" in |
| 27 | */) TMPDIR="${TMPDIR%/}" ;; | 27 | */) TMPDIR="${TMPDIR%/}" ;; |
| @@ -1440,14 +1440,22 @@ cleanup() { | |||
| 1440 | # | 1440 | # |
| 1441 | # What it catches now is a path that is neither registered nor spelled | 1441 | # What it catches now is a path that is neither registered nor spelled |
| 1442 | # from $OUT — the one shape both mechanisms above are blind to. | 1442 | # from $OUT — the one shape both mechanisms above are blind to. |
| 1443 | # | ||
| 1444 | # BOTH directories when they differ. Two legs put their daemon sockets | ||
| 1445 | # in /tmp on purpose — a socket path has to fit a label bar as well as | ||
| 1446 | # sun_path — and a sweep that only read $TMPDIR would be blind to | ||
| 1447 | # exactly the paths that were moved out of it. | ||
| 1443 | _stray=0 | 1448 | _stray=0 |
| 1444 | if [ "$_rc" -eq 0 ]; then | 1449 | if [ "$_rc" -eq 0 ]; then |
| 1445 | _left=$(find "${TMPDIR:-/tmp}" -maxdepth 1 \ | 1450 | _sweep="${TMPDIR:-/tmp}" |
| 1451 | [ "$_sweep" = /tmp ] || _sweep="$_sweep /tmp" | ||
| 1452 | # shellcheck disable=SC2086 # two directory words, and split is the point | ||
| 1453 | _left=$(find $_sweep -maxdepth 1 \ | ||
| 1446 | \( -name "mux*-$$" -o -name "mux*-$$.*" \) 2>/dev/null) | 1454 | \( -name "mux*-$$" -o -name "mux*-$$.*" \) 2>/dev/null) |
| 1447 | if [ -n "$_left" ]; then | 1455 | if [ -n "$_left" ]; then |
| 1448 | _n=$(printf '%s\n' "$_left" | wc -l) | 1456 | _n=$(printf '%s\n' "$_left" | wc -l) |
| 1449 | if [ "$_n" -eq 1 ]; then _w=file; else _w=files; fi | 1457 | if [ "$_n" -eq 1 ]; then _w=file; else _w=files; fi |
| 1450 | echo "e2e FAIL: the suite passed but left $_n $_w in ${TMPDIR:-/tmp}:" | 1458 | echo "e2e FAIL: the suite passed but left $_n $_w in $_sweep:" |
| 1451 | printf '%s\n' "$_left" | sed 's/^/ /' | 1459 | printf '%s\n' "$_left" | sed 's/^/ /' |
| 1452 | echo " A capture is spelled from \$OUT and swept by pattern;" | 1460 | echo " A capture is spelled from \$OUT and swept by pattern;" |
| 1453 | echo " anything else is registered where it is created, with" | 1461 | echo " anything else is registered where it is created, with" |