Show a patch.

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

{
    "id": 2080,
    "url": "https://patchwork.libcamera.org/api/patches/2080/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2080/",
    "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": "<20191003152037.74617-5-jacopo@jmondi.org>",
    "date": "2019-10-03T15:20:36",
    "name": "[libcamera-devel,4/5] test: ipa: Add test for the IPA Interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7816a24d04868551cb7740847d9d48f5d2572f9c",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2080/mbox/",
    "series": [
        {
            "id": 515,
            "url": "https://patchwork.libcamera.org/api/series/515/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=515",
            "date": "2019-10-03T15:20:32",
            "name": "test: Add IPA interface test support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/515/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2080/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2080/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<jacopo@jmondi.org>",
        "Received": [
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3766760BE9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 17:19:06 +0200 (CEST)",
            "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C22CFC000B;\n\tThu,  3 Oct 2019 15:19:05 +0000 (UTC)"
        ],
        "X-Originating-IP": "2.224.242.101",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  3 Oct 2019 17:20:36 +0200",
        "Message-Id": "<20191003152037.74617-5-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191003152037.74617-1-jacopo@jmondi.org>",
        "References": "<20191003152037.74617-1-jacopo@jmondi.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 4/5] test: ipa: Add test for the IPA\n\tInterface",
        "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>",
        "X-List-Received-Date": "Thu, 03 Oct 2019 15:19:06 -0000"
    },
    "content": "Implementing a basic test for IPA Interface using the VIMC dummy IPA\nmodule. The test implements a communication channel between the test and\nthe dummy IPA module to verify the success of the IPA interactions.\n\nTest the only available operation defined by the IPA interface by\nreceiving a confirmation code on the fifo communication channel.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/ipa/ipa_interface_test.cpp | 147 ++++++++++++++++++++++++++++++++\n test/ipa/meson.build            |   3 +-\n 2 files changed, 149 insertions(+), 1 deletion(-)\n create mode 100644 test/ipa/ipa_interface_test.cpp",
    "diff": "diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp\nnew file mode 100644\nindex 000000000000..83eef7440fa4\n--- /dev/null\n+++ b/test/ipa/ipa_interface_test.cpp\n@@ -0,0 +1,147 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * ipa_interface_test.cpp - Test the IPA interface communication using the VIMC\n+ *\t\t\t    dummy IPA module\n+ */\n+\n+#include <iostream>\n+\n+#include <fcntl.h>\n+#include <string.h>\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\n+\n+#include <libcamera/event_dispatcher.h>\n+#include <libcamera/event_notifier.h>\n+#include <libcamera/timer.h>\n+\n+#include \"ipa_module.h\"\n+\n+#include \"test.h\"\n+#include \"thread.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+/* Keep with in sync with the VIMC IPA module. */\n+static const char *ipaFifoPath = \"/tmp/vimc_ipa_fifo\";\n+#define IPA_INIT_CODE 0x01\n+\n+static const char *vimcModulePath = \"src/ipa/ipa_vimc.so\";\n+\n+class IPAInterfaceTest : public Test, public Object\n+{\n+public:\n+\tIPAInterfaceTest()\n+\t\t: fd_(0), data_(0)\n+\t{\n+\t}\n+\n+\t~IPAInterfaceTest()\n+\t{\n+\t\t/*\n+\t\t * Delete the IPA Interface instance -before- deleting the\n+\t\t * module used to create it, as the IPAModule destructor closes\n+\t\t * the IPA shared object, resulting in segfault at interface\n+\t\t * deletion time.\n+\t\t */\n+\t\tIPAInterface *ipa = ipa_.release();\n+\t\tdelete ipa;\n+\n+\t\tif (ipaModule_)\n+\t\t\tdelete ipaModule_;\n+\n+\t\tdelete notifier_;\n+\t}\n+\n+protected:\n+\tint init() override\n+\t{\n+\t\tint ret = mkfifo(ipaFifoPath, S_IRUSR | S_IWUSR);\n+\t\tif (ret) {\n+\t\t\tcerr << \"Failed to create IPA test fifo at: \"\n+\t\t\t     << ipaFifoPath << \": \" << strerror(errno) << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tret = open(ipaFifoPath, O_RDONLY | O_NONBLOCK);\n+\t\tif (ret < 0) {\n+\t\t\tcerr << \"Failed to open IPA test fifo at: \"\n+\t\t\t     << ipaFifoPath << \": \" << strerror(errno) << endl;\n+\t\t\tunlink(ipaFifoPath);\n+\t\t\treturn TestFail;\n+\t\t}\n+\t\tfd_ = ret;\n+\n+\t\tnotifier_ = new EventNotifier(fd_, EventNotifier::Read, this);\n+\t\tnotifier_->activated.connect(this, &IPAInterfaceTest::readFifo);\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tEventDispatcher *dispatcher = thread()->eventDispatcher();\n+\t\tTimer timer;\n+\n+\t\tipaModule_ = new IPAModule(vimcModulePath);\n+\t\tif (!ipaModule_ || !ipaModule_->isValid()) {\n+\t\t\tcerr << \"Failed to create VIMC IPA module at: \"\n+\t\t\t     << vimcModulePath << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!ipaModule_->load()) {\n+\t\t\tcerr << \"Failed to load VIMC IPA module\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tipa_ = ipaModule_->createInstance();\n+\t\tif (!ipa_) {\n+\t\t\tcerr << \"Failed to create VIMC IPA interface\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test initialization of IPA module. */\n+\t\tipa_->init();\n+\t\ttimer.start(1000);\n+\t\twhile (timer.isRunning() && data_ != IPA_INIT_CODE)\n+\t\t\tdispatcher->processEvents();\n+\n+\t\tif (data_ != IPA_INIT_CODE) {\n+\t\t\tcerr << \"Failed to test IPA initialization sequence\"\n+\t\t\t     << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup() override\n+\t{\n+\t\tclose(fd_);\n+\t\tunlink(ipaFifoPath);\n+\t}\n+\n+private:\n+\tvoid readFifo(EventNotifier *notifier)\n+\t{\n+\t\tsize_t s = read(notifier->fd(), &data_, 1);\n+\t\tif (s < 0) {\n+\t\t\tcerr << \"Failed to to read from IPA test fifo at: \"\n+\t\t\t     << ipaFifoPath << strerror(errno) << endl;\n+\t\t\tdata_ = -1;\n+\t\t}\n+\t}\n+\n+\tstd::unique_ptr<IPAInterface> ipa_;\n+\tEventNotifier *notifier_;\n+\tIPAModule *ipaModule_;\n+\tunsigned int fd_;\n+\tint8_t data_;\n+};\n+\n+TEST_REGISTER(IPAInterfaceTest)\ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nindex e174671d05e1..c501fcf99aed 100644\n--- a/test/ipa/meson.build\n+++ b/test/ipa/meson.build\n@@ -1,5 +1,6 @@\n ipa_test = [\n-    ['ipa_module_test', 'ipa_module_test.cpp'],\n+    ['ipa_module_test',     'ipa_module_test.cpp'],\n+    ['ipa_interface_test',  'ipa_interface_test.cpp'],\n ]\n \n foreach t : ipa_test\n",
    "prefixes": [
        "libcamera-devel",
        "4/5"
    ]
}