Patch Detail
Show a patch.
GET /api/1.1/patches/348/?format=api
{ "id": 348, "url": "https://patchwork.libcamera.org/api/1.1/patches/348/?format=api", "web_url": "https://patchwork.libcamera.org/patch/348/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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-5-laurent.pinchart@ideasonboard.com>", "date": "2019-01-23T08:59:23", "name": "[libcamera-devel,4/4] tests: event-dispatcher: Add processEvents() interruption test", "commit_ref": "eb1ecc92ce2fac649f7cbaecd58be29d23602713", "pull_url": null, "state": "accepted", "archived": false, "hash": "959c2579162096bf6333ed673d3b1c353f7d5ba4", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/348/mbox/", "series": [ { "id": 120, "url": "https://patchwork.libcamera.org/api/1.1/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/348/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/348/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@ideasonboard.com>", "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8089E60C7F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 09:59:30 +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 C3A3223F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 09:59:29 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1548233970;\n\tbh=KDgVquP+m6F7TWbHW2iZPAwE3pqrPt/LzxLNzahKTwQ=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=amwSUgqILAXzXhYRyvC58ji3pRZFs9smD+BwrxNGxa+BKYAARTlsTnli6Fi3G9GiT\n\t9Yu8GGBEVpiWASGq5vWBLPWOpDC1l4fa2spzx4IkPqgJWSWO7IPnJBMqmypdLA1sfZ\n\tbx8dV/KqqksZiRdz3AlBxyaaR4piKpfduRr5a/t8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 23 Jan 2019 10:59:23 +0200", "Message-Id": "<20190123085923.12524-5-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 4/4] tests: event-dispatcher: Add\n\tprocessEvents() interruption test", "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:30 -0000" }, "content": "Test that the EventDispatcher::interrupt() function correctly interrupts\nthe processEvents() function, both when called before processEvents()\nand when called while it is running.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/event-dispatcher.cpp | 32 +++++++++++++++++++++++++++++++-\n 1 file changed, 31 insertions(+), 1 deletion(-)", "diff": "diff --git a/test/event-dispatcher.cpp b/test/event-dispatcher.cpp\nindex 06c2657f09d6..e8818dcab4ad 100644\n--- a/test/event-dispatcher.cpp\n+++ b/test/event-dispatcher.cpp\n@@ -18,16 +18,23 @@\n using namespace std;\n using namespace libcamera;\n \n+static EventDispatcher *dispatcher;\n+static bool interrupt;\n+\n class EventDispatcherTest : public Test\n {\n protected:\n \tstatic void sigAlarmHandler(int)\n \t{\n \t\tcout << \"SIGALARM received\" << endl;\n+\t\tif (interrupt)\n+\t\t\tdispatcher->interrupt();\n \t}\n \n \tint init()\n \t{\n+\t\tdispatcher = CameraManager::instance()->eventDispatcher();\n+\n \t\tstruct sigaction sa = {};\n \t\tsa.sa_handler = &sigAlarmHandler;\n \t\tsigaction(SIGALRM, &sa, nullptr);\n@@ -37,7 +44,6 @@ protected:\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@@ -48,6 +54,7 @@ protected:\n \n \t\tstruct itimerval itimer = {};\n \t\titimer.it_value.tv_usec = 500000;\n+\t\tinterrupt = false;\n \t\tsetitimer(ITIMER_REAL, &itimer, nullptr);\n \n \t\tdispatcher->processEvents();\n@@ -62,6 +69,29 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\t/* Event processing interruption. */\n+\t\ttimer.start(1000);\n+\t\tdispatcher->interrupt();\n+\n+\t\tdispatcher->processEvents();\n+\n+\t\tif (!timer.isRunning()) {\n+\t\t\tcout << \"Event processing immediate interruption failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\ttimer.start(1000);\n+\t\titimer.it_value.tv_usec = 500000;\n+\t\tinterrupt = true;\n+\t\tsetitimer(ITIMER_REAL, &itimer, nullptr);\n+\n+\t\tdispatcher->processEvents();\n+\n+\t\tif (!timer.isRunning()) {\n+\t\t\tcout << \"Event processing delayed interruption failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n \n", "prefixes": [ "libcamera-devel", "4/4" ] }