{"id":15505,"url":"https://patchwork.libcamera.org/api/patches/15505/?format=json","web_url":"https://patchwork.libcamera.org/patch/15505/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220322092257.2713521-9-naush@raspberrypi.com>","date":"2022-03-22T09:22:57","name":"[libcamera-devel,v4,8/8] test: Test V4L2BufferCache::isEmpty() member function","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e0f63f089491ffe1b999d276a932da112e94ddce","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15505/mbox/","series":[{"id":2982,"url":"https://patchwork.libcamera.org/api/series/2982/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2982","date":"2022-03-22T09:22:49","name":"Raspberry Pi: Efficient start/stop/start sequences","version":4,"mbox":"https://patchwork.libcamera.org/series/2982/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15505/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15505/checks/","tags":{},"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 69263BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Mar 2022 09:23:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27882632F0;\n\tTue, 22 Mar 2022 10:23:11 +0100 (CET)","from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C14A5604DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 10:23:06 +0100 (CET)","by mail-wm1-x329.google.com with SMTP id n35so8367024wms.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Mar 2022 02:23:06 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:9e9a:99af:e5a6:319b])\n\tby smtp.gmail.com with ESMTPSA id\n\tr14-20020a05600c35ce00b0038c9f469979sm1471695wmq.40.2022.03.22.02.23.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Mar 2022 02:23:05 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647940991;\n\tbh=hLTmYuojHMjmtUh8gzJl2+HUWdtodTUsIN7+OUJacFM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=e/fvcaecdHJY15LFVKu6kgE3mVD7/Rujxv5cDyoF0iP6kI1DfPc+jQsMZ/XfSLgzX\n\tADzhOoe+ndg7t62Bg3dKpsuITIbwpC3Qx0E7uJeU+r2lk7riY6THXpdc+fy7/KAM1L\n\trk3QepZ7BNfqc1jKYgn0u4gzHp80OCvg5h59xu1mQ5u5tRdFWr0+kcAKID12MQ0egN\n\tO8KGg5lty67hLRw1w8PnMO1Z/nfuNH0H06KmbErO9uxRpVDOLuN0Snn1SHIFYwkPZL\n\tQQ9OcNw3FwkB7f7iOPj1xKPsqCG4PwoMvRnyMghvuZ8uj2Ye7mZdwfWvi/yxkLBoZj\n\tSG3nj8TOG8nRg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=QSeLD6l2fNDLnVAXmscZh+AApyC398AN3impDShO8DQ=;\n\tb=Xp7b1x7GnKst9uEYrj3xbJDYbjz1Cdznm6NkuXWJxSuN/jSyaEfJ20tDhoqbcENMA5\n\t7otLVfqVq9PqM7NoQY6yHQ2EMm3KueboxcaEX1uCClsgrRGXq4eew/csvTMRdmVtICUK\n\t8VRpWSxK7sIsvowiUKmXQux2ZOTfFH05kht/aC0Cl8Z9Vq5WqhOhNaAR9qEOZRSHgEVd\n\tsHIL6J8czYQL4Hr08XopijiyLkv7UBoEALGmpVi+v4B9427zt/xVyUCLl9dIkJKqA62q\n\tq9pnjd4omJcGL8U5OCxc22Cp5nQzV1w87/bXXexaar1P9eOo1+3EtVEqnFkr+Lie+J04\n\tJhhw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Xp7b1x7G\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=QSeLD6l2fNDLnVAXmscZh+AApyC398AN3impDShO8DQ=;\n\tb=wO00jxC4Da3Tyvm7rP4qE6jL5iZce7+QXDdFD6QdpmKFnNzNN3rHLGOsPjHO7l+VhO\n\t3s2h/fWqePk0YEK2fUoMWVsX98EYzZH5O20aJM8od/QKOyLcx6qJYkpaOrKI7vZGGVDE\n\tLou+08IhJPlxQqZYXVJx37kIEMTFIathf87a1JDwpv2x5mz75+s7pKuzGnbQI7D/A6Z1\n\tVc9X189A8PxMTz7x5hRUGbFC82OKfZMTN76Pzy9HjW1gwdl5DXNb9osoj62hYfq6kFP2\n\t1/DsV8bOXqfoRxmn6BhDFKf3r75CaCPSPBuTHlyI29+YqbAfka422lviRi/S033exqUE\n\tPwhA==","X-Gm-Message-State":"AOAM5323AoxppaDKYOcWLTfDbgnfnhbs/qq1GBQF6iF+XZ2a3Jobo5ph\n\tah7scMTL3wxcayE1y+c7v8r0zC0LNYh+SA==","X-Google-Smtp-Source":"ABdhPJwawlTTYlCx6mMKDygpnEkz1frbt86sGt0TPLGvrVm2xh994jNuov7caEhMnyPKT1I2Sp/zlQ==","X-Received":"by 2002:adf:fd4d:0:b0:204:ec5:bd62 with SMTP id\n\th13-20020adffd4d000000b002040ec5bd62mr7911223wrs.403.1647940986263; \n\tTue, 22 Mar 2022 02:23:06 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Mar 2022 09:22:57 +0000","Message-Id":"<20220322092257.2713521-9-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220322092257.2713521-1-naush@raspberrypi.com>","References":"<20220322092257.2713521-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a test for V4L2BufferCache::isEmpty() for various levels for cache fullness.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n test/v4l2_videodevice/buffer_cache.cpp | 36 ++++++++++++++++++++++++++\n 1 file changed, 36 insertions(+)","diff":"diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp\nindex 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 \n","prefixes":["libcamera-devel","v4","8/8"]}