From patchwork Wed Feb 6 06:07:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 522 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 093FD61022 for ; Wed, 6 Feb 2019 07:08:25 +0100 (CET) Received: from pendragon.ideasonboard.com (d51A4137F.access.telenet.be [81.164.19.127]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A6A0041 for ; Wed, 6 Feb 2019 07:08:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549433304; bh=OdxFgULqG4rAk37WjRsRqA7aiL0f50Ylmft6C1HX01Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j8N+JwroefUHT9IS8uODtKyFAxEoSZ+SjMAb66Qcn6g3TYx2eUkZ9gaoR5bUL6FOu 78DTakPmz7XDJ+4AzYZwmUHnTxRH8IDbKImYBXZYx+RI1lmcU0xx9tnzN5espkfnln aEJf0ablxIbML0RUPxiRct+4Gwhf2tSNTG/Ym8mw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Feb 2019 08:07:58 +0200 Message-Id: <20190206060818.13907-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> References: <20190206060818.13907-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/27] test: v4l2_device: Add StreamOn/StreamOff 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: Wed, 06 Feb 2019 06:08:26 -0000 From: Kieran Bingham Provide a small test to exercise the streamOn() and streamOff() calls. 8 buffers are requested locally. Signed-off-by: Kieran Bingham Signed-off-by: Jacopo Mondi Signed-off-by: Laurent Pinchart Signed-off-by: Niklas Söderlund --- test/v4l2_device/meson.build | 1 + test/v4l2_device/stream_on_off.cpp | 35 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 test/v4l2_device/stream_on_off.cpp diff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build index b6b672611d60..cbaa79da9b81 100644 --- a/test/v4l2_device/meson.build +++ b/test/v4l2_device/meson.build @@ -3,6 +3,7 @@ v4l2_device_tests = [ [ 'double_open', 'double_open.cpp' ], [ 'request_buffers', 'request_buffers.cpp' ], + [ 'stream_on_off', 'stream_on_off.cpp' ], ] foreach t : v4l2_device_tests diff --git a/test/v4l2_device/stream_on_off.cpp b/test/v4l2_device/stream_on_off.cpp new file mode 100644 index 000000000000..b564d2a2ab67 --- /dev/null +++ b/test/v4l2_device/stream_on_off.cpp @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * libcamera V4L2 API tests + */ + +#include "v4l2_device_test.h" + +class StreamOnStreamOffTest : public V4L2DeviceTest +{ +protected: + int run() + { + const unsigned int bufferCount = 8; + + createBuffers(bufferCount); + + int ret = dev_->exportBuffers(bufferCount, &pool_); + if (ret) + return TestFail; + + ret = dev_->streamOn(); + if (ret) + return TestFail; + + ret = dev_->streamOff(); + if (ret) + return TestFail; + + return TestPass; + } +}; + +TEST_REGISTER(StreamOnStreamOffTest);