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

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Aug 1 10:49:34 CEST 2023


Hi All,

Quoting Kieran Bingham (2023-07-11 15:55:13)
> 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>

Could I get any commments or tags on this please?

--
Kieran


> ---
> 
> v2:
>  - Reword small fixes from Laurent
>  - Move to contributing.rst
> 
>  Documentation/contributing.rst | 41 ++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/Documentation/contributing.rst b/Documentation/contributing.rst
> index 2f0b4921f7e6..27c77558a6e6 100644
> --- a/Documentation/contributing.rst
> +++ b/Documentation/contributing.rst
> @@ -59,6 +59,47 @@ uses `Doxygen`_.  Please make sure to document all code during development.
>  .. _Sphinx: https://www.sphinx-doc.org
>  .. _Doxygen: https://www.doxygen.nl
>  
> +Running the unit tests
> +----------------------
> +
> +When submitting patches, it is recommended to run the unit tests. 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):
> +
> +.. 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
> +before running the tests:
> +
> +.. code::
> +
> +    sudo modprobe vimc
> +    sudo modprobe vivid
> +    sudo modprobe vim2m
> +
> +Make sure your build configuration has tests enabled by running the following
> +in the build directory:
> +
> +.. code::
> +
> +    meson configure -Dtest=true
> +
> +Enabling 'test=true' will implicitly add the VIMC test pipeline handler to the
> +build configuration.
> +
> +Then the tests can be run with:
> +
> +.. code::
> +
> +  ninja -C build test
> +
>  Submitting Patches
>  ------------------
>  
> -- 
> 2.34.1
>


More information about the libcamera-devel mailing list