[{"id":22357,"web_url":"https://patchwork.libcamera.org/comment/22357/","msgid":"<YjoqRcZB6e4tmbC+@pendragon.ideasonboard.com>","date":"2022-03-22T19:57:57","subject":"Re: [libcamera-devel] [PATCH v4 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 Tue, Mar 22, 2022 at 09:22:57AM +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\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 4D4ADC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 19:58:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B7D1A604C5;\n\tTue, 22 Mar 2022 20:58:16 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BA45B604C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 20:58:14 +0100 (CET)","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 3FE1BDFA;\n\tTue, 22 Mar 2022 20:58:14 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647979096;\n\tbh=Knz+IgRDnzQS7GoIK10VbQi1OiGab2v3RDNgEy6bTac=;\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=JKF7ong/wo7ynfkyS/2RQ4gcNlZLuGMVmJeoCZQnrSTTNO3RkwhNeBmvN/hddNXcT\n\t+OtEFQzG8MoB4Xq4RDOfLtL0Vsz89RoSaqM2HJswTYEPrFVSe79AYA01HWI4QnXktv\n\t0fIwP+4qSyUuCGQ8eWfH+WiztOTKwlhbyeRJwO3Hll8wKTyPvB+hufuAGFFIyATaII\n\tJ3B5LzwcFypdAow4P6ULcLzdFprdyP3v62RPhjJqme9CiinVNvvZomSLTSY0g3xmlR\n\tHkbGWEy65DRhT5yfMgzYgBNFOsNPMj5aQ7CDx9RfGeTL62Tsxf/rFSa89wyVOUxNzO\n\tX9FlCiEMng3Ag==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647979094;\n\tbh=Knz+IgRDnzQS7GoIK10VbQi1OiGab2v3RDNgEy6bTac=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=XC1+LXW7hbh6hpAHD9jE7QdVXe051Am770NQ/ncRhQdWECR2n7wagUPS9T+eeR0hA\n\titOuuEDFvM1972X9xMdkQ2VHpcCrSj8eh5JxVocuJZQMOY4iy9bPFiIQ13ggTBvebs\n\tiYDPdocRsG9J2pVJ2vHKg+DUCeM/ZC6x3+jMLqsU="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"XC1+LXW7\"; dkim-atps=neutral","Date":"Tue, 22 Mar 2022 21:57:57 +0200","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<YjoqRcZB6e4tmbC+@pendragon.ideasonboard.com>","References":"<20220322092257.2713521-1-naush@raspberrypi.com>\n\t<20220322092257.2713521-9-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220322092257.2713521-9-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v4 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>"}},{"id":22393,"web_url":"https://patchwork.libcamera.org/comment/22393/","msgid":"<164802959755.2130830.12252004979633689892@Monstersaurus>","date":"2022-03-23T09:59:57","subject":"Re: [libcamera-devel] [PATCH v4 8/8] test: Test\n\tV4L2BufferCache::isEmpty() member function","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck via libcamera-devel (2022-03-22 09:22:57)\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: Kieran Bingham <kieran.bingham@ideasonboard.com>\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>                 return TestPass;\n>         }\n>  \n> +       int testIsEmpty(const std::vector<std::unique_ptr<FrameBuffer>> &buffers)\n> +       {\n> +               V4L2BufferCache cache(buffers.size());\n> +\n> +               if (!cache.isEmpty())\n> +                       return TestFail;\n> +\n> +               for (auto const &buffer : buffers) {\n> +                       FrameBuffer &b = *buffer.get();\n> +                       cache.get(b);\n> +               }\n> +\n> +               if (cache.isEmpty())\n> +                       return TestFail;\n> +\n> +               unsigned int i;\n> +               for (i = 0; i < buffers.size() - 1; i++)\n> +                       cache.put(i);\n> +\n> +               if (cache.isEmpty())\n> +                       return TestFail;\n> +\n> +               cache.put(i);\n> +               if (!cache.isEmpty())\n> +                       return TestFail;\n> +\n> +               return TestPass;\n> +       }\n> +\n>         int init() override\n>         {\n>                 std::random_device rd;\n> @@ -204,6 +233,13 @@ public:\n>                 if (testHot(&cacheHalf, buffers, numBuffers / 2) != TestPass)\n>                         return TestFail;\n>  \n> +               /*\n> +                * Test that the isEmpty function reports the correct result at\n> +                * various levels of cache fullness.\n> +                */\n> +               if (testIsEmpty(buffers) != TestPass)\n> +                       return TestFail;\n> +\n>                 return TestPass;\n>         }\n>  \n> -- \n> 2.25.1\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 3895DBD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Mar 2022 10:00:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6B73601F8;\n\tWed, 23 Mar 2022 11:00:00 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AC2F601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Mar 2022 11:00:00 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD3689DE;\n\tWed, 23 Mar 2022 10:59:59 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648029600;\n\tbh=GGRX/YXK7BVmHFg2JJG2oGs9byR1HWPLdvpU1uBg5AU=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=dbpsvNORWmPakW1Rt/pSSd2X3tMxvBg0NeaB6fhWPNDgdPzhEt2+pY83kX+9u3zAq\n\tbLD0hsUZ0K4CYhaR1tMzyuuA7oOt3RXpfH37UeYYrS09sHHJS+jnWuXrYBoicHOI/l\n\tWCpYpQYwh6HhK3aznPCFrLsdwK0OBlmqm+H4WSUoJH1KJu35bPzSWt44LRDVPVh3X9\n\tH7g+XT2SDAzjoRJoeR2+0uKcT84H2wmFhCbQIZuYaENs42IiJCTc5o2wT4cjyieH9g\n\tyMiuet3qFRICtf/+Em+x8gqfiwT5Plbw3p0nbGkLX8a9Nw67EvfN2cWmOB0+llnsHM\n\tfZ8MyG/wjEs4A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1648029599;\n\tbh=GGRX/YXK7BVmHFg2JJG2oGs9byR1HWPLdvpU1uBg5AU=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=GBRJ9Gztedgb173/YqvALHPNPUXYJzaqjs7paVRfyDLuuHqOKQFPnurFzZRzdInlP\n\tMUpYGdnRdCdqLn8narBgrORrN8zdhR6whqg6sTiuUyRToqeFNy03xdQrqApX7ovmSn\n\tsRVllqN75gi2g4YPOKxhc5/cVTfD71VrqKSVCzKs="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GBRJ9Gzt\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20220322092257.2713521-9-naush@raspberrypi.com>","References":"<20220322092257.2713521-1-naush@raspberrypi.com>\n\t<20220322092257.2713521-9-naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 23 Mar 2022 09:59:57 +0000","Message-ID":"<164802959755.2130830.12252004979633689892@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v4 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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]