Patch Detail
Show a patch.
GET /api/patches/1204/?format=api
{ "id": 1204, "url": "https://patchwork.libcamera.org/api/patches/1204/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1204/", "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": "<20190514223808.27351-2-paul.elder@ideasonboard.com>", "date": "2019-05-14T22:38:08", "name": "[libcamera-devel,v2,2/2] tests: ipa: add tests to test IPAModule", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "1e147f45649ecbaca6e42394e01b26c2279edbe8", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/1204/mbox/", "series": [ { "id": 305, "url": "https://patchwork.libcamera.org/api/series/305/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=305", "date": "2019-05-14T22:38:07", "name": "[libcamera-devel,v2,1/2] libcamera: ipa_module: add IPA shared library loader", "version": 2, "mbox": "https://patchwork.libcamera.org/series/305/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1204/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1204/checks/", "tags": {}, "headers": { "Return-Path": "<paul.elder@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 0DEFD60E4C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 May 2019 00:38:22 +0200 (CEST)", "from localhost.localdomain (unknown [96.44.9.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 56F891953;\n\tWed, 15 May 2019 00:38:21 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1557873501;\n\tbh=bmwMP7ZBZbb0t9wKzhuwuT4VTKbmg/80cCUD3ce93q4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UBBzaIT3a2jHzUzj55Ov9ouyGtKip4GhTyvVCTKpZ2mAChUxN15PGc4F5dJ+tyylk\n\tUc2mmzmN7Pfa5mE9Ny9dU4yBn88g+PGQ5JuriHY3p84BjybbvIdEFvDTaPjzx6XnKQ\n\tFat4IESBMtiLq3gCs/OMZRu5dMjGy8gfj3k7QDRI=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 14 May 2019 18:38:08 -0400", "Message-Id": "<20190514223808.27351-2-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190514223808.27351-1-paul.elder@ideasonboard.com>", "References": "<20190514223808.27351-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 2/2] tests: ipa: add tests to test\n\tIPAModule", "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": "Tue, 14 May 2019 22:38:22 -0000" }, "content": "Add tests to test the the IPAModule class for loading struct\nIPAModuleInfo of a given symbol from a .so library.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nChanges in v2:\n- added source for test .so\n- updated tests to work with new (v2, see 1/2) IPAModule API\n\n test/ipa/ipa_test.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++\n test/ipa/meson.build | 23 +++++++++++++\n test/ipa/shared_test.c | 16 +++++++++\n test/meson.build | 1 +\n 4 files changed, 116 insertions(+)\n create mode 100644 test/ipa/ipa_test.cpp\n create mode 100644 test/ipa/meson.build\n create mode 100644 test/ipa/shared_test.c", "diff": "diff --git a/test/ipa/ipa_test.cpp b/test/ipa/ipa_test.cpp\nnew file mode 100644\nindex 0000000..96849bf\n--- /dev/null\n+++ b/test/ipa/ipa_test.cpp\n@@ -0,0 +1,76 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * load-so.cpp - loading .so tests\n+ */\n+\n+#include <iostream>\n+\n+#include \"ipa_module.h\"\n+\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class IPAModuleTest : public Test\n+{\n+protected:\n+\tint init()\n+\t{\n+\t\treturn 0;\n+\t}\n+\n+\tint run_test(const string path, const string symbol)\n+\t{\n+\t\tcout << \"running lib loader test\" << endl;\n+\n+\t\tIPAModule *ll = new IPAModule(path, symbol);\n+\n+\t\tif (!ll->isValid()) {\n+\t\t\tcout << \"failed to load\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tstruct IPAModuleInfo info = ll->IPAModuleInfo();\n+\t\tcout << \"loaded!\" << endl;\n+\t\tcout << \"name = \" << info.name << \", version = \" << info.version << endl;\n+\n+\t\tdelete ll;\n+\t\treturn TestPass;\n+\t}\n+\n+\tint run()\n+\t{\n+\t\tint count = 0;\n+\n+\t\tcout << endl\n+\t\t << \"testing 32-bit so from .data\" << endl;\n+\t\tcount += run_test(\"test/ipa/libfoo.32.so\", \"asdf\");\n+\n+\t\tcout << endl\n+\t\t << \"testing 32-bit so from .rodata\" << endl;\n+\t\tcount += run_test(\"test/ipa/libfoo.32.so\", \"hjkl\");\n+\n+\t\tcout << endl\n+\t\t << \"testing 64-bit so from .data\" << endl;\n+\t\tcount += run_test(\"test/ipa/libfoo.64.so\", \"asdf\");\n+\n+\t\tcout << endl\n+\t\t << \"testing 64-bit so from .rodata\" << endl;\n+\t\tcount += run_test(\"test/ipa/libfoo.64.so\", \"hjkl\");\n+\n+\t\t/* Two of these should fail due to bitness mismatch. */\n+\t\tif (count < -2)\n+\t\t\treturn TestFail;\n+\n+\t\treturn TestPass;\n+\t}\n+\n+\tvoid cleanup()\n+\t{\n+\t}\n+};\n+\n+TEST_REGISTER(IPAModuleTest)\ndiff --git a/test/ipa/meson.build b/test/ipa/meson.build\nnew file mode 100644\nindex 0000000..994d9ef\n--- /dev/null\n+++ b/test/ipa/meson.build\n@@ -0,0 +1,23 @@\n+ipa_test = [\n+ ['ipa_test',\t 'ipa_test.cpp'],\n+]\n+\n+foreach t : ipa_test\n+ exe = executable(t[0], t[1],\n+ link_with : test_libraries,\n+ include_directories : test_includes_internal)\n+\n+ test(t[0], exe, suite: 'ipa', is_parallel: false)\n+endforeach\n+\n+libfoo_sources = files([\n+ 'shared_test.c'\n+])\n+\n+libfoo_32 = shared_library('foo.32',\n+\t\t\t libfoo_sources,\n+\t\t\t c_args: '-m32',\n+\t\t\t link_args: '-m32')\n+\n+libfoo_64 = shared_library('foo.64',\n+\t\t\t libfoo_sources)\ndiff --git a/test/ipa/shared_test.c b/test/ipa/shared_test.c\nnew file mode 100644\nindex 0000000..67acfa4\n--- /dev/null\n+++ b/test/ipa/shared_test.c\n@@ -0,0 +1,16 @@\n+#include <stdio.h>\n+\n+struct IPAModuleInfo {\n+\tconst char name[256];\n+\tunsigned int version;\n+};\n+\n+const struct IPAModuleInfo hjkl = {\n+\t.name = \"Answer to the Ultimate Question of Life, the Universe, and Everything\",\n+\t.version = 42,\n+};\n+\n+struct IPAModuleInfo asdf = {\n+\t.name = \"It's over nine thousand!\",\n+\t.version = 9001,\n+};\ndiff --git a/test/meson.build b/test/meson.build\nindex d501f2b..ef41367 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -1,6 +1,7 @@\n subdir('libtest')\n \n subdir('camera')\n+subdir('ipa')\n subdir('media_device')\n subdir('pipeline')\n subdir('v4l2_device')\n", "prefixes": [ "libcamera-devel", "v2", "2/2" ] }