{"id":15549,"url":"https://patchwork.libcamera.org/api/1.1/patches/15549/?format=json","web_url":"https://patchwork.libcamera.org/patch/15549/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20220325090903.880311-9-naush@raspberrypi.com>","date":"2022-03-25T09:09:03","name":"[libcamera-devel,v5,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/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15549/mbox/","series":[{"id":2999,"url":"https://patchwork.libcamera.org/api/1.1/series/2999/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2999","date":"2022-03-25T09:08:55","name":"Raspberry Pi: Efficient start/stop/start sequences","version":5,"mbox":"https://patchwork.libcamera.org/series/2999/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15549/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15549/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 C8ACBC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 25 Mar 2022 09:09:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8490C604E9;\n\tFri, 25 Mar 2022 10:09:17 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 28D3E604E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 10:09:14 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id w4so9927216wrg.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Mar 2022 02:09:14 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:478c:773f:4734:d0bc])\n\tby smtp.gmail.com with ESMTPSA id\n\tc4-20020a056000184400b0020584c40778sm4915297wri.103.2022.03.25.02.09.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 25 Mar 2022 02:09:12 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1648199357;\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=dRrg0afGS0zbHW53ZDWFltI7E5l68zl2i86eHYSX9+8vLWLycVO5W3NwfFvQmDpVM\n\tIA1kFjspLk9MqZUE2kbQeNa1jF4D1P1tj8gG1xyDcn1sBrpADKL5ffbIkhjpK6IdXB\n\ta++QojN8ILk2Lx2SpHwx4KCDwEFEeFqHhhfb0jITzsMvseuvVOAbt0X+9FUk7o1zy5\n\tJHxlCRqNx/EwP6qs9/uFpc9mYdaCdfO+6klF/oWZj9Mm0LND4qTkH0x5DtuD72f95w\n\tT7pJmGwLI1L1IDmWwIh83bAQEdXDCtoozKUMVPQ7lCSIG3hdGmL8A1KwkZ4r7o9xmH\n\tDU8WT4O0wZ+ww==","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=CF3bepqCgGaH6okHE4GGcGrwEz2kWjKKWt3M/VJ8/7M/UHbH5rT90nlR1W3ffI+uof\n\te+2daqUkmlqkb6L3wC8L/x6Q8WfWhrc2eaKXH5ybsKWPCMmmdl0mhGzJjz98KsPDQDrw\n\tEgrHzUPRtulSWAAYp7zSnfKFzRV4Uk0yy8Zk7Y3VEn43FGkFTpHNSuL1Kib6RZFt2sjJ\n\t19Tm1WLl46Ix1KK8ppAvgpzC+LvZ6FowUGmOJvYqUUyR84ttb69GsBN/ey9IMkxXjxMD\n\tPaUuwPExNLZ1vBCDk2Su8pUfC8q8dLVLy9nJwqcVKY/CLH08p2QAsRN7wSGGLal5AmQu\n\teSHw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"CF3bepqC\"; 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=TxQk3vb3Y7Y2tunSF+gpkYN1Gq2tTmyfBRQ1txdyLDzU+A99XYmATJEjliMk0zQ4HQ\n\ttDGWRG3IcRbKlSpc0Qbn3sx+ghDRI50s0DK8DCCZHTNEFLrSQ4TXXIpUhFQxKnJEv0Il\n\tRk03DFHic6kQp7sAY3YTsGTFn4hX2SHl0nTQPN0ndBoWiMh1H0GyLnMKl7+LTOyAi32U\n\to41vt07eorArgvuvMuJDVWfRPtHe8vuldFCpcXyDCAt7aeRycwjX7rsdvXTEmZ7mSJTk\n\t46x8T5Oh6VIGO2SjCyPJcNGgjV3eNgsGQ3DNZl0SOnQsDIbJ58MJ37wuKcjCCgESk3dP\n\tRdlg==","X-Gm-Message-State":"AOAM532FnIpNcny4GE3IJ6WdSfzH1VFVp3C8R7dq6j8meOv7quKa042k\n\tC8FaoJ1J+gK0GhGrQwHEx43gU8Yncu/ETw==","X-Google-Smtp-Source":"ABdhPJzKOXn/jCfLdbJNJOPcGT+16MTXA8KFe6DdU9UpEYe6ksSUvTS5w5qBUupCkyYLI0hfe23xqw==","X-Received":"by 2002:a5d:5406:0:b0:205:a2c2:3530 with SMTP id\n\tg6-20020a5d5406000000b00205a2c23530mr2587361wrv.587.1648199353696; \n\tFri, 25 Mar 2022 02:09:13 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 25 Mar 2022 09:09:03 +0000","Message-Id":"<20220325090903.880311-9-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220325090903.880311-1-naush@raspberrypi.com>","References":"<20220325090903.880311-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[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":"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","v5","8/8"]}