{"id":2681,"url":"https://patchwork.libcamera.org/api/patches/2681/?format=json","web_url":"https://patchwork.libcamera.org/patch/2681/","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":"<20200118212619.16174-1-laurent.pinchart@ideasonboard.com>","date":"2020-01-18T21:26:19","name":"[libcamera-devel] test: buffer_import: Propagate status code from buffer allocation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"aa0dfe17c18adb9ecc3f27ce29898f0ff9b9943e","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2681/mbox/","series":[{"id":637,"url":"https://patchwork.libcamera.org/api/series/637/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=637","date":"2020-01-18T21:26:19","name":"[libcamera-devel] test: buffer_import: Propagate status code from buffer allocation","version":1,"mbox":"https://patchwork.libcamera.org/series/637/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2681/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2681/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@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 53E6960457\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jan 2020 22:26:38 +0100 (CET)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D4CDE97A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 18 Jan 2020 22:26:37 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1579382798;\n\tbh=SUJGZ5gmroUXpe2A3E/ZbSA739wfuBrdF1fDMSfa/zM=;\n\th=From:To:Subject:Date:From;\n\tb=nQ2+27PO7ncDx2f01E1/NkX/UY0BHi5FLY+FUPnXS+YMcNyAXJ4I8jwELb6jfhvym\n\t8g7kjLNOoZeJSa/txLExz2Z9vufnHHNaYE6X990FAM79W+rLKqs41pgwRabaTMNEez\n\tIcBnhs4rkInumiXerSDDnK8Gp3zR+kCP8bDuw4WI=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 18 Jan 2020 23:26:19 +0200","Message-Id":"<20200118212619.16174-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] test: buffer_import: Propagate status\n\tcode from buffer allocation","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Sat, 18 Jan 2020 21:26:38 -0000"},"content":"The BufferSource::allocate() return value isn't propagated correctly,\nresulting in a test failure when the test should be skipped due to a\nmissing vivid device. Fix it.\n\nWhile at it, return valid status codes from BufferSource::allocate() in\nall error cases, with proper diagnostic messages.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n test/camera/buffer_import.cpp | 18 +++++++++++++-----\n 1 file changed, 13 insertions(+), 5 deletions(-)","diff":"diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp\nindex e7048335e031..16bfca9beeea 100644\n--- a/test/camera/buffer_import.cpp\n+++ b/test/camera/buffer_import.cpp\n@@ -89,15 +89,23 @@ public:\n \t\tret = video_->getFormat(&format);\n \t\tif (ret) {\n \t\t\tstd::cout << \"Failed to get format on output device\" << std::endl;\n-\t\t\treturn ret;\n+\t\t\treturn TestFail;\n \t\t}\n \n \t\tformat.size = config.size;\n \t\tformat.fourcc = V4L2VideoDevice::toV4L2Fourcc(config.pixelFormat, false);\n-\t\tif (video_->setFormat(&format))\n+\t\tif (video_->setFormat(&format)) {\n+\t\t\tstd::cout << \"Failed to set format on output device\" << std::endl;\n \t\t\treturn TestFail;\n+\t\t}\n \n-\t\treturn video_->exportBuffers(config.bufferCount, &buffers_);\n+\t\tret = video_->exportBuffers(config.bufferCount, &buffers_);\n+\t\tif (ret < 0) {\n+\t\t\tstd::cout << \"Failed to export buffers\" << std::endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n \t}\n \n \tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers()\n@@ -178,8 +186,8 @@ protected:\n \n \t\tBufferSource source;\n \t\tint ret = source.allocate(cfg);\n-\t\tif (ret < 0)\n-\t\t\treturn TestFail;\n+\t\tif (ret != TestPass)\n+\t\t\treturn ret;\n \n \t\tstd::vector<Request *> requests;\n \t\tfor (const std::unique_ptr<FrameBuffer> &buffer : source.buffers()) {\n","prefixes":["libcamera-devel"]}