Skip to content

ci: Port the private-PipeWire-pulse harness to Python (#962) - #2628

Merged
zackees merged 2 commits into
masterfrom
infra/962-gen-005-pulse-monitor-python
Oct 27, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/962-gen-005-pulse-monitor-python

Conversation

@zackees

@zackees zackees commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Part of the #962 GEN-005 burn-down: port the private PipeWire-pulse harness the
test_pulse_monitor_device / test_pulse_stream_restart / test_pulse_two_sources
/ test_pulse_default_follow_pipewire cmocka tests run through to Python, and
delete the shell.

What

test/cmocka/test_pulse_monitor_device.sh (74 lines) starts a private PipeWire
sound server — its own runtime dir, config and D-Bus, no hardware devices. It
skips (77) when PipeWire, WirePlumber, pipewire-pulse, pactl or
dbus-run-session are missing, re-executes itself inside dbus-run-session,
waits for the server to answer pactl (failing with the daemon logs when one
that is installed does not come up), runs the passed cmocka test binary and
stops the daemons. It becomes test/cmocka/test_pulse_monitor_device.py, token
for token — the PRIVATE_PIPEWIRE_STARTED re-exec, the /pipewire-0-manager
107-byte socket-path check with the /tmp fallback, the no-hardware WirePlumber
config, the 200 × 0.1 s pactl wait, and the stop of pipewire-pulse, WirePlumber
then pipewire.

Wiring, all of it on uv run --script:

  • the four ctest entries in test/cmocka/tests.d/*.cmake (test_pulse_monitor_device,
    test_pulse_stream_restart, test_pulse_two_sources, test_pulse_default_follow_pipewire);
  • test/cmocka/test_pipewire_wrapper.sh runs the .py the way its ctest
    callers do, uv resolved by absolute path so its stub PATH still reaches it;
  • the shared test graph — test_pulse_monitor_samples, which CMake registers
    from test/cmocka/build/test-graph.json — and the rust/obs-build/tests/native.rs
    assertion that pins its command array;
  • the C tests' "run through …" skip messages and test_pulse_pulseaudio.py's
    docstring name the .py;
  • the GEN-005 entry for the .sh is removed from ci.toml.

RED → GREEN

  • RED 2695abc08: ci/test_pulse_monitor_device.py drives the module by path
    with stub pipewire / wireplumber / pipewire-pulse / pactl /
    dbus-run-session tools and a test binary that records its environment, its
    argv and the WirePlumber config, and pins the wiring (shell gone, exception
    gone, the four cmake callers and the test graph on uv run --script). It
    fails on master — Ran 8 tests … FAILED (failures=7, errors=1) (the module
    does not exist and the shell is still there).
  • GREEN c5fbdc4c3: the port, the caller and graph rewiring, the .sh deleted,
    the exception removed. uv run --no-project python -m unittest discover -s ci -p test_pulse_monitor_device.py → 8 tests, OK. The neighbouring checks
    pass: test_uv_run (5), test_test_graph_sorted (2),
    test_sorted_shared_lists (5), test_cmocka_windows_diagnostics (4),
    test_rust_scope (10), test_cmocka_mbedtls_graph (2), test_local_gate
    (12); ./lint lane green.

Evidence

ci-lint precheck (zackees/ci.yml@a1917ce7): on origin/master (2c9ebf367)
23 violation(s), 558 approved exception(s); on this branch
23 violation(s), 557 approved exception(s) — exactly one exception burnt
down and no new violation.

Rebase

Rebased onto origin/master after #2619 landed, which also touched
test/cmocka/test_pipewire_wrapper.sh. One hunk conflicted — the shared header
comment, where #2619 renamed test_pipewire_context_fail.sh and this PR renames
test_pulse_monitor_device.sh; resolved to
# test_pipewire_context_fail.py, test_pulse_monitor_device.py). with #2619's
loop kept. ci.toml auto-merged (each PR drops its own adjacent exception
block). The SHAs above are the rebased ones; the uv run gates, the
ci/test_* set and the local wrapper run were re-checked against the new tip.

Refs #962.

@zackees
zackees enabled auto-merge October 27, 2026 12:55
@zackees
zackees force-pushed the infra/962-gen-005-pulse-monitor-python branch from fccbe11 to c5fbdc4 Compare October 27, 2026 13:02
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Rebased onto origin/master (2c9ebf367) to clear the conflict with the merged PipeWire context-failure port (#2619).

  • ci.toml: git diff origin/master -- ci.toml shows only this unit's test_pulse_monitor_device.sh GEN-005 exception gone (no other block touched).
  • test/cmocka/test_pipewire_wrapper.sh: both ports edit the same header/list. Resolved by keeping master's context-failure half (test_pipewire_context_fail.py, the case runner) and this unit's PulseAudio half (test_pulse_monitor_device.py via uv run --script), so the comment now reads test_pipewire_context_fail.py, test_pulse_monitor_device.py and both wrappers run with their current interpreter.
  • Rebased SHAs: RED 2695abc08, GREEN c5fbdc4c3 (the PR body's original SHAs are stale).

Re-ran against the new tip: ci/test_pulse_monitor_device.py 8 tests OK, ci/test_uv_run.py 5 OK, ci/test_ci_toml.py 19 OK, ruff check clean. Auto-merge is on; PR CI is the gate.

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review (this account is the PR author, so a formal approval is not possible from here; posted as a review comment instead).

Verdict: sound port, no change requested. Shell and Python read line by line against origin/master:test/cmocka/test_pulse_monitor_device.sh:

  • re-exec: PRIVATE_PIPEWIRE_STARTED=1 exec dbus-run-session -- sh "$0" "$@" ↔ os.execvpe("dbus-run-session", ["dbus-run-session", "--", sys.executable, __file__, *argv[1:]], env) — same argv, and going through sys.executable is what the tool gate requires.
  • socket budget: shell's $((${#dir} + 19)) -gt 107 ↔ len(dir) + len("/pipewire-0-manager") > 107, /tmp fallback kept.
  • start order and stop order match (pipewire → sleep 1 → wireplumber → pipewire-pulse; stop is pulse, WirePlumber, pipewire via reversed(processes)).
  • the 200 × 0.1 s pactl info wait still fails (not skips) when a daemon that is installed dies, printing the three daemon logs; the no-hardware WirePlumber config is byte-identical.
  • wiring is complete: .sh deleted, its GEN-005 block gone, the four tests.d/*.cmake callers on uv run --script, test/cmocka/build/test-graph.json and the rust/obs-build/tests/native.rs pin updated together, comment-only renames in the three .c files and test_pulse_pulseaudio.py.

Gates I re-ran on c5fbdc4c3 (already based on current master):

  • ci/test_pulse_monitor_device.py 8 OK; test_uv_run 5 OK; test_test_graph_sorted 2 OK; test_sorted_shared_lists 5 OK; test_cmocka_windows_diagnostics 4 OK; test_rust_scope 10 OK; test_cmocka_mbedtls_graph 2 OK; test_ci_toml 19 OK.
  • ci-lint precheck (ci.yml@a1917ce7): 23 violations, 557 approved exceptions on this branch vs 558 on origin/master — exactly one burnt down, no new violation.
  • gersemi --check test/cmocka/tests.d clean; clang-format --dry-run --Werror clean on every touched .c; ruff check clean. (ruff format would reformat the new files, but it is not a repo gate — master's own ci/test_uv_run.py and ci/test_pipewire_context_fail.py are unformatted too.)

Two non-blocking nits, no action taken (they are behaviour choices, not port defects):

  1. subprocess.run(argv) with a nonexistent test binary raises FileNotFoundError and a traceback, where the shell's "$test_bin" printed not found and exited 127. Only reachable by hand, never from ctest.
  2. The len(argv) < 2 usage check returning 2 is new (the shell ran the empty program and exited 127). Harmless, arguably better.

Coordination note: #2620 rewrites the same test/cmocka/test_pipewire_wrapper.sh header comment and drops the adjacent ci.toml block, so whichever of the two lands second will need a rebase — that is expected cross-PR contention, not a defect in either.

Queuing it now (gh pr merge --auto); the queue picks the strategy.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Oct 27, 2026
@zackees
zackees force-pushed the infra/962-gen-005-pulse-monitor-python branch from c5fbdc4 to f884db5 Compare October 27, 2026 13:32
@zackees
zackees enabled auto-merge October 27, 2026 13:32
RED: ci/test_pulse_monitor_device.py drives test/cmocka/test_pulse_monitor_device.py
by path with stub tools (pipewire, WirePlumber, pipewire-pulse, pactl,
dbus-run-session) and a recording test binary, and pins the wiring: the shell
gone, its GEN-005 exception gone, the four cmake callers and the test graph on
`uv run --script`.

It fails on master (module absent, shell present): ran 8 tests, FAILED
(failures=7, errors=1).

Refs #962.
GREEN: `test/cmocka/test_pulse_monitor_device.py` replaces the 74-line
`test_pulse_monitor_device.sh` token for token — the
`PRIVATE_PIPEWIRE_STARTED` re-exec through a private `dbus-run-session`, the
`/pipewire-0-manager` 107-byte socket-path check with the `/tmp` fallback, the
no-hardware WirePlumber config, the 200 x 0.1 s `pactl` wait with a hard fail
when an installed server does not come up, then the test binary and a stop of
pipewire, WirePlumber and pipewire-pulse.

Wiring: the four ctest entries in `test/cmocka/tests.d/*.cmake` and
`test/cmocka/test_pipewire_wrapper.sh` run it through `uv run --script`; the
shared test graph (`test_pulse_monitor_samples`) and
`rust/obs-build/tests/native.rs` name the `.py`; the C tests' skip messages and
`test_pulse_pulseaudio.py`'s docstring do too; the GEN-005 exception is removed.

    uv run --no-project python -m unittest discover -s ci -p test_pulse_monitor_device.py
    -> 8 tests, OK

Refs #962.
@zackees
zackees force-pushed the infra/962-gen-005-pulse-monitor-python branch from f884db5 to 86a35f6 Compare October 27, 2026 13:37
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Rebased onto the new origin/master (a02821471, which carries the squashed #2620 PipeWire-dir port and #2634) so the branch no longer stacks on #2620's pre-squash commits; the PR now contains only this unit.

  • New SHAs: RED 3fb482f0a, GREEN 86a35f6d8 (the earlier SHAs are stale — the branch was squash-merged upstream as a different commit, so a rebase was required, not a fast-forward).
  • ci.toml: git diff origin/master -- ci.toml shows only this unit's test/cmocka/test_pulse_monitor_device.sh GEN-005 exception gone (six lines); no other block touched.
  • test/cmocka/test_pipewire_wrapper.sh: master already carries test(cmocka): Run the PipeWire context-failure harness from Python (#962) #2619 + ci: Port the private-PipeWire-dir harness to Python (#962) #2620's header/list changes, so the rebase applied this unit's list entry on top with no conflict.
  • Local evidence: cd ci && uv run --no-project test_pulse_monitor_device.py → 8 tests OK; ci-lint precheck on this branch → 17 violation(s), 556 approved exception(s), 11 needs_review with no test_pulse_monitor_device finding and no new one.

Handed off to the coordinator.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 0ca604c Oct 27, 2026
38 checks passed
@zackees
zackees deleted the infra/962-gen-005-pulse-monitor-python branch October 27, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant