From patchwork Thu Feb 9 12:43:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 18272 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 78491BDB1C for ; Thu, 9 Feb 2023 12:43:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B7108625E3; Thu, 9 Feb 2023 13:43:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1675946601; bh=crv5ZDSaklsFZsqyq/a4WvFW5nHuUmQUIYcHC4Vc/8k=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=j0Olhe2J6RsoPhHPdDRSrlGvdVdQACmS5VQ36CVjIeIBwaDdgVVhjobPIQlYfD+tS 59/pCHVCXpq/ajY2nitQBXLCA/B1w/1c0WiRPn3ke7UKr4vP9MIwg7DvaPM29D6krd mgsyMkhQkAsImRKnsHfc65vW029Tl3RfENUywLz8d9roFsjI1r66xYw037VOmjEfPK FEy/7tdE4e+g0qhIQF2Kw5uK8i+B6nu0SxnJDs8KYNYf8eHcfzY3a0u3p7bz/aI/wr 0M/VdlzFAo/4zlYyEyo4/KuKVsVQPAHEPQ8SsqBtoU5PTfD/K1DmIyEzB4JV1QfMXz yo/LGjM1Vwytg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D93A0603BD for ; Thu, 9 Feb 2023 13:43:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oYrv1wXu"; dkim-atps=neutral Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 51CC9D4A; Thu, 9 Feb 2023 13:43:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1675946599; bh=crv5ZDSaklsFZsqyq/a4WvFW5nHuUmQUIYcHC4Vc/8k=; h=From:To:Cc:Subject:Date:From; b=oYrv1wXuK4F7FY6GgwdAdBK6KkbRaLuww9fqN0viTdXROQVj/im/zCjuRUOBuLZs6 wf96/grptsU9g8aUP7i3ZlvoriW/cs1Zsy1FddjgsnwrhrC+HIJSrSLx0AAiHIzrV9 /58zEkKAnOR3Msgld2+LUdhZpbvqBgWAxQqNxJMI= To: libcamera devel Date: Thu, 9 Feb 2023 12:43:11 +0000 Message-Id: <20230209124311.2504434-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Cc: William Salmon Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Signed-off-by: Kieran Bingham --- 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 ~~~~~~~~~~~~~~~~~~~~~~