From patchwork Sun Feb 3 11:00:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 494 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 64C4260DBE for ; Sun, 3 Feb 2019 12:01:08 +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 10112D4A; Sun, 3 Feb 2019 12:01:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1549191668; bh=h61nRg17APg4PX1uEULMKb1XlohppBJguIjPC9z7EbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCvMKPKcqZnm9ztPcX3fjNUJOLU8PRk8l5KKLqatRx/RlK2u0eMvqz1mUIS2iFWH2 kkmUIACsPNDIObo6z9dkKDDHli+S+AhlJ/f0W/mvonZ90uYWRngjiSj7D7GqlE8aDx MF27y120wZ/ehFkxLXyQ/fXMJvxJHHULBGQxT5GE= From: Kieran Bingham To: LibCamera Devel Date: Sun, 3 Feb 2019 12:00:58 +0100 Message-Id: <20190203110102.5663-8-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 07/11] 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: Sun, 03 Feb 2019 11:01:10 -0000 Provide a small test to exercise the streamOn() and streamOff() calls. 8 buffers are requested locally. Signed-off-by: Kieran Bingham --- test/v4l2_device/meson.build | 1 + test/v4l2_device/stream_on_off.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 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..9f1937b66aae --- /dev/null +++ b/test/v4l2_device/stream_on_off.cpp @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * libcamera V4L2 API tests + */ + +#include "v4l2_device_test.h" + +class StreamOnStreamOff : public V4L2DeviceTest +{ +protected: + int run() + { + int ret; + + BufferPool *pool = dev_->requestBuffers(8); + if (!pool) + return TestFail; + + ret = dev_->streamOn(); + if (ret) + return ret; + + return dev_->streamOff(); + } +}; + +TEST_REGISTER(StreamOnStreamOff);