{"id":250,"url":"https://patchwork.libcamera.org/api/patches/250/?format=json","web_url":"https://patchwork.libcamera.org/patch/250/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190116135949.2097-2-jacopo@jmondi.org>","date":"2019-01-16T13:59:45","name":"[libcamera-devel,v2,1/5] test: list-cameras: Make test output more verbose","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e953d8b53a1d05a1a7a30b63442a6f4ca1c6aa13","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/250/mbox/","series":[{"id":85,"url":"https://patchwork.libcamera.org/api/series/85/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=85","date":"2019-01-16T13:59:44","name":"libcamera: pipeline: Add Intel IPU3 pipeline handler","version":2,"mbox":"https://patchwork.libcamera.org/series/85/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/250/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/250/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3ED8160B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jan 2019 14:59:49 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id C5D81C0011;\n\tWed, 16 Jan 2019 13:59:48 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 16 Jan 2019 14:59:45 +0100","Message-Id":"<20190116135949.2097-2-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190116135949.2097-1-jacopo@jmondi.org>","References":"<20190116135949.2097-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/5] test: list-cameras: Make test\n\toutput more verbose","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, 16 Jan 2019 13:59:49 -0000"},"content":"Make the list-cameras test a little more verbose to better describe\nfailures. While at there use the Test class defined TestStatus value as\ntest exit codes, and skip the test if no camera gets registred.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n test/list-cameras.cpp | 41 +++++++++++++++++++++++++++++++++++------\n 1 file changed, 35 insertions(+), 6 deletions(-)","diff":"diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp\nindex e2026c9..c9dc199 100644\n--- a/test/list-cameras.cpp\n+++ b/test/list-cameras.cpp\n@@ -7,6 +7,7 @@\n \n #include <iostream>\n \n+#include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n \n #include \"test.h\"\n@@ -14,27 +15,55 @@\n using namespace std;\n using namespace libcamera;\n \n+/*\n+ * List all cameras registered in the system, using the CameraManager.\n+ *\n+ * In order for the test to run successfully, a pipeline handler supporting\n+ * the current test platform should be available in the library.\n+ * Libcamera provides a platform-agnostic pipeline handler for the 'vimc'\n+ * virtual media device, which can be used for testing purposes.\n+ *\n+ * The test tries to list all cameras registered in the system, if no\n+ * camera is found the test is skipped. If the test gets skipped on a\n+ * platform where a pipeline handler is known to be available, an error\n+ * in camera enumeration might get unnoticed.\n+ */\n class ListTest : public Test\n {\n protected:\n \tint init()\n \t{\n \t\tcm = CameraManager::instance();\n-\t\tcm->start();\n+\n+\t\tint ret = cm->start();\n+\t\tif (ret) {\n+\t\t\tcerr << \"Failed to start the CameraManager\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n \n \t\treturn 0;\n \t}\n \n \tint run()\n \t{\n-\t\tunsigned int count = 0;\n+\t\tvector<string> cameraList = cm->list();\n+\t\tif (cameraList.empty()) {\n+\t\t\tcerr << \"No cameras registered in the system: test skip\" << endl\n+\t\t\t     << \"This might be expected if no pipeline handler supports the testing platform\" << endl;\n+\t\t\treturn TestSkip;\n+\t\t}\n+\n+\t\tfor (auto name : cameraList) {\n+\t\t\tCamera *cam = cm->get(name);\n+\t\t\tif (!cam) {\n+\t\t\t\tcerr << \"Failed to get camera '\" << name << \"' by name\" << endl;\n+\t\t\t\treturn TestFail;\n+\t\t\t}\n \n-\t\tfor (auto name : cm->list()) {\n-\t\t\tcout << \"- \" << name << endl;\n-\t\t\tcount++;\n+\t\t\tcout << \"Found camera '\" << cam->name() << \"'\" << endl;\n \t\t}\n \n-\t\treturn count ? 0 : -ENODEV;\n+\t\treturn TestPass;\n \t}\n \n \tvoid cleanup()\n","prefixes":["libcamera-devel","v2","1/5"]}