Show a patch.

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

{
    "id": 12557,
    "url": "https://patchwork.libcamera.org/api/patches/12557/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12557/",
    "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": "<20210610183732.174697-4-nfraprado@collabora.com>",
    "date": "2021-06-10T18:37:30",
    "name": "[libcamera-devel,v7,3/5] lc-compliance: Add Environment singleton",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2edff08e6eb7f80eff82f06a0ff853ad87519c6f",
    "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/12557/mbox/",
    "series": [
        {
            "id": 2119,
            "url": "https://patchwork.libcamera.org/api/series/2119/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2119",
            "date": "2021-06-10T18:37:27",
            "name": "lc-compliance: Refactor using Googletest",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2119/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12557/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12557/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 26911C320B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 18:38:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E729D6892C;\n\tThu, 10 Jun 2021 20:38:37 +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 1CAD86892C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 20:38:36 +0200 (CEST)",
            "from localhost.localdomain (unknown\n\t[IPv6:2804:14c:1a9:2978:fdf4:5e57:8aee:5d72])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: nfraprado)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5952F1F441F2;\n\tThu, 10 Jun 2021 19:38:34 +0100 (BST)"
        ],
        "From": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 10 Jun 2021 15:37:30 -0300",
        "Message-Id": "<20210610183732.174697-4-nfraprado@collabora.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210610183732.174697-1-nfraprado@collabora.com>",
        "References": "<20210610183732.174697-1-nfraprado@collabora.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 3/5] lc-compliance: Add Environment\n\tsingleton",
        "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": "Add a singleton Environment class in order to make the camera available\ninside all tests. This is needed for the Googletest refactor, otherwise\nthe tests, which are statically declared, won't be able to access the\ncamera.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nChanges in v7:\n- Thanks to Jacopo:\n  - Fixed style issue\n  - Made CameraManager a unique_ptr and passed to Environment as raw pointer\n\nChanges in v6:\n- Thanks to Niklas:\n  - Made cameraId() return const& \n\nChanges in v5:\n- Thanks to Laurent:\n  - Stored CameraManager and cameraId instead of Camera in Environment\n- Thanks to Laurent & Niklas:\n  - Improved Environment singleton class instantiation and destruction\n\nAdded in v4\n\n src/lc-compliance/environment.cpp | 20 ++++++++++++++++++++\n src/lc-compliance/environment.h   | 31 +++++++++++++++++++++++++++++++\n src/lc-compliance/meson.build     |  1 +\n 3 files changed, 52 insertions(+)\n create mode 100644 src/lc-compliance/environment.cpp\n create mode 100644 src/lc-compliance/environment.h",
    "diff": "diff --git a/src/lc-compliance/environment.cpp b/src/lc-compliance/environment.cpp\nnew file mode 100644\nindex 000000000000..3a539848362f\n--- /dev/null\n+++ b/src/lc-compliance/environment.cpp\n@@ -0,0 +1,20 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Collabora Ltd.\n+ *\n+ * environment.cpp - Common environment for tests\n+ */\n+\n+#include \"environment.h\"\n+\n+Environment *Environment::get()\n+{\n+\tstatic Environment instance;\n+\treturn &instance;\n+}\n+\n+void Environment::setup(CameraManager* cm, std::string cameraId)\n+{\n+\tcm_ = cm;\n+\tcameraId_ = cameraId;\n+}\ndiff --git a/src/lc-compliance/environment.h b/src/lc-compliance/environment.h\nnew file mode 100644\nindex 000000000000..614eb2777800\n--- /dev/null\n+++ b/src/lc-compliance/environment.h\n@@ -0,0 +1,31 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2021, Collabora Ltd.\n+ *\n+ * environment.h - Common environment for tests\n+ */\n+#ifndef __LC_COMPLIANCE_ENVIRONMENT_H__\n+#define __LC_COMPLIANCE_ENVIRONMENT_H__\n+\n+#include <libcamera/libcamera.h>\n+\n+using namespace libcamera;\n+\n+class Environment\n+{\n+public:\n+\tstatic Environment *get();\n+\n+\tvoid setup(CameraManager* cm, std::string cameraId);\n+\n+\tconst std::string &cameraId() const { return cameraId_; }\n+\tCameraManager* cm() const { return cm_; }\n+\n+private:\n+\tEnvironment() {};\n+\n+\tstd::string cameraId_;\n+\tCameraManager* cm_;\n+};\n+\n+#endif /* __LC_COMPLIANCE_ENVIRONMENT_H__ */\ndiff --git a/src/lc-compliance/meson.build b/src/lc-compliance/meson.build\nindex a2bfcceb1259..6dd49085569f 100644\n--- a/src/lc-compliance/meson.build\n+++ b/src/lc-compliance/meson.build\n@@ -12,6 +12,7 @@ lc_compliance_enabled = true\n lc_compliance_sources = files([\n     '../cam/event_loop.cpp',\n     '../cam/options.cpp',\n+    'environment.cpp',\n     'main.cpp',\n     'results.cpp',\n     'simple_capture.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "3/5"
    ]
}