Simplify audio sink iteration in docking station tests (New)#2442
Simplify audio sink iteration in docking station tests (New)#2442tomli380576 wants to merge 29 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2442 +/- ##
==========================================
+ Coverage 58.65% 58.89% +0.23%
==========================================
Files 476 476
Lines 48027 48069 +42
Branches 8581 8583 +2
==========================================
+ Hits 28172 28311 +139
+ Misses 18961 18861 -100
- Partials 894 897 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR aims to automate docking-station multi-monitor audio playback verification by programmatically iterating through PipeWire audio sinks (using wpctl set-default <id>) and running a speaker test for each available sink.
Changes:
- Update the dock multi-monitor audio playback job to call a new PipeWire utility subcommand that iterates sinks automatically.
- Add an
iter-audio-sinkssubcommand tocheckbox-support-pipewire-utils, including sink discovery and switching logic. - Refine some typing/return-shape behavior around
pw-dumpparsing and related helpers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| providers/base/units/dock/jobs.pxu | Switches the dock audio playback job to use the new automatic sink-iteration subcommand. |
| checkbox-support/checkbox_support/scripts/pipewire_utils.py | Implements iter_audio_sinks() and wires it into the CLI; includes small refactors/typing adjustments. |
Comments suppressed due to low confidence (1)
checkbox-support/checkbox_support/scripts/pipewire_utils.py:110
- The
_get_pw_dump()docstring still says it returns a dict and documents:"rtype": dict, but the function returns a JSON-decoded list (and now returns[]on decode failure). Please update the docstring to reflect the actual return type/shape to avoid misleading future callers.
def _get_pw_dump(
self, p_type: 't.Literal["Device", "Node"]'
) -> "list[dict[str, t.Any]]":
"""
Use to convert the json output of pw-dump to dict object
:param p_type: pipewire object type, such as "Node"
:type p_type: str
:returns: pw-dump in dict data structure
:"rtype": dict
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
checkbox-support/checkbox_support/scripts/pipewire_utils.py:111
_get_pw_dump()now returns a list (and returns[]on failure), but the docstring still says it converts to/returns a dict (":rtype": dict). Please update the docstring (and wording like "dict object") to match the actual return type to avoid misleading callers and future maintenance issues.
def _get_pw_dump(
self, p_type: 't.Literal["Device", "Node"]'
) -> "list[dict[str, t.Any]]":
"""
Use to convert the json output of pw-dump to dict object
:param p_type: pipewire object type, such as "Node"
:type p_type: str
:returns: pw-dump in dict data structure
:"rtype": dict
"""
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
(the +6000 lines are the test data not actual code xD)
Description
The original test case
dock/*-monitor-multi-head-audio-playbackwas a little cumbersome because the user has to wait until every single audio sink has been tested before re-testing any of the earlier ones. This PR modifies the flow to add automatic audio sink switching and shows a short menu to allow the user to quickly switch between audio sinks without leaving checkbox.Also added some type annotations.
Resolved issues
QoL improvement only.
Documentation
For automatic sink switching, the basic idea here is to find all the node IDs associated with an "available" audio sink, use
wpctl set-default <id>to change it, then run the speaker test. Pipewire doesn't seem to provide a convenient way to query all available sinks, so this script iterates through all the sink nodes, finds the parent device, then see if the sink node'scard.profile.devicematches anEnumRoutein the device. If there's a match and that EnumRoute is available, then we run the test.1 caveat of this script is that if a pair of headphones is plugged into the built-in 3.5mm port of a DUT that has a built-in speaker, the speaker becomes hidden and can't be detected by this script. This behavior is:
wpctl status, which also doesn't list the speaker when headphones are connectedIt's not a critical problem since we never test like this, but might be worth noting. Headphone ports on the dock will be correctly detected.
What the test data contains
They are essentially
pw-dumpresults from a laptop, that has built-in speakers and HDMI, connected to an external display that also has built-in speakers.Tests
C3 Submission:https://certification.canonical.com/hardware/202411-36032/submission/482965/