Patch Detail
Show a patch.
GET /api/patches/1787/?format=api
{ "id": 1787, "url": "https://patchwork.libcamera.org/api/patches/1787/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1787/", "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": "<20190812124642.24287-10-laurent.pinchart@ideasonboard.com>", "date": "2019-08-12T12:46:33", "name": "[libcamera-devel,09/18] test: Add Object class thread affinity test", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "2b4286176ebba78bc3c2802570b517bbb0bfe5c1", "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/1787/mbox/", "series": [ { "id": 455, "url": "https://patchwork.libcamera.org/api/series/455/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=455", "date": "2019-08-12T12:46:24", "name": "Object & Thread enhancements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/455/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1787/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1787/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 5327A61630\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:52 +0200 (CEST)", "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E0EE2124E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Aug 2019 14:46:51 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1565614012;\n\tbh=WJa+p8PRwFmv9fu9KCs0M+Vph6mf0XLI6ujdPy3yOxs=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=d25IRJ2WckX41Lxh7BlCnTkm9sr1B/ndc2h1K2x+3cBM+xTcDeLzNMFe4yaOwIRQK\n\t3oAr/MXJYTUSd6Ao2FeFGpvT2dkkY6WzXxrPux9DXcZRb4bpkBSHz6/q7+FkcqA14I\n\tLTcYL1+8UgiaxRtzz9BoKboVGP9yJgQE1uzkmIJ8=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 12 Aug 2019 15:46:33 +0300", "Message-Id": "<20190812124642.24287-10-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "References": "<20190812124642.24287-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 09/18] test: Add Object class thread\n\taffinity 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": "Mon, 12 Aug 2019 12:46:53 -0000" }, "content": "The test verifies thread affinity and thread move notifications.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/meson.build | 1 +\n test/object.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 89 insertions(+)\n create mode 100644 test/object.cpp", "diff": "diff --git a/test/meson.build b/test/meson.build\nindex 7c9abc630230..c6601813db78 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -24,6 +24,7 @@ public_tests = [\n internal_tests = [\n ['camera-sensor', 'camera-sensor.cpp'],\n ['message', 'message.cpp'],\n+ ['object', 'object.cpp'],\n ['object-invoke', 'object-invoke.cpp'],\n ['signal-threads', 'signal-threads.cpp'],\n ['threads', 'threads.cpp'],\ndiff --git a/test/object.cpp b/test/object.cpp\nnew file mode 100644\nindex 000000000000..3f1f700d1b39\n--- /dev/null\n+++ b/test/object.cpp\n@@ -0,0 +1,88 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * object.cpp - Object tests\n+ */\n+\n+#include <iostream>\n+\n+#include <libcamera/object.h>\n+\n+#include \"message.h\"\n+#include \"thread.h\"\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class InstrumentedObject : public Object\n+{\n+public:\n+\tenum Status {\n+\t\tNoMessage,\n+\t\tMessageReceived,\n+\t};\n+\n+\tInstrumentedObject()\n+\t\t: status_(NoMessage)\n+\t{\n+\t}\n+\n+\tStatus status() const { return status_; }\n+\tvoid reset() { status_ = NoMessage; }\n+\n+protected:\n+\tvoid message(Message *msg) override\n+\t{\n+\t\tif (msg->type() == Message::ThreadMoveMessage)\n+\t\t\tstatus_ = MessageReceived;\n+\n+\t\tObject::message(msg);\n+\t}\n+\n+private:\n+\tStatus status_;\n+};\n+\n+class ObjectTest : public Test\n+{\n+protected:\n+\tint init()\n+\t{\n+\t\ta_ = new InstrumentedObject();\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\t/* Verify that moving an object to a different thread succeeds. */\n+\t\ta_->moveToThread(&thread_);\n+\n+\t\tif (a_->thread() != &thread_ || a_->thread() == Thread::current()) {\n+\t\t\tcout << \"Failed to move object to thread\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Verify that objects receive a ThreadMoveMessage when moved. */\n+\t\tif (a_->status() != InstrumentedObject::MessageReceived) {\n+\t\t\tcout << \"Moving object didn't deliver ThreadMoveMessage\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup()\n+\t{\n+\t\tdelete a_;\n+\t}\n+\n+private:\n+\tInstrumentedObject *a_;\n+\n+\tThread thread_;\n+};\n+\n+TEST_REGISTER(ObjectTest)\n", "prefixes": [ "libcamera-devel", "09/18" ] }