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

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Feb 9 13:43:11 CET 2023


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
+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
 ~~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.34.1



More information about the libcamera-devel mailing list