[libcamera-devel] [PATCH] README: Add unit tests instructions

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Feb 9 14:02:32 CET 2023


Hi Kieran,

Thank you for the patch.

On Thu, Feb 09, 2023 at 12:43:11PM +0000, Kieran Bingham via libcamera-devel wrote:
> The unit tests require kernel modules to be loaded to support the
> virtual test cameras. Add notes to the readme to highlight that it can
> be done, and what kernel configurations are required.
> 
> Suggested-by: William Salmon <pointswaves at gmail.com>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  README.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
> 
> diff --git a/README.rst b/README.rst
> index 82dde16eedb8..58aab39d8883 100644
> --- a/README.rst
> +++ b/README.rst
> @@ -119,6 +119,49 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:
>  
>      :~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l
>  
> +Running the unit tests
> +~~~~~~~~~~~~~~~~~~~~~~
> +
> +When submitting patches, it is recommeded to run the unit tests. To use the

s/recommeded/recommended/

> +unit test framework, virtual test drivers are required to be loaded.
> +
> +The unit tests rely on kernel drivers which produce virtual devices. These can
> +be either built into the kernel, or provided as modules (=y or =m):

Drop the second sentence of the first paragraph, and merge the two
paragraphs. They essentially say the same thing.

> +
> +.. code::
> +
> +    CONFIG_MEDIA_TEST_SUPPORT=y
> +    CONFIG_V4L_TEST_DRIVERS=y
> +
> +    CONFIG_VIDEO_VIM2M=m
> +    CONFIG_VIDEO_VIMC=m
> +    CONFIG_VIDEO_VIVID=m
> +
> +If the kernel provides the test drivers as modules - they need to be loaded

s/ - /, /

> +before running the tests:
> +
> +.. code::
> +
> +    sudo modprobe vimc
> +    sudo modprobe vivid
> +    sudo modprobe vim2m
> +
> +Make sure your build configuration has tests enabled:
> +
> +.. code::
> +
> +    meson build -Dtest=true

meson deprecates implicit usage of the setup command. You should write

    meson setup -Dtest=true build

or tell to run

    meson configure -Dtest=true

in the build directory. I'd go for the later, as earlier instructions in
this file already handle the meson setup step.

> +
> +Enabling 'test=true' will implcitly add test pipeline handlers including the

s/implcitly/implicitly/
s/test pipeline handlers including the VIMC pipeline handler/the VIMC test pipeline handler/

> +VIMC pipeline handler to the build configuration.
> +
> +Then the tests can be run with
> +
> +.. code::
> +
> +  ninja -C build test
> +
> +

Extra blank line.

I'd move all this after the section-end-getting-started marker, as it's
not about getting started. Documentation/contributing.rst would also be
a good candidate.

>  Using GStreamer plugin
>  ~~~~~~~~~~~~~~~~~~~~~~
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list