[{"id":18464,"web_url":"https://patchwork.libcamera.org/comment/18464/","msgid":"<YQc01qBJW11W6PY+@pendragon.ideasonboard.com>","date":"2021-08-01T23:57:10","subject":"Re: [libcamera-devel] [PATCH v7 11/11] lc-compliance: Add test to\n\tensure MinimumRequests is valid","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nícolas,\n\nThank you for the patch.\n\nOn Thu, Jul 22, 2021 at 08:28:51PM -0300, Nícolas F. R. A. Prado wrote:\n> Add a test in lc-compliance to check that the MinimumRequests property\n> is set and valid, that is, greater than 0.\n> \n> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n> ---\n> \n> Added in v7\n> \n>  src/lc-compliance/capture_test.cpp | 27 +++++++++++++++++++++++++++\n>  1 file changed, 27 insertions(+)\n> \n> diff --git a/src/lc-compliance/capture_test.cpp b/src/lc-compliance/capture_test.cpp\n> index a7ba7448a21b..8d0da770e901 100644\n> --- a/src/lc-compliance/capture_test.cpp\n> +++ b/src/lc-compliance/capture_test.cpp\n> @@ -101,6 +101,23 @@ void RoleParametrizedTest::TearDown()\n>  \treleaseCamera();\n>  }\n>  \n> +class CameraTests : public ::testing::Test, public CameraHolder\n> +{\n> +protected:\n> +\tvoid SetUp() override;\n> +\tvoid TearDown() override;\n> +};\n> +\n> +void CameraTests::SetUp()\n> +{\n> +\tacquireCamera();\n> +}\n> +\n> +void CameraTests::TearDown()\n> +{\n> +\treleaseCamera();\n> +}\n\nThere are two  tests that only call acquireCamera() and releaseCamera()\nin SetUp() and TearDown(). It would be nice if this didn't have to be\nduplicated, but we can't make CameraHolder inherit from ::testing::Test\nas the other occurrence inherits from ::testing::TestWithParam. So be\nit.\n\n> +\n>  std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)\n>  {\n>  \treturn roleToString(std::get<0>(info.param)) + \"_\" +\n> @@ -187,6 +204,16 @@ TEST_P(RoleParametrizedTest, Overflow)\n>  \tcapture.capture();\n>  }\n>  \n> +TEST_F(CameraTests, RequiredProperties)\n> +{\n> +\tconst ControlList &properties = camera_->properties();\n> +\n> +\tusing namespace properties;\n> +\n> +\tEXPECT_GT(properties.get(MinimumRequests), 0)\n> +\t\t<< \"Camera should have a positive value for MinimumRequests property\";\n> +}\n\nThis isn't a capture test, should it go to a different file ? Maybe\nproperties.cpp or property_test.cpp ?\n\n> +\n>  INSTANTIATE_TEST_SUITE_P(CaptureTests,\n>  \t\t\t SingleStream,\n>  \t\t\t testing::Combine(testing::ValuesIn(ROLES),","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 6E84DBD878\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  1 Aug 2021 23:57:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D9003687BF;\n\tMon,  2 Aug 2021 01:57:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 559CC687BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  2 Aug 2021 01:57:20 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CCFBB87C;\n\tMon,  2 Aug 2021 01:57:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"quCX4qiS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1627862240;\n\tbh=n6JWx7QjEl2P0MAFyR3Sg/UCYGaIjlSOt1wrVilbm/U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=quCX4qiSpQCNKZSbEq7zGTxmuNaoJFTsn4pmgUvTtb2UFlBIusrBJnHW47thfmpEt\n\tAfnaIL6wU5WGfhJFHYodyZHPBm+QbJv7KT7QkIIG8s5cnxgyTVDpqTbRYH9voTAzjr\n\tvNwLy63ymt2+nspzoA1MfNYLuwu0y6VJkVMhfQsc=","Date":"Mon, 2 Aug 2021 02:57:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4=?= Prado <nfraprado@collabora.com>","Message-ID":"<YQc01qBJW11W6PY+@pendragon.ideasonboard.com>","References":"<20210722232851.747614-1-nfraprado@collabora.com>\n\t<20210722232851.747614-12-nfraprado@collabora.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210722232851.747614-12-nfraprado@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH v7 11/11] lc-compliance: Add test to\n\tensure MinimumRequests is valid","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>","Cc":"libcamera-devel@lists.libcamera.org, kernel@collabora.com, =?utf-8?q?A?=\n\t=?utf-8?b?bmRyw6k=?= Almeida <andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]