[{"id":26437,"web_url":"https://patchwork.libcamera.org/comment/26437/","msgid":"<Y+Tu6OWCdlkNB6VO@pendragon.ideasonboard.com>","date":"2023-02-09T13:02:32","subject":"Re: [libcamera-devel] [PATCH] README: Add unit tests instructions","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Thu, Feb 09, 2023 at 12:43:11PM +0000, Kieran Bingham via libcamera-devel wrote:\n> The unit tests require kernel modules to be loaded to support the\n> virtual test cameras. Add notes to the readme to highlight that it can\n> be done, and what kernel configurations are required.\n> \n> Suggested-by: William Salmon <pointswaves@gmail.com>\n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  README.rst | 43 +++++++++++++++++++++++++++++++++++++++++++\n>  1 file changed, 43 insertions(+)\n> \n> diff --git a/README.rst b/README.rst\n> index 82dde16eedb8..58aab39d8883 100644\n> --- a/README.rst\n> +++ b/README.rst\n> @@ -119,6 +119,49 @@ setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:\n>  \n>      :~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l\n>  \n> +Running the unit tests\n> +~~~~~~~~~~~~~~~~~~~~~~\n> +\n> +When submitting patches, it is recommeded to run the unit tests. To use the\n\ns/recommeded/recommended/\n\n> +unit test framework, virtual test drivers are required to be loaded.\n> +\n> +The unit tests rely on kernel drivers which produce virtual devices. These can\n> +be either built into the kernel, or provided as modules (=y or =m):\n\nDrop the second sentence of the first paragraph, and merge the two\nparagraphs. They essentially say the same thing.\n\n> +\n> +.. code::\n> +\n> +    CONFIG_MEDIA_TEST_SUPPORT=y\n> +    CONFIG_V4L_TEST_DRIVERS=y\n> +\n> +    CONFIG_VIDEO_VIM2M=m\n> +    CONFIG_VIDEO_VIMC=m\n> +    CONFIG_VIDEO_VIVID=m\n> +\n> +If the kernel provides the test drivers as modules - they need to be loaded\n\ns/ - /, /\n\n> +before running the tests:\n> +\n> +.. code::\n> +\n> +    sudo modprobe vimc\n> +    sudo modprobe vivid\n> +    sudo modprobe vim2m\n> +\n> +Make sure your build configuration has tests enabled:\n> +\n> +.. code::\n> +\n> +    meson build -Dtest=true\n\nmeson deprecates implicit usage of the setup command. You should write\n\n    meson setup -Dtest=true build\n\nor tell to run\n\n    meson configure -Dtest=true\n\nin the build directory. I'd go for the later, as earlier instructions in\nthis file already handle the meson setup step.\n\n> +\n> +Enabling 'test=true' will implcitly add test pipeline handlers including the\n\ns/implcitly/implicitly/\ns/test pipeline handlers including the VIMC pipeline handler/the VIMC test pipeline handler/\n\n> +VIMC pipeline handler to the build configuration.\n> +\n> +Then the tests can be run with\n> +\n> +.. code::\n> +\n> +  ninja -C build test\n> +\n> +\n\nExtra blank line.\n\nI'd move all this after the section-end-getting-started marker, as it's\nnot about getting started. Documentation/contributing.rst would also be\na good candidate.\n\n>  Using GStreamer plugin\n>  ~~~~~~~~~~~~~~~~~~~~~~\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 37B9CBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Feb 2023 13:02:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 84280625F4;\n\tThu,  9 Feb 2023 14:02:35 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D72F0603BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Feb 2023 14:02:34 +0100 (CET)","from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 20ACF9CA;\n\tThu,  9 Feb 2023 14:02:34 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675947755;\n\tbh=Q9wYgt26j7CL6UnTYMuN4wwFN/492soB3Ffn08IRqZw=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=Yf51tPucWh6XkReSrl2r0gHQSGSLYsEISoEx7jn8PR7P72m0IAge3YfWv0SBOq1JR\n\tvV8tfvqS4LRWgjUwd1VR4bKySGBkKbPOF4QBqdySJ0Lxic0mZSp/U2yEjl81Kdy54g\n\t/bC6/+NDIb6iNvzYOTs4KKS5s4Y2mbre+Lo2UTZ5FqeRpas8QcnZmdCr0SwyEinqRm\n\tA8BC7KGRx1uL+tTTJZ+5ybUesR9ok4353ly4jnHi+mY0cIa4xNDovhT6OZ8gwwL22c\n\tc6OuoG12ouPb0c4nNt2yx2MVK6/7JLSNaObeylgclF9lqMZcHcBurHDAmriMNZWFcB\n\tIDW01wpUD6DLw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1675947754;\n\tbh=Q9wYgt26j7CL6UnTYMuN4wwFN/492soB3Ffn08IRqZw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hJXMlCM5IYyrkkKE9F0nhzw+5fjJ0IXUmH1Ym4dxo36LRkLoWyd0arWfPGXrbqkYz\n\tOtVb3abomuc8toj7tBYYfkWXgleudTD2lfpUawGHtyE3yeaq30iewzxVzKnasWbvTc\n\t+DvkVxdwwbKbKWTZWigC7FhvQ7sL9LVrzx6RBEao="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hJXMlCM5\"; dkim-atps=neutral","Date":"Thu, 9 Feb 2023 15:02:32 +0200","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<Y+Tu6OWCdlkNB6VO@pendragon.ideasonboard.com>","References":"<20230209124311.2504434-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20230209124311.2504434-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] README: Add unit tests instructions","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tWilliam Salmon <pointswaves@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]