-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test Jobs for V4L2 Compliance (New) #1653
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1653 +/- ##
==========================================
+ Coverage 48.96% 49.00% +0.04%
==========================================
Files 371 373 +2
Lines 40296 40335 +39
Branches 6808 6816 +8
==========================================
+ Hits 19730 19766 +36
- Misses 19846 19847 +1
- Partials 720 722 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
I left a couple of small things and a comment regarding the templated jobs.
I think there is no advantage in having all of these jobs separated into templated jobs. Everything could be done in a single compliance job, but let me know your thoughts on that.
parser.add_argument( | ||
"--treat-unsupported-as-fail", | ||
action="store_true", | ||
help="If specified, and if any of the ioctls are in unsupported, " | ||
"they are treated as fail and will fail the test case", | ||
default=False, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we using this flag anywhere?
We are parsing it but it's not used in the main function.
return_code = 0 | ||
|
||
if "VIDIOC_QUERYCAP" in details["failed"]: | ||
return_code = 1 | ||
for ioctl_request in args.ioctl: | ||
if ioctl_request in details["failed"]: | ||
print(ioctl_request, "failed the test", file=sys.stderr) | ||
return_code = 1 | ||
|
||
if return_code == 0: | ||
print(args.ioctl, "are all supported") | ||
|
||
return return_code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to handle the return codes. You could just raise a SystemExit if the test fails.
If you want to gather the information of all the failed requests before raising the raising the SystemExit you can do it, but there is no need to handle it in the "main guard"
@@ -0,0 +1,74 @@ | |||
#! /usr/bin/python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use /usr/bin/env python3
so we don't force using the python3 interpreter under bin
Please also add the checkbox header for all the binaries. You can also include it for the tests, but we are not enforcing this that often
#! /usr/bin/python3 | |
#!/usr/bin/env python3 | |
# Copyright 2025 Canonical Ltd. | |
# Written by: | |
# Zhongning Li <zhongning.li@canonical.com> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License version 3, | |
# as published by the Free Software Foundation. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
unit: template | ||
category_id: com.canonical.plainbox::camera | ||
template-resource: camera/v4l2-ioctl_resource | ||
template-unit: job | ||
template-id: camera/v4l2-compliance_ioctl_name | ||
_template-summary: To check if {ioctl_name} works on {name} | ||
id: camera/v4l2-compliance_{ioctl_name} | ||
_summary: v4l2 compliance for {ioctl_name} on {name} | ||
plugin: shell | ||
command: | ||
v4l2_compliance_test.py --device /dev/{name} --ioctl {ioctl_name} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we need a templated job for this?
In my case, it creates 60+ jobs. This is not inherently bad, but I don't see the point of having them as separate jobs. The output of the test is quite straightforward, and having all of these separated tests will involve more scrolling during test review, and maybe missing some other important results.
As I said, that's a minor issue if there was an advantage of having there in separate jobs, but I think a joint report for all the compliance tests in one file will be better
template-resource: camera/v4l2-ioctl_resource | ||
template-unit: job | ||
template-id: camera/v4l2-compliance_ioctl_name | ||
_template-summary: To check if {ioctl_name} works on {name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, templated summaries should not include the specific name, they should be general for all the templated jobs.
Description
This PR implements test jobs utilizing the v4l2 compliance parser. Each camera will get a job for each ioctl request, so the total number of jobs would be (n_cameras * n_ioctl_tests).
Resolved issues
Documentation
As of right now each camera will run v4l2-compliance once for every ioctl request. To test more ioctls in 1 run, pass in more ioctl names in --ioctl.
Tests
Unit tests
Test plan tested on 18, 20 VM with camera pass through, 22&24 DUTs with USB cameras.