[{"id":4446,"web_url":"https://patchwork.libcamera.org/comment/4446/","msgid":"<20200414215656.GQ19819@pendragon.ideasonboard.com>","date":"2020-04-14T21:56:56","subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nThank you for the patch.\n\nOn Tue, Apr 14, 2020 at 07:06:59AM +0000, Umang Jain wrote:\n> Failing the test guards against negative index (-ENOENT in this case)\n> being passed to V4L2BufferCache::put().\n\nCan this happens in practice ?\n\n> Pointed out by Coverity DefectId=279090\n> \n> Signed-off-by: Umang Jain <email@uajain.com>\n> ---\n>  test/v4l2_videodevice/buffer_cache.cpp | 5 +++++\n>  1 file changed, 5 insertions(+)\n> \n> diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp\n> index d730e75..1870249 100644\n> --- a/test/v4l2_videodevice/buffer_cache.cpp\n> +++ b/test/v4l2_videodevice/buffer_cache.cpp\n> @@ -90,6 +90,11 @@ public:\n>  \t\t/* Pick a hot buffer at random and store its index. */\n>  \t\tint hotBuffer = dist(generator_);\n>  \t\tint hotIndex = cache->get(*buffers[hotBuffer].get());\n> +\t\tif (hotIndex < 0) {\n> +\t\t\tstd::cout << \"Failed lookup from cache\" << std::endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n>  \t\tcache->put(hotIndex);\n>  \n>  \t\t/*","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1262860405\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Apr 2020 23:57:09 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C53F521;\n\tTue, 14 Apr 2020 23:57:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"AOgiTYmC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1586901428;\n\tbh=JmdVjGmPtqsDXPok04r1rU1NxW8F56G4D9k/c7sy0ss=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AOgiTYmC5qlgtIK8a3Ma5maICg61fR7nh8VpvWogwuEs2xsmA+OZAgDae//+HcdGl\n\tFQoDr91bnymCQ5T8q4Yw/kx8TgxoggKaYpSZ5tY2auWlMEmdJVv3sxkstoXwzaYdQE\n\tdcz4xXq8X8Y5mWkkUNW2xVycve0yW3TH/s1EQGh8=","Date":"Wed, 15 Apr 2020 00:56:56 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200414215656.GQ19819@pendragon.ideasonboard.com>","References":"<20200414070642.22366-1-email@uajain.com>\n\t<20200414070642.22366-4-email@uajain.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200414070642.22366-4-email@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","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>","X-List-Received-Date":"Tue, 14 Apr 2020 21:57:09 -0000"}},{"id":4450,"web_url":"https://patchwork.libcamera.org/comment/4450/","msgid":"<DG7T8Q.U81V8L3286OT2@uajain.com>","date":"2020-04-15T03:09:57","subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/","name":"Umang Jain","email":"email@uajain.com"},"content":"Hi Laurent,\n\nOn Wed, Apr 15, 2020 at 00:56, Laurent Pinchart \n<laurent.pinchart@ideasonboard.com> wrote:\n> Hi Umang,\n> \n> Thank you for the patch.\n> \n> On Tue, Apr 14, 2020 at 07:06:59AM +0000, Umang Jain wrote:\n>>  Failing the test guards against negative index (-ENOENT in this \n>> case)\n>>  being passed to V4L2BufferCache::put().\n> \n> Can this happens in practice ?\n\nWell, V4L2BufferCache::put() accepts only unsigned int argument, so I \nwould say, it won't happen in practice.\nStill the patches seems correct to me but commit message should be \ntweaked, is that right?","headers":{"Return-Path":"<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>","Received":["from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6871A60401\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Apr 2020 05:09:59 +0200 (CEST)","by filterdrecv-p3iad2-8ddf98858-szfkb with SMTP id\n\tfilterdrecv-p3iad2-8ddf98858-szfkb-20-5E967B05-27\n\t2020-04-15 03:09:57.722723083 +0000 UTC m=+1735346.539846708","from mail.uajain.com (unknown)\n\tby ismtpd0001p1maa1.sendgrid.net (SG) with ESMTP\n\tid rREN9-tiSvWBwBApKQsvFw Wed, 15 Apr 2020 03:09:57.016 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"vA/VeF8j\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:content-type;\n\ts=s1; bh=bt224yFx+qC5g72nkjeBPrPeO2PEsVhV/seNkg6hHy8=;\n\tb=vA/VeF8jYilKIXHcqJwT4x0qRerz02HgvwzLBIbzakqDly2Ljkxv7jT4iobHTLD52frN\n\tcl3TX+ks0iBP878hVtELri63Z+iJRu6bPRnP3ptXGNGbq2FIiSyR2Wp3XyIfDQhAwipRme\n\tg8HLKamN0tdm3gv6v2EKmsk3sk6j1pKK8=","Date":"Wed, 15 Apr 2020 03:09:57 +0000 (UTC)","From":"Umang Jain <email@uajain.com>","Message-Id":"<DG7T8Q.U81V8L3286OT2@uajain.com>","In-Reply-To":"<20200414215656.GQ19819@pendragon.ideasonboard.com>","References":"<20200414070642.22366-1-email@uajain.com>\n\t<20200414070642.22366-4-email@uajain.com>\n\t<20200414215656.GQ19819@pendragon.ideasonboard.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcIgOyDPOiX995eQdp4XFd3P/IZ0CfXocVLk6OkW9BGYjEiFIQrNmPOcRw++5bfiuPOS1VqgudQDv2OLHgwucbaXTnluWpp1em8C3PXUdUhimPyUF+sqmC6lK/6iRgq/+tEg61Dw0Jdl+7m5DjagmnOxZEKH2CmOlXRLdEw6y10FqUdxWWbW9SuqT5t+01mwdizhW4cMPP2dLWzTly5QtO1Q==","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"multipart/alternative; boundary=\"=-JxisjiMyZUiWh9cSEOmZ\"","Subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","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>","X-List-Received-Date":"Wed, 15 Apr 2020 03:10:00 -0000"}},{"id":4451,"web_url":"https://patchwork.libcamera.org/comment/4451/","msgid":"<75fe9ded-d2d9-4f99-3b68-e56d63d66ae0@ideasonboard.com>","date":"2020-04-15T12:56:05","subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent, Umang\n\nOn 15/04/2020 04:09, Umang Jain wrote:\n> \n> Hi Laurent,\n> \n> On Wed, Apr 15, 2020 at 00:56, Laurent Pinchart\n> <laurent.pinchart@ideasonboard.com> wrote:\n>> Hi Umang, Thank you for the patch. On Tue, Apr 14, 2020 at 07:06:59AM\n>> +0000, Umang Jain wrote:\n>>\n>>     Failing the test guards against negative index (-ENOENT in this\n>>     case) being passed to V4L2BufferCache::put(). \n>>\n>> Can this happens in practice ?\n\nThis is code which /tests/ library code.\n\nTesting things that shouldn't necessarily happen in practice is part of\nthat right? So that when someone changes V4L2BufferCache and breaks\nsomething - the tests should fire a failure?\n\nIn other words, shouldn't test be written defensively?\n\nI don't think this can happen in practice with the *current*\nimplementation, but that's the point - the implementation could change.\n\nIf we didn't ever expect to change implementations - then we don't need\nto keep any tests around at all :-)\n\n\n> Well, V4L2BufferCache::put() accepts only unsigned int argument, so I\n> would say, it won't happen in practice.\n> Still the patches seems correct to me but commit message should be\n> tweaked, is that right?\n\nSo in this instance, the ASSERT() will fire, and bail out on\nV4L2BufferCache::put() ... but the unexpected fault (which should have\nfailed the test) is in the get() ... ?\n\nMy point is - I would add this check in ..\nLaurent - are you suggesting we shouldn't?\n\n\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\n>","headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["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 DA52C60404\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Apr 2020 14:56:09 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2DD252D1;\n\tWed, 15 Apr 2020 14:56:09 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ZNVb74iS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1586955369;\n\tbh=hzCnHk1u01eq/ykmeem4+/gybWsiJS7M63nQKhEUI+M=;\n\th=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=ZNVb74iSfb6laMADkTVIKRGiPejO4T4Hgqi1Trb7dnfws06KOwBaFkQJo+qYHmBrL\n\t+oIdxCxmSPNCJR3zbuhW1V+73KyFNiQEO/+yQRFPW0Z1pY7uYbEaZcmuD1CbqIpO+I\n\tMKXs37tF28/5v1HNt1yds0MyoUpQI0B7mWnEuzjI=","Reply-To":"kieran.bingham@ideasonboard.com","To":"Umang Jain <email@uajain.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20200414070642.22366-1-email@uajain.com>\n\t<20200414070642.22366-4-email@uajain.com>\n\t<20200414215656.GQ19819@pendragon.ideasonboard.com>\n\t<DG7T8Q.U81V8L3286OT2@uajain.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Openpgp":"preference=signencrypt","Autocrypt":"addr=kieran.bingham@ideasonboard.com; keydata=\n\tmQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat\n\tV/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC\n\trRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO95ewJGgLm+idg1Kb3C\n\tpotzWkXc1xmPzcQ1fvQMOfMwdS+4SNw4rY9f07Xb2K99rjMwZVDgESKIzhsDB5GY465sCsiQ\n\tcSAZRxqE49RTBq2+EQsbrQpIc8XiffAB8qexh5/QPzCmR4kJgCGeHIXBtgRj+nIkCJPZvZtf\n\tKr2EAbc6tgg6DkAEHJb+1okosV09+0+TXywYvtEop/WUOWQ+zo+Y/OBd+8Ptgt1pDRyOBzL8\n\tRXa8ZqRf0Mwg75D+dKntZeJHzPRJyrlfQokngAAs4PaFt6UfS+ypMAF37T6CeDArQC41V3ko\n\tlPn1yMsVD0p+6i3DPvA/GPIksDC4owjnzVX9kM8Zc5Cx+XoAN0w5Eqo4t6qEVbuettxx55gq\n\t8K8FieAjgjMSxngo/HST8TpFeqI5nVeq0/lqtBRQKumuIq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O/sx\n\tS0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j\n\tsbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8\n\tpQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc\n\tMW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU\n\tAfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4\n\tWZw01QYHU/GUV/zHJSFk","Organization":"Ideas on Board","Message-ID":"<75fe9ded-d2d9-4f99-3b68-e56d63d66ae0@ideasonboard.com>","Date":"Wed, 15 Apr 2020 13:56:05 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101\n\tThunderbird/60.9.1","MIME-Version":"1.0","In-Reply-To":"<DG7T8Q.U81V8L3286OT2@uajain.com>","Content-Type":"text/plain; charset=windows-1252","Content-Language":"en-GB","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","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>","X-List-Received-Date":"Wed, 15 Apr 2020 12:56:10 -0000"}},{"id":4452,"web_url":"https://patchwork.libcamera.org/comment/4452/","msgid":"<20200415141219.GE4758@pendragon.ideasonboard.com>","date":"2020-04-15T14:12:19","subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Umang,\n\nOn Wed, Apr 15, 2020 at 03:09:57AM +0000, Umang Jain wrote:\n> On Wed, Apr 15, 2020 at 00:56, Laurent Pinchart wrote:\n> > On Tue, Apr 14, 2020 at 07:06:59AM +0000, Umang Jain wrote:\n> >> Failing the test guards against negative index (-ENOENT in this case)\n> >> being passed to V4L2BufferCache::put().\n> > \n> > Can this happens in practice ?\n> \n> Well, V4L2BufferCache::put() accepts only unsigned int argument, so I \n> would say, it won't happen in practice.\n> Still the patches seems correct to me but commit message should be \n> tweaked, is that right?\n\nWhat I mean is, given how we use V4L2BufferCache in this test, can get()\nreturn a negative value here ?","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 88A1260404\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Apr 2020 16:12:31 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E4C082D1;\n\tWed, 15 Apr 2020 16:12:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"AfcglsBH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1586959951;\n\tbh=fH+s1e8HMNtVj/yV1IYEY0kaGHwhlrnQZWxZ2n3ILNs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AfcglsBHFiyUI+j8GLQR1hsDE4WfuRWtT/F/YTRVqYVTd+SOaTPSPOR4BZ8b82yZv\n\tP95uU72NGHV1qskbJqnoKW6zB2BQqX/ZAxOt31dRwDNT0BKDj2Trq+2ZepnjT0f15F\n\t9tpIHcTc+/bN8hUIj9lmuIZfJ0gqUsWI3qDF83nY=","Date":"Wed, 15 Apr 2020 17:12:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Umang Jain <email@uajain.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200415141219.GE4758@pendragon.ideasonboard.com>","References":"<20200414070642.22366-1-email@uajain.com>\n\t<20200414070642.22366-4-email@uajain.com>\n\t<20200414215656.GQ19819@pendragon.ideasonboard.com>\n\t<DG7T8Q.U81V8L3286OT2@uajain.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<DG7T8Q.U81V8L3286OT2@uajain.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","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>","X-List-Received-Date":"Wed, 15 Apr 2020 14:12:31 -0000"}},{"id":4453,"web_url":"https://patchwork.libcamera.org/comment/4453/","msgid":"<20200415141510.GF4758@pendragon.ideasonboard.com>","date":"2020-04-15T14:15:10","subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Wed, Apr 15, 2020 at 01:56:05PM +0100, Kieran Bingham wrote:\n> On 15/04/2020 04:09, Umang Jain wrote:\n> > On Wed, Apr 15, 2020 at 00:56, Laurent Pinchart wrote:\n> >> Hi Umang, Thank you for the patch. On Tue, Apr 14, 2020 at 07:06:59AM\n> >> +0000, Umang Jain wrote:\n> >>\n> >> Failing the test guards against negative index (-ENOENT in this\n> >> case) being passed to V4L2BufferCache::put(). \n> >>\n> >> Can this happens in practice ?\n> \n> This is code which /tests/ library code.\n> \n> Testing things that shouldn't necessarily happen in practice is part of\n> that right? So that when someone changes V4L2BufferCache and breaks\n> something - the tests should fire a failure?\n\nBut is this particular test testing that, or is it already caught by a\ndifferent test ? Each of the test cases cover a part of the API, I was\nwondering if for this particular test such a check was needed. The\nanswer may be yes, I haven't read the code.\n\n> In other words, shouldn't test be written defensively?\n> \n> I don't think this can happen in practice with the *current*\n> implementation, but that's the point - the implementation could change.\n> \n> If we didn't ever expect to change implementations - then we don't need\n> to keep any tests around at all :-)\n> \n> > Well, V4L2BufferCache::put() accepts only unsigned int argument, so I\n> > would say, it won't happen in practice.\n> > Still the patches seems correct to me but commit message should be\n> > tweaked, is that right?\n> \n> So in this instance, the ASSERT() will fire, and bail out on\n> V4L2BufferCache::put() ... but the unexpected fault (which should have\n> failed the test) is in the get() ... ?\n> \n> My point is - I would add this check in ..\n> Laurent - are you suggesting we shouldn't?","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["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 4B2E960404\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Apr 2020 16:15:22 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C7A622D1;\n\tWed, 15 Apr 2020 16:15:21 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"B785Uk0v\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1586960122;\n\tbh=J515hxBYkXUDHcvH5c368z1c8tFZdGI6nrAHehOH5ko=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=B785Uk0vtHGI897Obj8J6ym3fQzc8GBuzf65+0cHLwvcblRY8ph/4gwe+6xE47yLs\n\t6mYXUHmqQq7dm6je4XXIxpWhcsjwmnPIwKoxMcAiTWC4dTCQ1k3wxcufJ27LqiQeo3\n\tASwcLG0uQ2TXrEU77UVsf6e9gkiQUbldp4dRcUec=","Date":"Wed, 15 Apr 2020 17:15:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Umang Jain <email@uajain.com>, libcamera-devel@lists.libcamera.org","Message-ID":"<20200415141510.GF4758@pendragon.ideasonboard.com>","References":"<20200414070642.22366-1-email@uajain.com>\n\t<20200414070642.22366-4-email@uajain.com>\n\t<20200414215656.GQ19819@pendragon.ideasonboard.com>\n\t<DG7T8Q.U81V8L3286OT2@uajain.com>\n\t<75fe9ded-d2d9-4f99-3b68-e56d63d66ae0@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<75fe9ded-d2d9-4f99-3b68-e56d63d66ae0@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice:\n\tbuffer_cache: Fail the test if no buffer from cache is obtained","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>","X-List-Received-Date":"Wed, 15 Apr 2020 14:15:22 -0000"}}]