Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|