Show a patch.

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

{
    "id": 13475,
    "url": "https://patchwork.libcamera.org/api/patches/13475/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/13475/",
    "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": "<20210824195636.1110845-14-nfraprado@collabora.com>",
    "date": "2021-08-24T19:56:32",
    "name": "[libcamera-devel,v8,13/17] lc-compliance: Move camera setup to CameraHolder class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0932334311fe34e428f93e5e1b1ba7d42694ea8f",
    "submitter": {
        "id": 84,
        "url": "https://patchwork.libcamera.org/api/people/84/?format=api",
        "name": "Nícolas F. R. A. Prado",
        "email": "nfraprado@collabora.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/13475/mbox/",
    "series": [
        {
            "id": 2389,
            "url": "https://patchwork.libcamera.org/api/series/2389/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2389",
            "date": "2021-08-24T19:56:19",
            "name": "lc-compliance: Add test to queue more requests than hardware depth",
            "version": 8,
            "mbox": "https://patchwork.libcamera.org/series/2389/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/13475/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/13475/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 86255C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Aug 2021 19:58:18 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 63DA668909;\n\tTue, 24 Aug 2021 21:57:43 +0200 (CEST)",
            "from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 59B1A688A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Aug 2021 21:57:41 +0200 (CEST)",
            "from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nfraprado) with ESMTPSA id EDCAD1F43379"
        ],
        "From": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 24 Aug 2021 16:56:32 -0300",
        "Message-Id": "<20210824195636.1110845-14-nfraprado@collabora.com>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20210824195636.1110845-1-nfraprado@collabora.com>",
        "References": "<20210824195636.1110845-1-nfraprado@collabora.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v8 13/17] lc-compliance: Move camera setup\n\tto CameraHolder class",
        "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>",
        "Cc": "kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Different base classes can be used for different setups on tests, but\nall of them will need to setup the camera for the test. To reuse that\ncode, move it to a separate CameraHolder class that is inherited by test\nclasses.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\n\nChanges in v8:\n- Moved CameraHolder to new test_base.{cpp,h} files\n\nChanges in v5:\n- New\n\n src/lc-compliance/capture_test.cpp | 18 ++++--------------\n src/lc-compliance/meson.build      |  1 +\n src/lc-compliance/test_base.cpp    | 28 ++++++++++++++++++++++++++++\n src/lc-compliance/test_base.h      | 24 ++++++++++++++++++++++++\n 4 files changed, 57 insertions(+), 14 deletions(-)\n create mode 100644 src/lc-compliance/test_base.cpp\n create mode 100644 src/lc-compliance/test_base.h",
    "diff": "diff --git a/src/lc-compliance/capture_test.cpp b/src/lc-compliance/capture_test.cpp\nindex 6439cbd88f8e..49012048729e 100644\n--- a/src/lc-compliance/capture_test.cpp\n+++ b/src/lc-compliance/capture_test.cpp\n@@ -10,15 +10,15 @@\n \n #include <gtest/gtest.h>\n \n-#include \"environment.h\"\n #include \"simple_capture.h\"\n+#include \"test_base.h\"\n \n using namespace libcamera;\n \n const std::vector<int> NUMREQUESTS = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };\n const std::vector<StreamRole> ROLES = { Raw, StillCapture, VideoRecording, Viewfinder };\n \n-class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>>\n+class SingleStream : public testing::TestWithParam<std::tuple<StreamRole, int>>, public CameraHolder\n {\n public:\n \tstatic std::string nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info);\n@@ -26,8 +26,6 @@ public:\n protected:\n \tvoid SetUp() override;\n \tvoid TearDown() override;\n-\n-\tstd::shared_ptr<Camera> camera_;\n };\n \n /*\n@@ -36,20 +34,12 @@ protected:\n  */\n void SingleStream::SetUp()\n {\n-\tEnvironment *env = Environment::get();\n-\n-\tcamera_ = env->cm()->get(env->cameraId());\n-\n-\tASSERT_EQ(camera_->acquire(), 0);\n+\tacquireCamera();\n }\n \n void SingleStream::TearDown()\n {\n-\tif (!camera_)\n-\t\treturn;\n-\n-\tcamera_->release();\n-\tcamera_.reset();\n+\treleaseCamera();\n }\n \n std::string SingleStream::nameParameters(const testing::TestParamInfo<SingleStream::ParamType> &info)\ndiff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build\nindex 4be14b694426..db593a6ec201 100644\n--- a/src/lc-compliance/meson.build\n+++ b/src/lc-compliance/meson.build\n@@ -17,6 +17,7 @@ lc_compliance_sources = files([\n     'environment.cpp',\n     'main.cpp',\n     'simple_capture.cpp',\n+    'test_base.cpp',\n ])\n \n lc_compliance  = executable('lc-compliance', lc_compliance_sources,\ndiff --git a/src/lc-compliance/test_base.cpp b/src/lc-compliance/test_base.cpp\nnew file mode 100644\nindex 000000000000..c9957b9efd36\n--- /dev/null\n+++ b/src/lc-compliance/test_base.cpp\n@@ -0,0 +1,28 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Collabora Ltd.\n+ *\n+ * test_base.cpp - Base definitions for tests\n+ */\n+\n+#include \"test_base.h\"\n+\n+#include \"environment.h\"\n+\n+void CameraHolder::acquireCamera()\n+{\n+\tEnvironment *env = Environment::get();\n+\n+\tcamera_ = env->cm()->get(env->cameraId());\n+\n+\tASSERT_EQ(camera_->acquire(), 0);\n+}\n+\n+void CameraHolder::releaseCamera()\n+{\n+\tif (!camera_)\n+\t\treturn;\n+\n+\tcamera_->release();\n+\tcamera_.reset();\n+}\ndiff --git a/src/lc-compliance/test_base.h b/src/lc-compliance/test_base.h\nnew file mode 100644\nindex 000000000000..52347749ab10\n--- /dev/null\n+++ b/src/lc-compliance/test_base.h\n@@ -0,0 +1,24 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Collabora Ltd.\n+ *\n+ * test_base.h - Base definitions for tests\n+ */\n+\n+#ifndef __LC_COMPLIANCE_TEST_BASE_H__\n+#define __LC_COMPLIANCE_TEST_BASE_H__\n+\n+#include <libcamera/libcamera.h>\n+\n+#include <gtest/gtest.h>\n+\n+class CameraHolder\n+{\n+protected:\n+\tvoid acquireCamera();\n+\tvoid releaseCamera();\n+\n+\tstd::shared_ptr<libcamera::Camera> camera_;\n+};\n+\n+#endif /* __LC_COMPLIANCE_TEST_BASE_H__ */\n",
    "prefixes": [
        "libcamera-devel",
        "v8",
        "13/17"
    ]
}