[{"id":22473,"web_url":"https://patchwork.libcamera.org/comment/22473/","msgid":"<YkDvSa5H/lIfDLcX@pendragon.ideasonboard.com>","date":"2022-03-27T23:12:09","subject":"Re: [libcamera-devel] [PATCH v5 8/8] test: Test\n\tV4L2BufferCache::isEmpty() member function","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Mar 25, 2022 at 09:09:03AM +0000, Naushir Patuck via libcamera-devel wrote:\n> Add a test for V4L2BufferCache::isEmpty() for various levels for cache fullness.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nYou also have a R-b from Kieran on v4.\n\n> ---\n>  test/v4l2_videodevice/buffer_cache.cpp | 36 ++++++++++++++++++++++++++\n>  1 file changed, 36 insertions(+)\n> \n> diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp\n> index b3f2bec11783..5a9aa2199c50 100644\n> --- a/test/v4l2_videodevice/buffer_cache.cpp\n> +++ b/test/v4l2_videodevice/buffer_cache.cpp\n> @@ -126,6 +126,35 @@ public:\n>  \t\treturn TestPass;\n>  \t}\n>  \n> +\tint testIsEmpty(const std::vector<std::unique_ptr<FrameBuffer>> &buffers)\n> +\t{\n> +\t\tV4L2BufferCache cache(buffers.size());\n> +\n> +\t\tif (!cache.isEmpty())\n> +\t\t\treturn TestFail;\n> +\n> +\t\tfor (auto const &buffer : buffers) {\n> +\t\t\tFrameBuffer &b = *buffer.get();\n> +\t\t\tcache.get(b);\n> +\t\t}\n> +\n> +\t\tif (cache.isEmpty())\n> +\t\t\treturn TestFail;\n> +\n> +\t\tunsigned int i;\n> +\t\tfor (i = 0; i < buffers.size() - 1; i++)\n> +\t\t\tcache.put(i);\n> +\n> +\t\tif (cache.isEmpty())\n> +\t\t\treturn TestFail;\n> +\n> +\t\tcache.put(i);\n> +\t\tif (!cache.isEmpty())\n> +\t\t\treturn TestFail;\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +\n>  \tint init() override\n>  \t{\n>  \t\tstd::random_device rd;\n> @@ -204,6 +233,13 @@ public:\n>  \t\tif (testHot(&cacheHalf, buffers, numBuffers / 2) != TestPass)\n>  \t\t\treturn TestFail;\n>  \n> +\t\t/*\n> +\t\t * Test that the isEmpty function reports the correct result at\n> +\t\t * various levels of cache fullness.\n> +\t\t */\n> +\t\tif (testIsEmpty(buffers) != TestPass)\n> +\t\t\treturn TestFail;\n> +\n>  \t\treturn TestPass;\n>  \t}\n>","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 2F7B8C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 27 Mar 2022 23:12:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DAEB8600B0;\n\tMon, 28 Mar 2022 01:12:13 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 02858600B0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Mar 2022 01:12:12 +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 E04D72F7;\n\tMon, 28 Mar 2022 01:12:10 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648422733;\n\tbh=CbEF2c8k518qye426tNiVsPNQHQTtno35LqVTWFsBXo=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=NGxc4WJ3ql8sMYEWEN82D12NCQECs6/TGq9rYdioMlWgjHQqhzZZBLsKauLd1vfoT\n\tErzqRCIBsNs3UVCuRiyqkCl6eejQO7ycp7mhtw85UHuGYvTtzqEcitkQVUb5b0Hwo2\n\t8tFM1FZow9+U3UENBNSUHyhLj+6fpAkgJZXUYzmFLOnyd6PGvJaabZP28Cp9dkt8OB\n\t1idRtyz427PsUYlSutthRLlRFOR/rVr65QDPwhy9MX62n3qugqOEV1isHhHnOKprs8\n\tQRliYEWgmIE0ysSN5N2L3RvSQT9Tbz5Ntb8K05CAvfX7DGvudxI2suYixkWM0HEIBn\n\tySbYGGfvC+yTQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648422731;\n\tbh=CbEF2c8k518qye426tNiVsPNQHQTtno35LqVTWFsBXo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=bfZhIlp665v9Olsp08zVmhN1ITH3LcFh1mUTyWgMR8SFCgJePzh2EuQy+QyoO3kN9\n\tHEe3w4WydEpJ70vU0lg97bGH/xsnCNOGF/wmxtbx7KZrs9LrCpgEmiujp6pOguQ+90\n\tVHDzA3sHeCwGJeMuYPfv6aDeZj99YJ9ks5hUlVPw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"bfZhIlp6\"; dkim-atps=neutral","Date":"Mon, 28 Mar 2022 02:12:09 +0300","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YkDvSa5H/lIfDLcX@pendragon.ideasonboard.com>","References":"<20220325090903.880311-1-naush@raspberrypi.com>\n\t<20220325090903.880311-9-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220325090903.880311-9-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v5 8/8] test: Test\n\tV4L2BufferCache::isEmpty() member function","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]