Patch Detail
Show a patch.
GET /api/patches/22954/?format=api
{ "id": 22954, "url": "https://patchwork.libcamera.org/api/patches/22954/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22954/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250314174220.1015597-3-barnabas.pocze@ideasonboard.com>", "date": "2025-03-14T17:42:19", "name": "[v4,2/2] apps: lc-compliance: Add multi-stream tests", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "fde934bfa164455d9a325b080ed7adf7addf242b", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22954/mbox/", "series": [ { "id": 5060, "url": "https://patchwork.libcamera.org/api/series/5060/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5060", "date": "2025-03-14T17:42:17", "name": "apps: lc-compliance: Multi-stream tests", "version": 4, "mbox": "https://patchwork.libcamera.org/series/5060/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22954/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22954/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 A4F07C32F7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Mar 2025 17:42:28 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6C3876894E;\n\tFri, 14 Mar 2025 18:42:27 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0CD006893D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Mar 2025 18:42:24 +0100 (CET)", "from pb-laptop.local (185.221.143.221.nat.pool.zt.hu\n\t[185.221.143.221])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8B05E606;\n\tFri, 14 Mar 2025 18:40:44 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"I/1HsQZn\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1741974044;\n\tbh=1weYbxU5k6xyXTY0Ba5pBjWh1xMH4FuDb95T3UFiXBU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=I/1HsQZnLZM+8gvGKVxWlYTgJ9LQHfTYPVGAXQ6RZALnRQnO7y/TaZmhqlZVcXdnH\n\t+0Ie+ZzdPDre/dB6N7IoMDRD6YwL3cfmJ1qBfQSGp3eXkkQS/Lr39JyLFgkHSn0GTd\n\tmAPe/qSV2Smf+pDi0gxmZJEcY1vvaKTZDPEpLRcc=", "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Paul Elder <paul.elder@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>", "Subject": "[PATCH v4 2/2] apps: lc-compliance: Add multi-stream tests", "Date": "Fri, 14 Mar 2025 18:42:19 +0100", "Message-ID": "<20250314174220.1015597-3-barnabas.pocze@ideasonboard.com>", "X-Mailer": "git-send-email 2.48.1", "In-Reply-To": "<20250314174220.1015597-1-barnabas.pocze@ideasonboard.com>", "References": "<20250314174220.1015597-1-barnabas.pocze@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Rename the `SingleStream` test to `SimpleCapture`, and extend it\nto support using multiple roles. And instantiate another test suite\nfrom the `SimpleCapture` test that tests multiple streams in one\ncapture session.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/apps/lc-compliance/tests/capture_test.cpp | 88 +++++++++++--------\n 1 file changed, 51 insertions(+), 37 deletions(-)", "diff": "diff --git a/src/apps/lc-compliance/tests/capture_test.cpp b/src/apps/lc-compliance/tests/capture_test.cpp\nindex 06f15bdb4..d02caa8a1 100644\n--- a/src/apps/lc-compliance/tests/capture_test.cpp\n+++ b/src/apps/lc-compliance/tests/capture_test.cpp\n@@ -8,7 +8,10 @@\n \n #include \"capture.h\"\n \n-#include <iostream>\n+#include <sstream>\n+#include <string>\n+#include <tuple>\n+#include <vector>\n \n #include <gtest/gtest.h>\n \n@@ -18,19 +21,10 @@ namespace {\n \n using namespace libcamera;\n \n-const int NUMREQUESTS[] = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };\n-\n-const StreamRole ROLES[] = {\n-\tStreamRole::Raw,\n-\tStreamRole::StillCapture,\n-\tStreamRole::VideoRecording,\n-\tStreamRole::Viewfinder\n-};\n-\n-class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>>\n+class SimpleCapture : public testing::TestWithParam<std::tuple<std::vector<StreamRole>, int>>\n {\n public:\n-\tstatic std::string nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info);\n+\tstatic std::string nameParameters(const testing::TestParamInfo<SimpleCapture::ParamType> &info);\n \n protected:\n \tvoid SetUp() override;\n@@ -43,7 +37,7 @@ protected:\n * We use gtest's SetUp() and TearDown() instead of constructor and destructor\n * in order to be able to assert on them.\n */\n-void SingleStream::SetUp()\n+void SimpleCapture::SetUp()\n {\n \tEnvironment *env = Environment::get();\n \n@@ -52,7 +46,7 @@ void SingleStream::SetUp()\n \tASSERT_EQ(camera_->acquire(), 0);\n }\n \n-void SingleStream::TearDown()\n+void SimpleCapture::TearDown()\n {\n \tif (!camera_)\n \t\treturn;\n@@ -61,19 +55,17 @@ void SingleStream::TearDown()\n \tcamera_.reset();\n }\n \n-std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)\n+std::string SimpleCapture::nameParameters(const testing::TestParamInfo<SimpleCapture::ParamType> &info)\n {\n-\tstd::map<StreamRole, std::string> rolesMap = {\n-\t\t{ StreamRole::Raw, \"Raw\" },\n-\t\t{ StreamRole::StillCapture, \"StillCapture\" },\n-\t\t{ StreamRole::VideoRecording, \"VideoRecording\" },\n-\t\t{ StreamRole::Viewfinder, \"Viewfinder\" }\n-\t};\n+\tconst auto &[roles, numRequests] = info.param;\n+\tstd::ostringstream ss;\n \n-\tstd::string roleName = rolesMap[std::get<0>(info.param)];\n-\tstd::string numRequestsName = std::to_string(std::get<1>(info.param));\n+\tfor (StreamRole r : roles)\n+\t\tss << r << '_';\n \n-\treturn roleName + \"_\" + numRequestsName;\n+\tss << '_' << numRequests;\n+\n+\treturn ss.str();\n }\n \n /*\n@@ -83,13 +75,13 @@ std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStre\n * failure is a camera that completes less requests than the number of requests\n * queued.\n */\n-TEST_P(SingleStream, Capture)\n+TEST_P(SimpleCapture, Capture)\n {\n-\tauto [role, numRequests] = GetParam();\n+\tconst auto &[roles, numRequests] = GetParam();\n \n \tCapture capture(camera_);\n \n-\tcapture.configure({ { role } });\n+\tcapture.configure(roles);\n \n \tcapture.run(numRequests, numRequests);\n }\n@@ -101,14 +93,14 @@ TEST_P(SingleStream, Capture)\n * a camera that does not clean up correctly in its error path but is only\n * tested by single-capture applications.\n */\n-TEST_P(SingleStream, CaptureStartStop)\n+TEST_P(SimpleCapture, CaptureStartStop)\n {\n-\tauto [role, numRequests] = GetParam();\n+\tconst auto &[roles, numRequests] = GetParam();\n \tunsigned int numRepeats = 3;\n \n \tCapture capture(camera_);\n \n-\tcapture.configure({ { role } });\n+\tcapture.configure(roles);\n \n \tfor (unsigned int starts = 0; starts < numRepeats; starts++)\n \t\tcapture.run(numRequests, numRequests);\n@@ -121,21 +113,43 @@ TEST_P(SingleStream, CaptureStartStop)\n * is a camera that does not handle cancelation of buffers coming back from the\n * video device while stopping.\n */\n-TEST_P(SingleStream, UnbalancedStop)\n+TEST_P(SimpleCapture, UnbalancedStop)\n {\n-\tauto [role, numRequests] = GetParam();\n+\tconst auto &[roles, numRequests] = GetParam();\n \n \tCapture capture(camera_);\n \n-\tcapture.configure({ { role } });\n+\tcapture.configure(roles);\n \n \tcapture.run(numRequests);\n }\n \n-INSTANTIATE_TEST_SUITE_P(CaptureTests,\n-\t\t\t SingleStream,\n-\t\t\t testing::Combine(testing::ValuesIn(ROLES),\n+const int NUMREQUESTS[] = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };\n+\n+const std::vector<StreamRole> SINGLEROLES[] = {\n+\t{ StreamRole::Raw, },\n+\t{ StreamRole::StillCapture, },\n+\t{ StreamRole::VideoRecording, },\n+\t{ StreamRole::Viewfinder, },\n+};\n+\n+const std::vector<StreamRole> MULTIROLES[] = {\n+\t{ StreamRole::Raw, StreamRole::StillCapture },\n+\t{ StreamRole::Raw, StreamRole::VideoRecording },\n+\t{ StreamRole::StillCapture, StreamRole::VideoRecording },\n+\t{ StreamRole::VideoRecording, StreamRole::VideoRecording },\n+};\n+\n+INSTANTIATE_TEST_SUITE_P(SingleStream,\n+\t\t\t SimpleCapture,\n+\t\t\t testing::Combine(testing::ValuesIn(SINGLEROLES),\n+\t\t\t\t\t testing::ValuesIn(NUMREQUESTS)),\n+\t\t\t SimpleCapture::nameParameters);\n+\n+INSTANTIATE_TEST_SUITE_P(MultiStream,\n+\t\t\t SimpleCapture,\n+\t\t\t testing::Combine(testing::ValuesIn(MULTIROLES),\n \t\t\t\t\t testing::ValuesIn(NUMREQUESTS)),\n-\t\t\t SingleStream::nameParameters);\n+\t\t\t SimpleCapture::nameParameters);\n \n } /* namespace */\n", "prefixes": [ "v4", "2/2" ] }