Patch Detail
Show a patch.
GET /api/patches/732/?format=api
{ "id": 732, "url": "https://patchwork.libcamera.org/api/patches/732/?format=api", "web_url": "https://patchwork.libcamera.org/patch/732/", "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": "<20190313010532.28960-3-niklas.soderlund@ragnatech.se>", "date": "2019-03-13T01:05:30", "name": "[libcamera-devel,v3,2/4] test: camera: Add setting of configuration test", "commit_ref": "e44b63b3777df767d1e49f4e0ec2067b3638793f", "pull_url": null, "state": "accepted", "archived": false, "hash": "e73cb4f8221842ad519a94ffc4bf917377353d49", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/732/mbox/", "series": [ { "id": 206, "url": "https://patchwork.libcamera.org/api/series/206/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=206", "date": "2019-03-13T01:05:28", "name": "test: camera: Add basic tests for the camera", "version": 3, "mbox": "https://patchwork.libcamera.org/series/206/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/732/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/732/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16FCF600FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Mar 2019 02:06:22 +0100 (CET)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 360d9ffb-452c-11e9-846a-005056917a89;\n\tWed, 13 Mar 2019 02:06:20 +0100 (CET)" ], "X-Halon-ID": "360d9ffb-452c-11e9-846a-005056917a89", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 13 Mar 2019 02:05:30 +0100", "Message-Id": "<20190313010532.28960-3-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "In-Reply-To": "<20190313010532.28960-1-niklas.soderlund@ragnatech.se>", "References": "<20190313010532.28960-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/4] test: camera: Add setting of\n\tconfiguration 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, 13 Mar 2019 01:06:22 -0000" }, "content": "Try to set the default configuration, a modified valid configuration and\nan invalid configuration.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/camera/configuration_set.cpp | 91 +++++++++++++++++++++++++++++++\n test/camera/meson.build | 1 +\n 2 files changed, 92 insertions(+)\n create mode 100644 test/camera/configuration_set.cpp", "diff": "diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp\nnew file mode 100644\nindex 0000000000000000..dedb85009335aa46\n--- /dev/null\n+++ b/test/camera/configuration_set.cpp\n@@ -0,0 +1,91 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * libcamera Camera API tests\n+ */\n+\n+#include <iostream>\n+\n+#include \"camera_test.h\"\n+\n+using namespace std;\n+\n+namespace {\n+\n+class ConfigurationSet : public CameraTest\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tstd::set<Stream *> streams = { *camera_->streams().begin() };\n+\t\tstd::map<Stream *, StreamConfiguration> conf =\n+\t\t\tcamera_->streamConfiguration(streams);\n+\t\tStreamConfiguration *sconf = &conf.begin()->second;\n+\n+\t\tif (!configurationValid(streams, conf)) {\n+\t\t\tcout << \"Failed to read default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (camera_->acquire()) {\n+\t\t\tcout << \"Failed to acquire the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Test that setting the default configuration works. */\n+\t\tif (camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Failed to set default configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that configuring the camera fails if it is not\n+\t\t * acquired, this will also test release and reacquiring\n+\t\t * of the camera.\n+\t\t */\n+\t\tif (camera_->release()) {\n+\t\t\tcout << \"Failed to release the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Setting configuration on a camera not acquired succeeded when it should have failed\"\n+\t\t\t << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (camera_->acquire()) {\n+\t\t\tcout << \"Failed to acquire the camera\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that modifying the default configuration works. Doubling\n+\t\t * the default configuration of the VIMC camera is known to\n+\t\t * work.\n+\t\t */\n+\t\tsconf->width *= 2;\n+\t\tsconf->height *= 2;\n+\t\tif (camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Failed to set modified configuration\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/*\n+\t\t * Test that setting an invalid configuration fails.\n+\t\t */\n+\t\tsconf->width = 0;\n+\t\tsconf->height = 0;\n+\t\tif (!camera_->configureStreams(conf)) {\n+\t\t\tcout << \"Invalid configuration incorrectly accepted\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+} /* namespace */\n+\n+TEST_REGISTER(ConfigurationSet);\ndiff --git a/test/camera/meson.build b/test/camera/meson.build\nindex 186ba211b9fde026..ed4837190ff6c52c 100644\n--- a/test/camera/meson.build\n+++ b/test/camera/meson.build\n@@ -2,6 +2,7 @@\n # They are not alphabetically sorted.\n camera_tests = [\n [ 'configuration_default', 'configuration_default.cpp' ],\n+ [ 'configuration_set', 'configuration_set.cpp' ],\n ]\n \n foreach t : camera_tests\n", "prefixes": [ "libcamera-devel", "v3", "2/4" ] }