{"id":1328,"url":"https://patchwork.libcamera.org/api/1.1/patches/1328/?format=json","web_url":"https://patchwork.libcamera.org/patch/1328/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20190530133849.17366-1-kieran.bingham@ideasonboard.com>","date":"2019-05-30T13:38:49","name":"[libcamera-devel] test: camera: Fix initialisation","commit_ref":"339e9b2d976cc726ee4ec7de78ab5b7978b2eb8e","pull_url":null,"state":"accepted","archived":false,"hash":"846f479f496b074066ab4d55eab69ccb91922f25","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1328/mbox/","series":[{"id":332,"url":"https://patchwork.libcamera.org/api/1.1/series/332/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=332","date":"2019-05-30T13:38:49","name":"[libcamera-devel] test: camera: Fix initialisation","version":1,"mbox":"https://patchwork.libcamera.org/series/332/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1328/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1328/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@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 22A6A618F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 May 2019 15:38:54 +0200 (CEST)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9A8DC9F9;\n\tThu, 30 May 2019 15:38:53 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1559223533;\n\tbh=kFlERCYONDsxygZnQXFmm5srRh7z0amAzAs+jeWAsjI=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Uy9e5fA5/J6Ipb6QXEOhYfTDp78vuGPN907mlXBDdKaoWDwD97U3pyQctwxOWsGSh\n\tXBrD5AundkP6V5KWt3Hp9MLud9fzsz5lkI61kZsX9Ssh9KHE0LXreFAc9/OSuDH41Q\n\tUMll1dAcQorcxuuVySXwPIPro4J3UMfkWJ1oWlPs=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Thu, 30 May 2019 14:38:49 +0100","Message-Id":"<20190530133849.17366-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] test: camera: Fix initialisation","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":"Thu, 30 May 2019 13:38:54 -0000"},"content":"Three tests {capture,configuration_set,statemachine} override the\nCameraTest::init() function, and call it as the first action.\n\nHowever they were not checking the return value, and each of the tests\nwill segfault if the VIMC camera is not obtained.\n\nCheck the return value of the CameraTest base class initialisation and\nreturn any errors to the test suite if initialisation fails.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/camera/capture.cpp           | 4 +++-\n test/camera/configuration_set.cpp | 4 +++-\n test/camera/statemachine.cpp      | 4 +++-\n 3 files changed, 9 insertions(+), 3 deletions(-)","diff":"diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp\nindex c0835c250c65..98e71905531c 100644\n--- a/test/camera/capture.cpp\n+++ b/test/camera/capture.cpp\n@@ -42,7 +42,9 @@ protected:\n \n \tint init() override\n \t{\n-\t\tCameraTest::init();\n+\t\tint ret = CameraTest::init();\n+\t\tif (ret)\n+\t\t\treturn ret;\n \n \t\tconfig_ = camera_->generateConfiguration({ StreamRole::VideoRecording });\n \t\tif (!config_ || config_->size() != 1) {\ndiff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp\nindex 9f10f795a5d8..f88da96ca2b7 100644\n--- a/test/camera/configuration_set.cpp\n+++ b/test/camera/configuration_set.cpp\n@@ -18,7 +18,9 @@ class ConfigurationSet : public CameraTest\n protected:\n \tint init() override\n \t{\n-\t\tCameraTest::init();\n+\t\tint ret = CameraTest::init();\n+\t\tif (ret)\n+\t\t\treturn ret;\n \n \t\tconfig_ = camera_->generateConfiguration({ StreamRole::VideoRecording });\n \t\tif (!config_ || config_->size() != 1) {\ndiff --git a/test/camera/statemachine.cpp b/test/camera/statemachine.cpp\nindex d489f197e402..84d2a6fab5f0 100644\n--- a/test/camera/statemachine.cpp\n+++ b/test/camera/statemachine.cpp\n@@ -235,7 +235,9 @@ protected:\n \n \tint init() override\n \t{\n-\t\tCameraTest::init();\n+\t\tint ret = CameraTest::init();\n+\t\tif (ret)\n+\t\t\treturn ret;\n \n \t\tdefconf_ = camera_->generateConfiguration({ StreamRole::VideoRecording });\n \t\tif (!defconf_) {\n","prefixes":["libcamera-devel"]}