Add pure-Python HDMI RX (input) test to checkbox-provider-ce-oem (New)#2691
Open
seankingyang wants to merge 5 commits into
Open
Add pure-Python HDMI RX (input) test to checkbox-provider-ce-oem (New)#2691seankingyang wants to merge 5 commits into
seankingyang wants to merge 5 commits into
Conversation
Replace the proprietary genio-test-tool.hdmi-rx-tool vendor binary with a pure-Python, stdlib-only HDMI RX test that talks to the kernel directly behind a pluggable per-platform backend (OEMQA-6742). bin/ (Python 3.5-safe: namedtuples, .format(), no annotations): - hdmirx_utils.py: platform-independent core -- data models, Event enum, the HdmiRxBackend contract, the Linux _IOC ioctl-number helpers, a reusable IoctlCharBackend base (a new vendor is data + mappers only), a stdlib netlink KOBJECT_UEVENT listener, and the verify_* helpers. - hdmirx_genio.py: Genio backend (/dev/hdmirx, magic 'H', mtk_hdmirx module) -- ctypes structs, command table and field mappers, written from the ABI spec rather than the vendor source. Struct sizes verified (VID 40, DEV 12, AUD 28) and ioctl numbers pinned by an abi-selfcheck. - hdmirx_generic.py: mainline V4L2 backend using the stable UAPI VIDIOC_QUERY_DV_TIMINGS for video/presence; audio, enable and events raise NotImplementedError with the exact UAPI to wire up on a target. - hdmirx_tool.py: the only script the jobs invoke -- auto-detects a backend (or --backend), one self-verifying sub-command per job, exit 0 pass / 1 fail, optional --json. units/hdmi-rx/: category, manifest (has_hdmi_rx), the 7 jobs with ce-oem-hdmi-rx/ ids gated only on the manifest (no vendor executable), and full/manual/automated test plans plus after-suspend variants. tests/: 73 hardware-free unit tests (mocked ioctl/netlink) covering the ioctl numbers, struct ABI, field decoders, netlink parser, verify_* logic and CLI contract. Each asserts both pass and mismatch paths so a hard-coded implementation would fail.
The ce-oem tox gate runs flake8 with the pep8-naming plugin, which flags the ctypes structs and ioctl helpers that intentionally mirror the external ABI verbatim: the kernel _IOC/_IOW/_IOR/_IOWR macros (N802), the MTK HDMIRX_* C struct names and the V4L2 v4l2_* UAPI struct names (N801). Renaming would break the 1:1 correspondence with the vendor header, so suppress per-line instead. Also silence N812 on the two short test-module aliases.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new HDMI RX (input) test suite to the checkbox-provider-ce-oem contrib provider, implemented as pure-Python tooling plus provider units (jobs, category, manifest, and test plans) and accompanied by hardware-free unit tests.
Changes:
- Introduces new HDMI RX provider units (manifest entry, category, jobs, test plans) under
units/hdmi-rx/. - Adds a pure-Python HDMI RX CLI (
hdmirx_tool.py) and backend implementations (hdmirx_genio.py,hdmirx_generic.py) plus shared utilities (hdmirx_utils.py). - Adds comprehensive hardware-free unit tests covering ioctl encoding, backend behavior, V4L2 timing parsing, and CLI behavior.
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/units/hdmi-rx/test-plan.pxu | Adds HDMI RX full/manual/auto test plan units (including after-suspend variants). |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/units/hdmi-rx/manifest.pxu | Adds has_hdmi_rx manifest entry used to gate HDMI RX jobs. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/units/hdmi-rx/jobs.pxu | Adds HDMI RX jobs invoking hdmirx_tool.py for module/events/cable/video/audio/enable flows. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/units/hdmi-rx/category.pxu | Adds a dedicated category for HDMI RX jobs. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/bin/hdmirx_utils.py | Implements shared models, ioctl helpers, uevent listener, and verification helpers. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/bin/hdmirx_tool.py | Implements the CLI orchestration and JSON/plain reporting used by provider jobs. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/bin/hdmirx_genio.py | Implements the Genio ioctl backend with ctypes structures and field mapping. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/bin/hdmirx_generic.py | Implements a generic V4L2 backend for reading DV timings (video/presence only). |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/tests/test_hdmirx_utils.py | Adds unit tests for ioctl encoding, uevent parsing, and verify helpers. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/tests/test_hdmirx_tool.py | Adds unit tests for CLI exit codes, orchestration, and JSON output. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/tests/test_hdmirx_genio.py | Adds unit tests pinning Genio ABI struct sizes/ioctl numbers and mapping logic. |
| contrib/checkbox-ce-oem/checkbox-provider-ce-oem/tests/test_hdmirx_generic.py | Adds unit tests for V4L2 struct sizes, frame-rate computation, and discovery logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Make the manifest gates self-describing and separate the two ways of testing HDMI RX: - manifest: has_hdmi_rx (single) becomes has_hdmi_rx_v4l2 (generic mainline V4L2 path) and has_hdmi_rx_specific (a platform-specific backend). - jobs: a v4l2 suite (module-detect, cable, video-info) forced onto --backend v4l2, and a specific suite (all 7 jobs) that selects the backend from $HDMIRX_BACKEND (environ) and errors if it is unset. - test plans: separate ce-oem-hdmi-rx-v4l2-* and ce-oem-hdmi-rx-specific-* families plus after-suspend variants. - hdmirx_tool.py: detect() now treats an empty --backend (unset HDMIRX_BACKEND) as a hard error instead of silently auto-detecting, and --backend is no longer restricted to a fixed choice list.
Apply the checkbox-job-plan patterns to the HDMI RX (input) units:
- Render the platform-specific templates with the jinja2 engine
(template-engine: jinja2, {{ backend }}) so the backend name flows
into the job id, summary, description and command.
- Keep each template-id static (<feature>-tests) and select the
generated jobs from the test plan by template-id instead of
generated-job regular expressions.
- Drop the redundant after-suspend test plans: the jobs already carry
flags: also-after-suspend, which self-activates the after-suspend
siblings when the original job is selected.
- Group both manifest entries under one shared _prompt so they appear
together on the manifest screen; the distinguishing detail moves to
_name.
- Remove the decorative section-banner comments from the bin/ scripts
and pxu files, and de-duplicate the backend-name listing in detect().
- Move the generic V4L2 jobs to units/hdmi-rx/v4l2.pxu and the platform-specific resource + jinja2 templates to units/hdmi-rx/specific.pxu; drop the combined jobs.pxu so each suite lives in its own file. - Simplify the ce-oem-hdmi-rx-backend resource command to a single-value echo guarded against an unset HDMIRX_BACKEND, replacing the space-separated awk loop (one backend per DUT, e.g. HDMIRX_BACKEND=genio).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
HDMI RX (input) is currently tested only through the proprietary
genio-test-tool.hdmi-rx-toolvendor binary, driven by pexpect/expect againstits interactive menu (baoshan + genio providers). OEMQA-6742 migrates this to a
pure-Python, stdlib-only test that talks to the kernel directly, behind a
pluggable per-platform backend, landing in
checkbox-provider-ce-oem(
com.canonical.contrib). No vendor binary, no snap dependency.Implementation (flat
bin/hdmirx_*.py, Python 3.5-safe):hdmirx_utils.py— platform-independent core: data models, theHdmiRxBackendcontract, the Linux_IOCioctl-number helpers, a reusableIoctlCharBackendbase (open/ioctl/errno/abi_selfcheck/uevent plumbinglives here once), a stdlib netlink
KOBJECT_UEVENTlistener, and theverify_*helpers.hdmirx_genio.py—GenioIoctlBackendfor MediaTek Genio (/dev/hdmirx,magic
'H', modulemtk_hdmirx). Declares only the ctypes structs, thecommand table and the field mappers — written from the ABI spec (ioctl
numbers, struct fields, decode tables), not from the vendor source. Struct
sizes are pinned by an
abi-selfcheck(VID 40 / DEV 12 / AUD 28) that runsbefore any ioctl so an ABI drift fails loudly instead of returning garbage.
hdmirx_generic.py—V4L2Backendfor mainline platforms, readingresolution/refresh through the stable
VIDIOC_QUERY_DV_TIMINGSUAPI. Audio,enable/disable and source-change events raise
NotImplementedErrorwith theexact UAPI to wire up, rather than ship ctypes that no V4L2 target has yet
validated.
hdmirx_tool.py— the only script the jobs call: auto-detects a backend(or
--backend), runs one self-verifying sub-command per job, exits 0 onpass / 1 on fail,
--jsonfor machine-readable output.Adding another custom-ioctl platform is a new flat
hdmirx_<vendor>.pyofstructs +
COMMANDS+EVENT_MAP+_map_*— no plumbing rewritten.Units (
units/hdmi-rx/): the two suites live in their own job files,v4l2.pxuandspecific.pxu, alongsidecategory,manifestandtest-plan:manifest.has_hdmi_rx_v4l2; forced onto--backend v4l2; the three jobs the V4L2 backend supports today(module-detect, cable, video-info).
manifest.has_hdmi_rx_specific. Ace-oem-hdmi-rx-backendresource job emits a singlebackendrecord fromthe
HDMIRX_BACKENDenvironment variable (one backend per DUT, e.g.genio); jinja2 templates then generate the 7 jobs for that backend, withthe backend name in the job id, summary and
--backendargument. The jobscarry no
environ:; the test plan selects them bytemplate-id, and anunset
HDMIRX_BACKENDyields no record and hence no specific jobs.Both drop the old vendor-executable gate. Expected values (1920x1080@60,
24-bit/2-ch/48.0 kHz) and
user: rootare kept. The jobs carryflags: also-after-suspend, which self-activates the after-suspend siblings,so no separate after-suspend test plans are needed.
Data-format changes: none to the submission schema. New provider units and
two new manifest entries (
has_hdmi_rx_v4l2,has_hdmi_rx_specific) only.Resolved issues
Migrates https://warthogs.atlassian.net/browse/OEMQA-6742 (the accepted design
of record is in that card's description). On-hardware validation on a Genio
DUT is tracked before the epic closes (see Tests).
Documentation
No repository/Sphinx documentation is impacted. Each job carries its own
_summary/_purpose/_description; both manifest entries share one_promptso they group together on the manifest screen. The full design +ABI reference lives in the OEMQA-6742 card.
Tests