[libcamera-devel] README: Add unit tests instructions
diff mbox series

Message ID 20230209124311.2504434-1-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • [libcamera-devel] README: Add unit tests instructions
Related show

Commit Message

Kieran Bingham Feb. 9, 2023, 12:43 p.m. UTC
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@gmail.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 README.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Laurent Pinchart Feb. 9, 2023, 1:02 p.m. UTC | #1
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@gmail.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@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
>  ~~~~~~~~~~~~~~~~~~~~~~
>

Patch
diff mbox series

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
+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):
+
+.. 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:
+
+.. code::
+
+    meson build -Dtest=true
+
+Enabling 'test=true' will implcitly add test pipeline handlers including the
+VIMC pipeline handler to the build configuration.
+
+Then the tests can be run with
+
+.. code::
+
+  ninja -C build test
+
+
 Using GStreamer plugin
 ~~~~~~~~~~~~~~~~~~~~~~