summaryrefslogtreecommitdiff
path: root/src/lc-compliance
AgeCommit message (Collapse)Author
2022-02-03lc-compliance: Only download gtest subproject as a fallbackJavier Martinez Canillas
Currently, a subproject is used to fetch gtest dependency unconditionally for any Linux distribution besides ChromeOS. But it leads to a regression in distros whose builders are not allowed to download files during build. This change was introduced by commit 0d50a04cc918 ("lc-compliance: Build with gtest in subprojects") and the rationale is that some distros, such as Debian ship libgtest-dev as a static library. And this could be built with a different toolchain than the one used to build libcamera itself. But this seems to be a corner case, usually users will either build both libcamera and all its dependencies using the same toolchain or build it using both the libgtest library and toolchain as provided by the distro. If someone doesn't want for meson to pick up the non-compatible static library provided by the distro, then instead should make sure that their build root does not have the package providing this installed. Let's simplify the logic to find the dependency and just use the built-in support in dependency() function to fallback to a subproject if not found. This covers to common case of attempting to use the gtest provided by the system or pulling from source if not found or is not preferred. To force meson to fallback to the wrap for gtest you can use this command: meson configure -Dforce_fallback_for=gtest and to force fallback for all the dependencies, you can use the following: meson build --wrap-mode=forcefallback Fixes: commit 0d50a04cc918 ("lc-compliance: Build with gtest in subprojects") Reported-by: Eric Curtin <ecurtin@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-24lc-compliance: Convert to pragma onceKieran Bingham
Remove the verbose #ifndef/#define/#endif pattern for maintaining header idempotency, and replace it with a simple #pragma once. This simplifies the headers, and prevents redundant changes when header files get moved. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-11-15lc-compliance: Build with gtest in subprojectsHirokazu Honda
libgtest-dev is provided as a static library at least by Debian 10. The compiler and linker to create the static library might be different from ones used for libcamera. This causes a problem upon linking. This puts gtest code to subprojects, builds the code and link it for lc-compliance. However, libgtest is locally built as a library on ChromeOS and thus the used compiler and linker are the same as one used for libcamera. We don't do these on ChromeOS build environment. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-15lc-compliance: Remove using namespace in header filesHirokazu Honda
"using namespace" in a header file propagates the namespace to the files including the header file. So it should be avoided. This removes "using namespace" in header files in lc-compliance. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-09-02libcamera: Use simpler Signal::disconnect() functionLaurent Pinchart
When disconnecting a signal from a receiver, it is usually not necessary to specify the receiver's slot function explicitly, as the signal is often connected to a single slot for a given receiver. We can thus use a simpler version of Signal::disconnect() that takes a pointer to the receiver object only. This reduces code size, as the disconnect() function is a template function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-07-06lc-compliance: Add list and filter parametersNícolas F. R. A. Prado
Add a --list parameter that lists all current tests (by mapping to googletest's --gtest_list_tests). Add a --filter 'filterString' parameter that filters the tests to run (by mapping to googletest's --gtest_filter). While at it, add to the help message that further googletest options can be passed through the environment. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06lc-compliance: Refactor using GoogletestNícolas F. R. A. Prado
Refactor lc-compliance using Googletest as the test framework. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06lc-compliance: Add Environment singletonNícolas F. R. A. Prado
Add a singleton Environment class in order to make the camera available inside all tests. This is needed for the Googletest refactor, otherwise the tests, which are statically declared, won't be able to access the camera. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-07-06lc-compliance: Make SimpleCapture::stop() idempotentNícolas F. R. A. Prado
Make SimpleCapture::stop() be able to be called multiple times and at any point so that it can be called from the destructor and an assert failure can return immediately. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-25libcamera: rename public libcamera dependencyKieran Bingham
Now that we have a libcamera_private, make the public only dependency libcamera_public so that it is clear which interface is being linked. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-21lc-compliance: simple_capture: Handle unsupported rolesNiklas Söderlund
It's valid for a camera to return a nullptr if the requested set of roles can not be satisfied. This is not correctly handled by lc-compliance which instead crashes, fix this. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
2021-04-14lc-compliance: Drop return value from SimpleCapture::stop()Niklas Söderlund
The return value is never checked and serves to real usage, drop it. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-14lc-compliance: Initialize the event loop pointerNiklas Söderlund
The event loop pointer loop_ was not initialized. This has no effect on the current code flow but could in the future lead to hard debug problems. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-12lc-compliance: Add test stopping single stream with requests queuedNiklas Söderlund
Add a test which stops a camera while requests are still queued. This intends to test cleanup paths where requests are dequeued from video devices in an uncompleted state. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-04-12lc-compliance: Add a libcamera compliance toolNiklas Söderlund
Add a compliance tool to ease testing of cameras. In contrast to the unit-tests under test/ that aims to test the internal components of libcamera the compliance tool aims to test application use-cases and to some extent the public API. This change adds the boilerplate code of a simple framework for the creation of tests. The tests aim both to demonstrate the tool and to catch real problems. The tests added are: - Test that if one queues exactly N requests to a camera exactly N requests are eventually completed. - Test that a configured camera can be started and stopped multiple times in an attempt to exercise cleanup code paths otherwise not often tested with 'cam' for example. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>