a41410cd
test: hermetic XDG homes for the suites that attach outside e2e
a73x 2026-08-22 09:03
Commit message
test/bench.sh
| Old | New | ||
|---|---|---|---|
| @@ -5,8 +5,10 @@ set -eu | |||
| 5 | MUXD="$1" | 5 | MUXD="$1" |
| 6 | MUX="$2" | 6 | MUX="$2" |
| 7 | SOCK="${TMPDIR:-/tmp}/muxd-bench-$$.sock" | 7 | SOCK="${TMPDIR:-/tmp}/muxd-bench-$$.sock" |
| 8 | # Attaches record wall tiles; keep them out of the developer's real wall file. | ||
| 9 | XDG_STATE_HOME="${TMPDIR:-/tmp}/muxd-bench-$$-state"; export XDG_STATE_HOME | ||
| 8 | 10 | ||
| 9 | cleanup() { kill "$DPID" 2>/dev/null || true; rm -f "$SOCK"; } | 11 | cleanup() { kill "$DPID" 2>/dev/null || true; rm -rf "$SOCK" "$XDG_STATE_HOME"; } |
| 10 | trap cleanup EXIT INT TERM | 12 | trap cleanup EXIT INT TERM |
| 11 | 13 | ||
| 12 | "$MUXD" run --sock "$SOCK" --shell /bin/sh & | 14 | "$MUXD" run --sock "$SOCK" --shell /bin/sh & |
test/soak.sh
| Old | New | ||
|---|---|---|---|
| @@ -68,6 +68,9 @@ done | |||
| 68 | PSOCK="$TMP/mux-soak-persist-$$.sock" | 68 | PSOCK="$TMP/mux-soak-persist-$$.sock" |
| 69 | PLOG="$TMP/mux-soak-persist-$$.log" | 69 | PLOG="$TMP/mux-soak-persist-$$.log" |
| 70 | PCAP="$TMP/mux-soak-persist-$$.cap" | 70 | PCAP="$TMP/mux-soak-persist-$$.cap" |
| 71 | # e2e.sh isolates its own XDG homes; this leg attaches directly and must | ||
| 72 | # too, or every soak adds a dead socket to the developer's real wall file. | ||
| 73 | XDG_STATE_HOME="$TMP/mux-soak-persist-$$-state"; export XDG_STATE_HOME | ||
| 71 | CYCLES="${SOAK_CYCLES:-20}" | 74 | CYCLES="${SOAK_CYCLES:-20}" |
| 72 | WARMUP=3 | 75 | WARMUP=3 |
| 73 | RSS_BOUND_KB=4096 | 76 | RSS_BOUND_KB=4096 |
| @@ -157,7 +160,7 @@ if [ "$FAILED" -gt "$PERSIST_FAILED_BEFORE" ]; then | |||
| 157 | cp "$PLOG" "$FAILDIR/persistence.log" 2>/dev/null | 160 | cp "$PLOG" "$FAILDIR/persistence.log" 2>/dev/null |
| 158 | [ -f "$PCAP" ] && cp "$PCAP" "$FAILDIR/persistence.cap" 2>/dev/null | 161 | [ -f "$PCAP" ] && cp "$PCAP" "$FAILDIR/persistence.cap" 2>/dev/null |
| 159 | fi | 162 | fi |
| 160 | rm -f "$PLOG" "$PSOCK" "$PCAP" | 163 | rm -rf "$PLOG" "$PSOCK" "$PCAP" "$XDG_STATE_HOME" |
| 161 | rm -f "$LOG" | 164 | rm -f "$LOG" |
| 162 | echo "---" | 165 | echo "---" |
| 163 | if [ "$FAILED" -eq 0 ]; then | 166 | if [ "$FAILED" -eq 0 ]; then |
test/throughput.sh
| Old | New | ||
|---|---|---|---|
| @@ -72,6 +72,11 @@ REPAINT_MAX_MS=${REPAINT_MAX_MS:-200} | |||
| 72 | REPS=${REPS:-5} | 72 | REPS=${REPS:-5} |
| 73 | 73 | ||
| 74 | TMPD="$(mktemp -d "${TMPDIR:-/tmp}/muxd-throughput-XXXXXX")" | 74 | TMPD="$(mktemp -d "${TMPDIR:-/tmp}/muxd-throughput-XXXXXX")" |
| 75 | # Every attach records a wall tile in $XDG_STATE_HOME/mux/wall; without a | ||
| 76 | # hermetic home this suite's throwaway sockets pile up in the developer's | ||
| 77 | # real wall file and muxweb tries to open them all. | ||
| 78 | XDG_STATE_HOME="$TMPD/state"; XDG_CONFIG_HOME="$TMPD/cfg"; XDG_CACHE_HOME="$TMPD/cache" | ||
| 79 | export XDG_STATE_HOME XDG_CONFIG_HOME XDG_CACHE_HOME | ||
| 75 | SOCK="$TMPD/t.sock" | 80 | SOCK="$TMPD/t.sock" |
| 76 | # Assigned BEFORE the trap is installed, not after the daemon launches: | 81 | # Assigned BEFORE the trap is installed, not after the daemon launches: |
| 77 | # cleanup dereferences it under `set -u`, so a trap firing in between would | 82 | # cleanup dereferences it under `set -u`, so a trap firing in between would |
test/wan.sh
| Old | New | ||
|---|---|---|---|
| @@ -126,6 +126,11 @@ QIDLE="${MUX_WAN_QUIC_IDLE_MS:-400}" | |||
| 126 | FW_LEFT=0 | 126 | FW_LEFT=0 |
| 127 | 127 | ||
| 128 | WORK="$(mktemp -d "${TMPDIR:-/tmp}/mux-wan-XXXXXX")" | 128 | WORK="$(mktemp -d "${TMPDIR:-/tmp}/mux-wan-XXXXXX")" |
| 129 | # Every attach records a wall tile in $XDG_STATE_HOME/mux/wall; without a | ||
| 130 | # hermetic home this suite's throwaway sockets pile up in the developer's | ||
| 131 | # real wall file and muxweb tries to open them all. | ||
| 132 | XDG_STATE_HOME="$WORK/state"; XDG_CACHE_HOME="$WORK/cache" | ||
| 133 | export XDG_STATE_HOME XDG_CACHE_HOME | ||
| 129 | PY="$WORK/wan.py" | 134 | PY="$WORK/wan.py" |
| 130 | RESULTS="$WORK/results" | 135 | RESULTS="$WORK/results" |
| 131 | ERRLOG="$WORK/client.err" | 136 | ERRLOG="$WORK/client.err" |
test/xversion.sh
| Old | New | ||
|---|---|---|---|
| @@ -82,6 +82,11 @@ done | |||
| 82 | # path is capped near 108 bytes by the kernel, not by anything this script | 82 | # path is capped near 108 bytes by the kernel, not by anything this script |
| 83 | # can see fail gracefully. | 83 | # can see fail gracefully. |
| 84 | TMP="${TMPDIR:-/tmp}/mux-xver-$$" | 84 | TMP="${TMPDIR:-/tmp}/mux-xver-$$" |
| 85 | # Every attach records a wall tile in $XDG_STATE_HOME/mux/wall; without a | ||
| 86 | # hermetic home this suite's throwaway sockets pile up in the developer's | ||
| 87 | # real wall file and muxweb tries to open them all. | ||
| 88 | XDG_STATE_HOME="$TMP/state"; XDG_CONFIG_HOME="$TMP/cfg"; XDG_CACHE_HOME="$TMP/cache" | ||
| 89 | export XDG_STATE_HOME XDG_CONFIG_HOME XDG_CACHE_HOME | ||
| 85 | RUN_OLD="$TMP/o" | 90 | RUN_OLD="$TMP/o" |
| 86 | RUN_NEW="$TMP/n" | 91 | RUN_NEW="$TMP/n" |
| 87 | mkdir -p "$RUN_OLD" "$RUN_NEW" || exit 1 | 92 | mkdir -p "$RUN_OLD" "$RUN_NEW" || exit 1 |