Skip to content

ci: Port the private-PipeWire-dir harness to Python (#962) - #2620

Merged
zackees merged 4 commits into
masterfrom
infra/962-gen-005-pipewire-cursor-hdr-python
Oct 27, 2026
Merged

zackees merged 4 commits into
masterfrom
infra/962-gen-005-pipewire-cursor-hdr-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-dir harness the
test_pipewire_camera_* / test_pipewire_screencast_* cmocka tests run through
to Python, and delete the shell.

What

test/cmocka/test_pipewire_cursor_hdr.sh (51 lines) starts a private PipeWire
daemon — its own runtime dir and config, no session manager, no devices, never
the user's session bus — waits for its socket, runs the passed cmocka test
binary, and fails when a daemon that is installed does not come up (a skip is
counted as a pass by ctest). It becomes
test/cmocka/test_pipewire_cursor_hdr.py, token for token:

  • the callers. The twelve ctest entries 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);
  • the wrapper test. test/cmocka/test_pipewire_wrapper.sh (itself still a
    shell, ported separately) runs the Python wrapper the same way, with uv
    resolved by absolute path so its stub PATH still reaches it;
  • the stub messages. The camera/screencast tests' skip messages name the
    .py now;
  • the exception. The GEN-005 entry for the .sh is removed from
    ci.toml.

RED → GREEN

  • RED 176965569: ci/test_pipewire_cursor_hdr.py drives the module by path
    with stub pipewires (one that binds the socket and stays up, one that dies
    at once) and a test-binary stub that captures its env/cwd/argv, and pins the
    wiring (shell gone, exception gone, ctest caller on uv run --script). It
    fails on master (the module does not exist and the shell is still there).
  • GREEN 77985af46: the port, the .cmake/wrapper rewiring, the .sh
    deleted, the exception removed. uv run --no-project python -m unittest discover -s ci -p test_pipewire_cursor_hdr.py → 10 tests, OK; the
    stdlib-only and no-sys.path-edits ci checks pass; ruff check clean.

Evidence

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

Refs #962.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Lint fix pushed (f3ad5284b): the Fast Gate ⚡ lint lane failed because gersemi reformats the ten test/cmocka/tests.d/*.cmake entries the port rewired — the multi-line COMMAND needed wrapping. Ran ./lint --fix, committed exactly the ten .cmake files, and ./lint is now green locally (lane lint: ok). Refs #962.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator. The Fast Gate ⚡ lint failure is fixed (f3ad5284b: gersemi re-wrap of the ten rewritten test/cmocka/tests.d/*.cmake entries) and the run is green again; auto-merge is on, so the queue takes it from here.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Fixed the Tier 2 red (03111ece6): the wrapper test's runner string was $uv --script, so uv rejected it — --script is a uv run flag, not a top-level one — and test_pipewire_wrapper failed with exit 2:

FAIL: test_pipewire_cursor_hdr.py, long TMPDIR: the daemon starts and the test runs: exit 2, expected 0

It is $uv run --script now, the same invocation the ctest callers use. Verified locally with the real PipeWire stack, which the host happens to carry:

$ sh test/cmocka/test_pipewire_wrapper.sh test/cmocka
ok:   test_pipewire_cursor_hdr.py, long TMPDIR: the daemon starts and the test runs (exit 0)
ok:   test_pipewire_cursor_hdr.py, daemon exits at once: fails (exit 1)
ok:   test_pipewire_context_fail.sh, long TMPDIR: the daemon starts and the test runs (exit 0)
ok:   test_pipewire_context_fail.sh, daemon exits at once: fails (exit 1)
ok:   test_pipewire_cursor_hdr.py, no pipewire binary: skips (exit 77)

Refs #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).
@zackees
zackees force-pushed the infra/962-gen-005-pipewire-cursor-hdr-python branch from 03111ec to acf3661 Compare October 27, 2026 13:05
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).
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 #962.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Rebased onto master (2c9ebf367) as coordinator; the PR was CONFLICTING with no CI.

What I resolved

  • ci.toml — #2619 ported test_pipewire_context_fail.sh and dropped its GEN-005 block while this PR drops the test_pipewire_cursor_hdr.sh one; the two deleted blocks were adjacent, so the rebase conflicted on them. Resolution: both go. ci-lint precheck on the rebased tip: 23 violations, 557 approved exceptions (master: 558) — one exception burnt down, same count as ci: Port the private-PipeWire-pulse harness to Python (#962) #2628's run.
  • test/cmocka/test_pipewire_wrapper.sh — #2619 renamed the context-failure wrapper in the loop; this PR renames the cursor-hdr one. Resolution: both wrappers are Python now (test_pipewire_cursor_hdr.py, test_pipewire_context_fail.py), each run through uv run --script, header comment updated to match.

One real defect fixed while resolving

The loop built its runner as runner="$uv --script", i.e. it invoked uv --script <file>, which is not a uv command (error: unexpected argument '--script' found, exit 2). The wrapper test then read that as "the wrapper failed" for the long-TMPDIR case and failed. It is uv run --script, matching the control line the same PR already had. Verified on this host with real pipewire installed:

$ sh test/cmocka/test_pipewire_wrapper.sh test/cmocka
ok:   test_pipewire_cursor_hdr.py, long TMPDIR: the daemon starts and the test runs (exit 0)
ok:   test_pipewire_cursor_hdr.py, daemon exits at once: fails (exit 1)
ok:   test_pipewire_context_fail.py, long TMPDIR: the daemon starts and the test runs (exit 0)
ok:   test_pipewire_context_fail.py, daemon exits at once: fails (exit 1)
ok:   test_pipewire_cursor_hdr.py, no pipewire binary: skips (exit 77)

Gates on the rebased tip (acf36610a)

  • ci/test_uv_run.py 5 OK, ci/test_pipewire_cursor_hdr.py 10 OK
  • gersemi --check test/cmocka/tests.d clean, clang-format --dry-run --Werror clean on the eleven touched .c files
  • ci-lint precheck 23 violations / 557 exceptions as above
  • ruff format would reformat ci/test_pipewire_cursor_hdr.py, but it is not a repo gate (master's own ci/test_uv_run.py / ci/test_pipewire_context_fail.py are unformatted too); ruff check passes.

Force-pushed with --force-with-lease, so this branch is now based on current master. PR CI will run fresh; the PR body's SHAs are stale by one rebase.

@zackees
zackees force-pushed the infra/962-gen-005-pipewire-cursor-hdr-python branch from acf3661 to 6145768 Compare October 27, 2026 13:06
…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.
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Rebased onto origin/master after #2619 landed (it also touched test/cmocka/test_pipewire_wrapper.sh). Rebased SHAs: RED f4a786808, GREEN 825efe6be, gersemi 6145768c1, rebase fix b6043b065.

Conflicts and how they were resolved:

  • ci.toml: both PRs delete the adjacent GEN-005 block, so the merge kept one of the two path = lines. Resolved by deleting the whole block — the diff against master now shows only the test/cmocka/test_pipewire_cursor_hdr.sh block gone.
  • test/cmocka/test_pipewire_wrapper.sh: the shared header comment (both renames apply → test_pipewire_cursor_hdr.py, test_pipewire_context_fail.py, test_pulse_monitor_device.sh) and the wrapper loop. Both wrappers are Python now, so the loop runs both through uv run --script; the $uv --script form the runner string used was itself the Tier 2 red from before (uv rejects it — --script is a uv run flag), and test(cmocka): Run the PipeWire context-failure harness from Python (#962) #2619's ci/test_pipewire_context_fail.py pins the literal uv run --script in this file, so the literal is what the loop uses now. The no-pipewire control keeps the absolute $uv, since it runs with a stripped PATH.

Re-checked against the new tip: ./lint lane green; ci/test_pipewire_cursor_hdr.py (10), ci/test_pipewire_context_fail.py (10), ci/test_uv_run (5), ci/test_local_gate (12) all OK; the real-PipeWire test_pipewire_wrapper.sh run passes both wrappers both ways. ci-lint precheck: master 558 → branch 557 approved exceptions, no new violation. Refs #962.

@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 of the rebased head acf36610a (author account, so a comment rather than an approval). Details of the conflict resolution and of the uv --script → uv run --script fix are in the comment above; this note is the review verdict on the PR as a whole.

Verdict: correct port, no change requested.

  • The .py module is a token-for-token port of the deleted .sh (session-bus unset, PIPEWIRE_REMOTE unset, 77 skip when pipewire is absent, private runtime dir with the /tmp fallback when len(dir) + len("/pipewire-0-manager") > 107, daemon start, socket wait that fails — not skips — when an installed daemon does not come up, then the test binary's status).
  • All twelve test/cmocka/tests.d/*.cmake callers, test/cmocka/build/test-graph.json, the rust/obs-build/tests/native.rs pin and the wrapper test move together; the GEN-005 block is gone from ci.toml and the comment-only renames in the camera/screencast .c files match.
  • ci/test_pipewire_cursor_hdr.py 10 OK, ci/test_uv_run.py 5 OK, ci-lint precheck 23 violations / 557 approved exceptions (master 558), gersemi --check clean, clang-format clean on the eleven touched .c files, and the wrapper test passes against a real local pipewire.
  • The one defect I found — the wrapper loop invoking uv --script instead of uv run --script — is fixed in the rebase; see the comment above for the before/after output.

docs/features.md: correctly untouched (CI tooling only).

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 9735449 Oct 27, 2026
36 checks passed
@zackees
zackees deleted the infra/962-gen-005-pipewire-cursor-hdr-python branch October 27, 2026 13:34
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