summaryrefslogtreecommitdiff
path: root/test/v4l2_compat
AgeCommit message (Collapse)Author
10 dayslibcamera: Drop file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment block. The change was generated with the following script: ---------------------------------------- dirs="include/libcamera src test utils" declare -rA patterns=( ['c']=' \* ' ['cpp']=' \* ' ['h']=' \* ' ['py']='# ' ['sh']='# ' ) for ext in ${!patterns[@]} ; do files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done) pattern=${patterns[${ext}]} for file in $files ; do name=$(basename ${file}) sed -i "s/^\(${pattern}\)${name} - /\1/" "$file" done done ---------------------------------------- This misses several files that are out of sync with the comment block header. Those will be addressed separately and manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2022-12-24test: v4l2_compat: Enable test with ASanLaurent Pinchart
When libcamera is compiled with the address sanitizer enabled, the v4l2_compat test generates failures in the link order runtime check, as the host v4l2-ctl and v4l2-compliance tools are not (generally) linked to ASan. For this reason, the test is disabled, which sadly shrinks test coverage. Fix this by loading the ASan runtime using LD_PRELOAD. This needs to be done from within the v4l2_compat_test.py Python script, as the Python interpreter itself leaks memory and would cause test failures if run with ASan. To LD_PRELOAD the ASan runtime, the path to the binary needs to be known. gcc gives us a generic way to get the path, but that doesn't work with clang as the ASan runtime file name depends on the clang version and target architecture. We thus have to keep the v4l2_compat test disabled when ASan is enabled and libcamera is compiled with clang. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24test: v4l2_compat: Reduce indentationLaurent Pinchart
Return early with subdir_done() to reduce indentation in case the v4l2_compat layer is not enabled. This matches our usual code patterns in meson.build files, and prepares for enabling the v4l2_compat test with ASan. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-01-17test: v4l2_compat: Add --verbose argumentLaurent Pinchart
Add a -v/--verbose argument to the v4l2_compat test to print the output of v4l2-compliance, even when the test passes. This can be useful when debugging. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-23test: v4l2_compat: Skip vimc as a test candidatePaul Elder
As the vimc scaler prevents us from passing v4l2-compliance, skip it until the fix has been merged. Instead of removing it from the supported_pipelines list, add an extra check, since we will have the same construct later when we check for the kernel version. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-09-19test: v4l2_compat: Report test as skipped if no compatible driver foundLaurent Pinchart
The V4L2 compatibility layer test includes a list of supported devices, as V4L2 compatibility isn't officially supported with all devices yet. If no supported device is present, the test reports success, while it actually hasn't run. Report it being skipped in that case. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-09-10test: v4l2_compat_test: Fix v4l2-compliance version parsingPaul Elder
v4l2-compliance changed their version string: v4l2-compliance 1.21.0-4618 v4l2-compliance SHA: cc211b76476aca2c072ffa83a9b003957d5f3909, 64 bits, 64-bit time_t v4l2-compliance 1.21.0-4838, 64 bits, 64-bit time_t The current parsing takes the last result of split, which works for the former, but not the latter. Take the second result of split instead, and strip away any commas. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-09-01test: v4l2_compat: Disable test when ASan is enabledLaurent Pinchart
The V4L2 compat test runs v4l2-ctl and v4l2-compliance with v4l2-compat.so preloaded. If libcamera is compiled with the address sanitizer enabled, the ASan library will be loaded due to preloading v4l2-compat.so. This however doesn't occur early enough in the dynamic linking process due to the v4l2 executables not being themselves linked to the ASan runtime, which causes ASan to abort with ==2198==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. Using LD_PRELOAD to load the ASan runtime would fix this issue, but it requires knowing the absolute path to the ASan shared object. This is compiler-dependent and for clang, architecture-dependent as well. Until we figure out how to safely retrieve that information, disable the test when ASan is enabled as a quick fix. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-07-17tests: v4l2_compat: Fix v4l2-compliance and v4l2-ctl version parsingPaul Elder
v4l2-compliance originally printed the SHA before the version, leading to the indexing that was used previously. Now that the version is printed before the SHA, the indexing is incorrect. Fix this. Although v4l2-ctl doesn't suffer the same issue, it is more correct to use the zeroth index like the v4l2-compliance version check now does, so fix that as well. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-13tests: v4l2_compat: Check v4l2-compliance and v4l2-ctl versionsPaul Elder
v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before continuing. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-13tests: v4l2_compat: Prettify failure outputPaul Elder
When a test is being run on a video device, there is output like so: Testing /dev/video0 with uvcvideo driver... and when it succeeds, "success" is appended: Testing /dev/video0 with uvcvideo driver... success On failure, however, the output of v4l2-compliance is printed before "failure" is printed, resulting in the first line of the v4l2-compliance output to be printed on the same line as the message: Testing /dev/video2 with uvcvideo driver... v4l2-compliance SHA: not available, 64 bits <v4l2-compliance output> failure Refactor the code to make "failure" print before the output of the test, to prettify the output upon failure. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-10tests: v4l2_compat: Add test for v4l2_compatPaul Elder
Test the V4L2 compatibility layer by running v4l2-compliance -s on every /dev/video* device. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>