From patchwork Sun Feb 3 11:00:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 492 Return-Path: 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 E7DD460B1B for ; Sun, 3 Feb 2019 12:01:07 +0100 (CET) Received: from localhost.localdomain (218.182-78-194.adsl-static.isp.belgacom.be [194.78.182.218]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 936F85AA; Sun, 3 Feb 2019 12:01:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549191667; bh=2lZdF4EKlfd+Qs7P7uWQt6FhfoMHH8BdFkjfYeFpk1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjc3/GC66Vx8ksESPpYYmH3wtCqygQmOaW1aodtmktSFuE0/9XmwesFFY9CXZbTyw y8s6Ht0B3gumKqzAumwlxw7bF9MiXT1tx6Fy9tdB1Ezybi3mpMA4KjXB4pztLimQp9 S7gOh7hQkl2QfuCcEECXfCpP3YHb2eJtFtLLib/Q= From: Kieran Bingham To: LibCamera Devel Date: Sun, 3 Feb 2019 12:00:56 +0100 Message-Id: <20190203110102.5663-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190203110102.5663-1-kieran.bingham@ideasonboard.com> References: <20190203110102.5663-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/11] test: v4l2_device: Add request_buffers test X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Feb 2019 11:01:08 -0000 Add a utility to the test suite to request and allocate buffers from a V4L2Device to ensure it functions successfully. Signed-off-by: Kieran Bingham --- test/v4l2_device/meson.build | 1 + test/v4l2_device/request_buffers.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 test/v4l2_device/request_buffers.cpp diff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build index 41675a303498..b6b672611d60 100644 --- a/test/v4l2_device/meson.build +++ b/test/v4l2_device/meson.build @@ -2,6 +2,7 @@ # They are not alphabetically sorted. v4l2_device_tests = [ [ 'double_open', 'double_open.cpp' ], + [ 'request_buffers', 'request_buffers.cpp' ], ] foreach t : v4l2_device_tests diff --git a/test/v4l2_device/request_buffers.cpp b/test/v4l2_device/request_buffers.cpp new file mode 100644 index 000000000000..8ab0f560516f --- /dev/null +++ b/test/v4l2_device/request_buffers.cpp @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * libcamera V4L2 API tests + */ + +#include "v4l2_device_test.h" + +class RequestBuffers : public V4L2DeviceTest +{ +protected: + int run() + { + /* TODO: + * Test invalid requests + * Test different buffer allocations + */ + BufferPool *pool = dev_->requestBuffers(8); + + if (!pool) + return TestFail; + + return TestPass; + } +}; + +TEST_REGISTER(RequestBuffers);