Show a patch.

GET /api/patches/22576/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 22576,
    "url": "https://patchwork.libcamera.org/api/patches/22576/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22576/",
    "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": "<20250114182143.1773762-16-pobrn@protonmail.com>",
    "date": "2025-01-14T18:23:00",
    "name": "[RFC,v2,15/16] apps: lc-compliance: Add multi-stream tests",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "293331d415afc0df329476f845b5d6cd93d24c08",
    "submitter": {
        "id": 133,
        "url": "https://patchwork.libcamera.org/api/people/133/?format=api",
        "name": "Pőcze Barnabás",
        "email": "pobrn@protonmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22576/mbox/",
    "series": [
        {
            "id": 4951,
            "url": "https://patchwork.libcamera.org/api/series/4951/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4951",
            "date": "2025-01-14T18:21:46",
            "name": "apps: lc-compliance: Multi-stream tests",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4951/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22576/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22576/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 3C609C3304\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jan 2025 18:23:07 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF51468556;\n\tTue, 14 Jan 2025 19:23:06 +0100 (CET)",
            "from mail-4316.protonmail.ch (mail-4316.protonmail.ch\n\t[185.70.43.16])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4DB9768556\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jan 2025 19:23:05 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"DtnysL+o\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1736878984; x=1737138184;\n\tbh=nbqBgzGncn5KaKwNqAT9+CCuXrHBvoA3i5chd4mG0iA=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=DtnysL+oNxwE6zVZLeZiaS+V6M12/ttJxB8aYMqbYigLxPhJ3oCMQXqJMjmTqnpmg\n\tFb/8lOghZF1fxwPMToFVQYDjeoacPIrUIRftEmjoLdhoiZ4Et6es8R7L1Ov/GaRTKH\n\tn5C9ugwUohWGubBPKBuHym37gREX/LwXVYBWn73MWJ81RGe5m3xBHlo4DMdZNrqemv\n\tLie1SwHHlpD6zGhn9LrrJ7KKyDcoGYBPt1doyx0+Bn1DTpitIM7K88qi8O+6NxtJi5\n\t0alnp8FHgVfFYOTdLQdQAUAO0pAzlhoW8ncJ/QuDHUJq7I465V5IRp/d4Kzz6ZzhmA\n\ttvFZZCUa3R4vA==",
        "Date": "Tue, 14 Jan 2025 18:23:00 +0000",
        "To": "libcamera-devel@lists.libcamera.org",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Subject": "[RFC PATCH v2 15/16] apps: lc-compliance: Add multi-stream tests",
        "Message-ID": "<20250114182143.1773762-16-pobrn@protonmail.com>",
        "In-Reply-To": "<20250114182143.1773762-1-pobrn@protonmail.com>",
        "References": "<20250114182143.1773762-1-pobrn@protonmail.com>",
        "Feedback-ID": "20568564:user:proton",
        "X-Pm-Message-ID": "79f0e69d04502e961355423dc1d53b4274f5ce8c",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=utf-8",
        "Content-Transfer-Encoding": "quoted-printable",
        "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\nCo-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/apps/lc-compliance/tests/capture_test.cpp | 85 +++++++++++--------\n 1 file changed, 48 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 147e17019..db1d52fc9 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,7 @@\n \n #include \"capture.h\"\n \n-#include <iostream>\n+#include <sstream>\n \n #include <gtest/gtest.h>\n \n@@ -18,19 +18,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 +34,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 +43,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 +52,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 std::move(ss).str();\n }\n \n /*\n@@ -83,13 +72,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(std::array{ role });\n+\tcapture.configure(roles);\n \n \tcapture.run(numRequests, numRequests);\n }\n@@ -101,14 +90,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(std::array{ role });\n+\tcapture.configure(roles);\n \n \tfor (unsigned int starts = 0; starts < numRepeats; starts++)\n \t\tcapture.run(numRequests, numRequests);\n@@ -121,21 +110,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(std::array{ 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": [
        "RFC",
        "v2",
        "15/16"
    ]
}