Repository navigation
test(cmocka): Run the PipeWire context-failure harness from Python (#962) - #2619
Conversation
|
Handed off to the coordinator. Local evidence before the handoff: HEAD is not stamped with the local gate, so PR CI runs the full suite rather than the Linux jobs skipping; auto-merge is on and waits for it. The change touches no workflow, no container image and no package list. |
…962) RED: ci/test_pipewire_context_fail.py drives the ported module by path with a stub `pipewire` on PATH (one that binds the daemon socket, one that exits at once) and a stub test binary that records the environment, the cwd and the argv it was handed. On the unfixed tree the module does not exist, so the module cases error and the wiring case fails: 10 tests -> 8 failures + 2 errors. Refs #962
GREEN: test/cmocka/test_pipewire_context_fail.py is the port of
test/cmocka/test_pipewire_context_fail.sh, which is deleted, and its GEN-005
exception is removed from ci.toml. The shell's only caller,
test/cmocka/tests.d/test_pipewire_context_fail.cmake, runs the module through
"uv run --script" -- the shape test_pulse_default_follow.cmake already uses for
test_pulse_pulseaudio.py -- so the caller keeps its interpreter and no workflow
changes.
The shell's steps keep their order and meaning: the display/DBus/PipeWire
variables are unset; mktemp-style runtime directory that moves to /tmp when
len(dir) + len("/run/pipewire-0-manager") > 107 (a deep TMPDIR cannot hold the
daemon's socket); XDG_RUNTIME_DIR/XDG_CONFIG_HOME/XDG_STATE_HOME/HOME under it;
when pipewire is on PATH, its minimal configuration (native protocol and access
module only, support.dbus = false) is written and the daemon starts with
PIPEWIRE_CONFIG_DIR/PIPEWIRE_RUNTIME_DIR as command prefixes -- not exports, as
in the shell -- and the test waits up to 200 x 0.1 s for the socket, failing
with "private pipewire did not start:" and the log when a daemon that is
installed does not come up; without pipewire it prints that the control case
will skip; then the test binary runs and its status is the exit status, with the
daemon killed and the directory removed either way.
The one deliberate addition is a usage error (exit 2) for a missing test
binary, where the shell had only the usage comment. The module's doc comment in
test_pipewire_context_fail.c now names the Python file; no assertion changed.
Refs #962
test_pipewire_wrapper.sh ran test_pipewire_context_fail.sh as a control; the port renames that to test_pipewire_context_fail.py, so the wrapper test would fail on a machine with pipewire installed (CI installs none, so PR CI cannot see it). Drive each wrapper with the interpreter it now uses, and pin the wiring in ci/test_pipewire_context_fail.py.
|
Heads-up from a parallel worker: this PR deletes For reference, the sibling port of |
fb4d0a8 to
9167841
Compare
|
Rebased onto
SHAs after the rebase: RED Local: |
zackees
left a comment
There was a problem hiding this comment.
Reviewed the head 91678412b. Verdict: correct, and the port keeps the coverage the shell had. Queueing it.
Verified by running, not by reading (in a worktree at the PR head):
uv run --no-project ci/test_pipewire_context_fail.py→Ran 10 tests … OK.- The same file copied into a worktree at
origin/master→FAILED (failures=8, errors=2). That is the RED state, and it is the new gate test that produces it, so RED → GREEN is real and not asserted. ci/test_uv_run.py→ OK, andci/test_ci_toml.py→ OK, so theGEN-005exception removal inci.tomlmatches the set of shell files that remain and the new module's#!/usr/bin/env -S uv run --scriptsatisfies TOOL-003.- The
test_pipewire_wrapper.shconsumer the earlier commit missed is handled the right way: the loop carries the interpreter per wrapper (uv run --scriptfor the.py,shfor the rest) instead of dropping the case, so the long-TMPDIR and daemon-dies-at-once checks still cover the harness. test_pipewire_context_fail.pymoves the runtime dir to/tmpwhen<dir>/run/pipewire-0-managerwould exceed 107 bytes and fails with the daemon's log instead of skipping, which is stronger than the shell's behaviour and is covered bytest_a_deep_tmpdir_falls_back_to_tmpandtest_a_daemon_that_does_not_come_up_fails_with_its_log.
One nit, not blocking: in test_pipewire_wrapper.sh the runner is stored as a string and expanded unquoted (runner="uv run --script $scripts/$wrapper", then timeout 60 $runner …). The word splitting is wanted here, but it also splits a $scripts path containing a space. set -- uv run --script "$scripts/$wrapper" (and set -- sh "$scripts/$wrapper") would keep both properties.
One note for the record: with pipewire absent the harness now exits 0 and the control case skips inside the C test, where the shell wrapper exited 77 and ctest recorded a skip. That is the intended improvement (the failure cases run in CI instead of the whole test skipping), and test_a_missing_pipewire_skips_the_control_case_and_passes_the_status_through pins it — it just means the Tier 2 job report will no longer show this test as skipped.
No docs/features.md line needed: CI tooling only.
|
Tier 2 Linux is green on the rebased head |
…2619 rebase (#962) #2619 landed the context-failure harness in Python, so both private-PipeWire wrappers are Python now. The wrapper test's loop runs both through `uv run --script` — the literal its sibling `ci/test_pipewire_context_fail.py` pins — instead of the per-extension `$runner` case, whose `$uv --script` form uv rejected (it is a `uv run` flag). The no-pipewire control still uses the absolute `$uv`, because it runs with a stripped PATH and would not find uv otherwise. Refs #962.
…bs-rust#2620) * test(ci): pin the private-PipeWire-dir harness in Python (obs-rust#962) RED: ci/test_pipewire_cursor_hdr.py drives test/cmocka/test_pipewire_cursor_hdr.py by path with stub Xvfb-style stubs (a stub pipewire that binds the socket, one that dies at once, and a test-binary stub that captures its env/cwd/argv) and pins the wiring: the shell gone, its GEN-005 exception gone, the ctest callers running the Python through uv run --script. It fails on master (the module does not exist and the shell is still there). * ci: Port the private-PipeWire-dir harness to Python (obs-rust#962) GREEN: port test/cmocka/test_pipewire_cursor_hdr.sh (the private PipeWire daemon wrapper the camera/screencast cmocka tests and the wrapper test run through) to test/cmocka/test_pipewire_cursor_hdr.py, and delete the shell. - the twelve ctest callers in test/cmocka/tests.d/*.cmake run it through `uv run --script` (the shell's callers all reach Python: they are ctest entries on the Linux runners and the Tier 2 image, both of which carry uv); - test/cmocka/test_pipewire_wrapper.sh runs the Python wrapper the same way, with uv by absolute path so its stub PATH still reaches it; - the stub-skip messages in the camera/screencast tests name the .py now; - the GEN-005 exception for the .sh is removed (ci-lint precheck: 560 -> 559 approved exceptions, 23 violations unchanged). * style(cmocka): gersemi-format the PipeWire test entries (obs-rust#962) The lint lane (ci/local_gate.py --lane lint) runs gersemi over the changed .cmake files and the multi-line COMMAND in the ten ported PipeWire test entries needed wrapping; `./lint --fix` produced this. Refs obs-rust#962. * test(cmocka): run both wrappers through `uv run --script` after the obs-rust#2619 rebase (obs-rust#962) obs-rust#2619 landed the context-failure harness in Python, so both private-PipeWire wrappers are Python now. The wrapper test's loop runs both through `uv run --script` — the literal its sibling `ci/test_pipewire_context_fail.py` pins — instead of the per-extension `$runner` case, whose `$uv --script` form uv rejected (it is a `uv run` flag). The no-pipewire control still uses the absolute `$uv`, because it runs with a stripped PATH and would not find uv otherwise. Refs obs-rust#962.
GEN-005 burn-down, one unit:
test/cmocka/test_pipewire_context_fail.sh(70 lines) →test/cmocka/test_pipewire_context_fail.py, with its[[exceptions]]block removed fromci.toml(Refs #962).99e693be4— newci/test_pipewire_context_fail.pydrives the ported module by path with a stubpipewireon PATH (one that binds the daemon socket, one that exits at once) and a stub test binary that records its environment, cwd and argv. On the unfixed tree the module does not exist, so the module cases error and the wiring case fails: 10 tests → 8 failures + 2 errors.d622c821f— the module, the shell deleted, the exception gone. 10 tests → OK.91678412b—test/cmocka/test_pipewire_wrapper.shran the deleted shell as a control; it now drives the ported module (uv run --script), andci/test_pipewire_context_fail.pypins that wiring. No CI lane installs pipewire, so PR CI cannot see this; it would fail on a dev machine.(SHAs re-stated after a rebase onto
origin/masterat4d10528e4.)Why this unit is contained
The shell has exactly one caller,
test/cmocka/tests.d/test_pipewire_context_fail.cmake, and the tree already has the Python shape for a cmocka wrapper:test/cmocka/tests.d/test_pulse_default_follow.cmakerunsuv run --script .../test_pulse_pulseaudio.py. The caller therefore keeps its interpreter (the cmocka tests run whereuvis on PATH) and no workflow, container image or package list changes.The port
The shell's steps keep their order and meaning:
DISPLAY,WAYLAND_DISPLAY,HYPRLAND_INSTANCE_SIGNATURE, both DBus bus addresses and thePIPEWIRE_*variables are unset.mktemp -druntime directory, remade under/tmpwhenlen(dir) + 23 > 107: the daemon's longest socket path (<dir>/run/pipewire-0-manager) must fit a Unix socket address, and a deepTMPDIR(a build tree) does not.XDG_RUNTIME_DIR,XDG_CONFIG_HOME,XDG_STATE_HOMEandHOMEunder that directory.pipewireis on PATH: write the minimal daemon config (native protocol + access module only;support.dbus = false; no realtime/X11 modules, no session manager, no devices), start the daemon withPIPEWIRE_CONFIG_DIRandPIPEWIRE_RUNTIME_DIRas command prefixes (the shell'sFOO=bar cmd &, so the test binary does not inheritPIPEWIRE_CONFIG_DIR), wait up to 200 × 0.1 s for<runtime>/pipewire-0to be a socket, and fail withprivate pipewire did not start:plus the log when a daemon that is installed does not come up. Without pipewire: print that the control case will skip.Deliberate differences
""; this can never fire from the cmake caller.test/cmocka/test_pipewire_context_fail.c's doc comment now names the Python file. Comment only: no assertion, include or linkage changed.Checks (local)
./lint(clang-format, gersemi, rustfmt, clippy, Dylints): ok.uv run --no-project ci/local_gate.py --only self-test(the wholeci/self-test lane, new suite included): ok.ci/test_uv_run.py,ci/test_tool_guard.py,ci/test_ci_scope.py: ok.No user-visible change, so
docs/features.mdhas no line. No submodule pointer change.