fix: make the smoke test check results and avoid a WirePlumber stall
CI / check (pull_request) Successful in 9s
CI / native (pull_request) Failing after 1m4s

The smoke test only checked exit codes, so CI passed the probe steps
even though volume and mute never changed. Each step now asserts the
expected state after the action and prints pw-cat, WirePlumber and node
diagnostics on failure.

The test microphone was a null-audio-sink with a Source media class.
WirePlumber's event dispatcher intermittently stalls on such a node and
then links nothing and ignores volume changes, which is what failed in
CI. It is now a loopback virtual source, like echo-cancel; three local
runs in a row pass. Screenshots are re-rendered from the new setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SpriteandClaude Opus 5.5 committed 2026-11-22 22:58:18 +00:00
1 parent b18ab7aed1
commit 6c7f45d5f9
3 files changed
+62 -21

No files matched your search

+3 -3
View File
@@ -139,9 +139,9 @@ tools/smoke-test.sh /tmp/shot # needs pipewire, wireplumber, pw-cat, gtk4-
``` ```
`tools/smoke-test.sh` starts a private PipeWire and WirePlumber in a temp `tools/smoke-test.sh` starts a private PipeWire and WirePlumber in a temp
`XDG_RUNTIME_DIR`. The instance has two null sinks, a null source, and one `XDG_RUNTIME_DIR`. The instance has two null sinks, a loopback virtual
playback and one capture stream created with `pw-cat`; the CLI is used only microphone, and one playback and one capture stream created with `pw-cat`; the CLI is used only
by the test harness. The script runs every probe action, checks the results, by the test harness. The script runs every probe action and checks its effect,
then starts the GUI under GTK's broadway backend. With `MOONMIX_SCREENSHOT` then starts the GUI under GTK's broadway backend. With `MOONMIX_SCREENSHOT`
set, the GUI renders each tab offscreen to a PNG and exits. set, the GUI renders each tab offscreen to a PNG and exits.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 40 KiB

+59 -18
View File
@@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# Headless smoke test: start a private PipeWire + WirePlumber (null sink, # Headless smoke test: start a private PipeWire + WirePlumber (two null
# null source, one playback stream), then run moonmix-probe against it and, # sinks, a loopback virtual microphone, a playback and a capture stream),
# if a display backend is available, render GUI screenshots. # run every moonmix-probe action and check its effect, then, if
# gtk4-broadwayd is available, render GUI screenshots.
# #
# Only this *test harness* uses pw-cat (to create a playing stream); moonmix # Only this *test harness* uses pw-cat (to create a playing stream); moonmix
# itself talks to PipeWire through libwireplumber. # itself talks to PipeWire through libwireplumber.
@@ -31,11 +32,17 @@ context.objects = [
node.name = "test_headphones" node.description = "Test Headphones" node.name = "test_headphones" node.description = "Test Headphones"
media.class = "Audio/Sink" audio.position = [ FL FR ] media.class = "Audio/Sink" audio.position = [ FL FR ]
object.linger = true } } object.linger = true } }
{ factory = adapter ]
args = { factory.name = support.null-audio-sink # The microphone is a loopback virtual source (like echo-cancel) rather than
node.name = "test_mic" node.description = "Test Microphone" # a null-audio-sink with a Source media class: WirePlumber's event dispatcher
media.class = "Audio/Source/Virtual" audio.position = [ MONO ] # intermittently stalls on the latter, which blocks all linking.
object.linger = true } } context.modules = [
{ name = libpipewire-module-loopback
args = {
node.description = "Test Microphone"
capture.props = { node.name = "test_mic_capture" node.passive = true audio.position = [ MONO ] }
playback.props = { node.name = "test_mic" media.class = "Audio/Source" audio.position = [ MONO ] }
} }
] ]
CONF CONF
@@ -59,24 +66,58 @@ pipewire >"$XDG_RUNTIME_DIR/pipewire.log" 2>&1 & PIDS="$PIDS $!"
sleep 1 sleep 1
wireplumber >"$XDG_RUNTIME_DIR/wireplumber.log" 2>&1 & PIDS="$PIDS $!" wireplumber >"$XDG_RUNTIME_DIR/wireplumber.log" 2>&1 & PIDS="$PIDS $!"
sleep 2 sleep 2
LOGS="$XDG_RUNTIME_DIR"
pw-cat --playback --raw --rate 48000 --channels 2 --format s16 \ pw-cat --playback --raw --rate 48000 --channels 2 --format s16 \
-P '{ application.name = "Test Player" media.name = "Smoke test tone" }' \ -P '{ application.name = "Test Player" media.name = "Smoke test tone" }' \
/dev/zero >/dev/null 2>&1 & PIDS="$PIDS $!" /dev/zero >"$LOGS/play.log" 2>&1 & PIDS="$PIDS $!"
pw-cat --record --raw --rate 48000 --channels 1 --format s16 \ pw-cat --record --raw --rate 48000 --channels 1 --format s16 \
-P '{ application.name = "Test Recorder" media.name = "Mic capture" }' \ -P '{ application.name = "Test Recorder" media.name = "Mic capture" }' \
/dev/null >/dev/null 2>&1 & PIDS="$PIDS $!" /dev/null >"$LOGS/record.log" 2>&1 & PIDS="$PIDS $!"
sleep 2 sleep 2
fail=0 fail=0
step() { echo "### $*"; "$PROBE" "$@" || fail=1; } OUT="$LOGS/probe.out"
step # step <expected-pattern> <probe args...>: run the probe and require the
[ -z "${DEBUG:-}" ] || { pw-dump > "$XDG_RUNTIME_DIR/dump.json"; echo "dump in $XDG_RUNTIME_DIR"; } # pattern in what it prints after the action.
step volume test_headphones 50 step() {
step mute test_mic 1 want=$1; shift
step default test_headphones echo "### $* (expect: $want)"
# Move the playback stream (found by name lookup in the probe's output). if ! "$PROBE" "$@" >"$OUT" 2>&1; then
echo "FAIL: probe exited with an error"; fail=1
fi
cat "$OUT"
# After an action the probe prints the state again; check only that part.
if ! sed -n '/^== action/,$p' "$OUT" | grep -q -- "$want" && ! { [ $# -eq 0 ] && grep -q -- "$want" "$OUT"; }; then
echo "FAIL: expected '$want'"; fail=1
fi
}
step 'Test Player | 100%'
step 'Test Headphones | 50% (-18.06 dB)' volume test_headphones 50
step 'Test Microphone | .*muted' mute test_mic 1
step 'Test Headphones | .*\[default\]' default test_headphones
STREAM=$("$PROBE" | awk -F: '/Test Player/ {gsub(/ /,"",$1); print $1; exit}') STREAM=$("$PROBE" | awk -F: '/Test Player/ {gsub(/ /,"",$1); print $1; exit}')
step move "$STREAM" test_speakers step 'Test Player | .*-> Test Speakers' move "${STREAM:-0}" test_speakers
if [ "$fail" != 0 ]; then
echo "### diagnostics"
echo "--- pw-cat playback:"; cat "$LOGS/play.log"
echo "--- pw-cat record:"; cat "$LOGS/record.log"
echo "--- wireplumber (warnings/errors):"
grep -E '^[EWC] ' "$LOGS/wireplumber.log" | grep -viE 'rtkit|d-?bus|bluez|camera|session bus|system bus' | tail -40
if command -v pw-dump >/dev/null; then
echo "--- nodes:"
pw-dump 2>/dev/null | python3 -c '
import json, sys
for o in json.load(sys.stdin):
t = o["type"].split(":")[-1]; i = o.get("info") or {}; p = i.get("props") or {}
if t == "Link": print("link", i.get("output-node-id"), "->", i.get("input-node-id"), i.get("state"))
if t == "Node":
props = (i.get("params") or {}).get("Props") or [{}]
print("node", o["id"], p.get("node.name"), p.get("media.class"), i.get("state"),
"vol", props[0].get("channelVolumes"), "mute", props[0].get("mute"))
' 2>/dev/null || true
fi
fi
if [ -n "$SHOTS" ] && [ -x "$GUI" ]; then if [ -n "$SHOTS" ] && [ -x "$GUI" ]; then
echo "### GUI screenshots -> $SHOTS-<tab>.png" echo "### GUI screenshots -> $SHOTS-<tab>.png"