Show a patch.

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

{
    "id": 345,
    "url": "https://patchwork.libcamera.org/api/patches/345/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/345/",
    "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": "<20190123085923.12524-2-laurent.pinchart@ideasonboard.com>",
    "date": "2019-01-23T08:59:20",
    "name": "[libcamera-devel,1/4] tests: Test event dispatcher interruption by signal",
    "commit_ref": "83c73c39c5c6b115fc80e6133433b70753499bab",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f33a6cffc716a83643b0d0a38fc5af734fb0ded9",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/345/mbox/",
    "series": [
        {
            "id": 120,
            "url": "https://patchwork.libcamera.org/api/series/120/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=120",
            "date": "2019-01-23T08:59:19",
            "name": "Event dispatcher enhancements",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/120/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/345/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/345/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F05B260B1B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 09:59:28 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 796A923E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 09:59:28 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548233968;\n\tbh=tOq3daofVJtoyVGMU7+wS2iGWp06621AVcof4maOSQ8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=gCBxu8TofLYIBHHjI4G/g2jqokow+hXe7M822+bxMilEEDzGhpRtBZYe9qieUKVzq\n\tCQMc66QmzTJ+tWB0VS/JY+Wk+MWBbWNkSYNCoE2pm695JPueQ88tfHx7vTEILL5ygV\n\t+CUsFhpKrsu1xPSB0Ez2t1nriLuUIrxHC++pg5IA=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 23 Jan 2019 10:59:20 +0200",
        "Message-Id": "<20190123085923.12524-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "In-Reply-To": "<20190123085923.12524-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20190123085923.12524-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 1/4] tests: Test event dispatcher\n\tinterruption by signal",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Wed, 23 Jan 2019 08:59:29 -0000"
    },
    "content": "Add a test to verify that the event dispatcher correctly restarts event\nprocessing when interrupted by a signal. The test currently fails as\nthis feature isn't implemented.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/event-dispatcher.cpp | 73 +++++++++++++++++++++++++++++++++++++++\n test/meson.build          |  9 ++---\n 2 files changed, 78 insertions(+), 4 deletions(-)\n create mode 100644 test/event-dispatcher.cpp",
    "diff": "diff --git a/test/event-dispatcher.cpp b/test/event-dispatcher.cpp\nnew file mode 100644\nindex 000000000000..06c2657f09d6\n--- /dev/null\n+++ b/test/event-dispatcher.cpp\n@@ -0,0 +1,73 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * event-dispatcher.cpp - Event dispatcher test\n+ */\n+\n+#include <iostream>\n+#include <signal.h>\n+#include <sys/time.h>\n+\n+#include <libcamera/camera_manager.h>\n+#include <libcamera/event_dispatcher.h>\n+#include <libcamera/timer.h>\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class EventDispatcherTest : public Test\n+{\n+protected:\n+\tstatic void sigAlarmHandler(int)\n+\t{\n+\t\tcout << \"SIGALARM received\" << endl;\n+\t}\n+\n+\tint init()\n+\t{\n+\t\tstruct sigaction sa = {};\n+\t\tsa.sa_handler = &sigAlarmHandler;\n+\t\tsigaction(SIGALRM, &sa, nullptr);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\tEventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();\n+\t\tTimer timer;\n+\n+\t\t/* Event processing interruption by signal. */\n+\t\tstruct timespec start;\n+\t\tclock_gettime(CLOCK_MONOTONIC, &start);\n+\n+\t\ttimer.start(1000);\n+\n+\t\tstruct itimerval itimer = {};\n+\t\titimer.it_value.tv_usec = 500000;\n+\t\tsetitimer(ITIMER_REAL, &itimer, nullptr);\n+\n+\t\tdispatcher->processEvents();\n+\n+\t\tstruct timespec stop;\n+\t\tclock_gettime(CLOCK_MONOTONIC, &stop);\n+\t\tint duration = (stop.tv_sec - start.tv_sec) * 1000;\n+\t\tduration += (stop.tv_nsec - start.tv_nsec) / 1000000;\n+\n+\t\tif (abs(duration - 1000) > 50) {\n+\t\t\tcout << \"Event processing restart test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup()\n+\t{\n+\t}\n+};\n+\n+TEST_REGISTER(EventDispatcherTest)\ndiff --git a/test/meson.build b/test/meson.build\nindex 8cdcae2c9e87..d515a716207e 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -5,10 +5,11 @@ subdir('pipeline')\n subdir('v4l2_device')\n \n public_tests = [\n-    ['event',           'event.cpp'],\n-    ['list-cameras',    'list-cameras.cpp'],\n-    ['signal',          'signal.cpp'],\n-    ['timer',           'timer.cpp'],\n+    ['event',                           'event.cpp'],\n+    ['event-dispatcher',                'event-dispatcher.cpp'],\n+    ['list-cameras',                    'list-cameras.cpp'],\n+    ['signal',                          'signal.cpp'],\n+    ['timer',                           'timer.cpp'],\n ]\n \n internal_tests = [\n",
    "prefixes": [
        "libcamera-devel",
        "1/4"
    ]
}