From patchwork Mon Jan 20 00:24:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2687 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E2FFA607A2 for ; Mon, 20 Jan 2020 01:24:42 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F7B4529 for ; Mon, 20 Jan 2020 01:24:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1579479882; bh=P9OoRePHre0KNNhl+EZscIO2aiOkwmaJW4o5E68bEl8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=agc/yUowOinYDihsZhkjLgLi7/GfmR7qMXmmmLuJ+4ujZXLRZgNkuHmWwxHrnNbhZ 9niaAo6fI28FIqleuUU0neXzPXSEOVriNxjogx0eHyQ7pQ2Mdrg3NdDCMVHBfXPUXJ Zujcn2G+Nc6iNmu5qCN+c+o+6ZgQUtZnRJXnZeUc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Jan 2020 02:24:19 +0200 Message-Id: <20200120002437.6633-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200120002437.6633-1-laurent.pinchart@ideasonboard.com> References: <20200120002437.6633-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/19] test: buffer_import: Propagate status code from buffer allocation X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2020 00:24:43 -0000 The BufferSource::allocate() return value isn't propagated correctly, resulting in a test failure when the test should be skipped due to a missing vivid device. Fix it. While at it, return valid status codes from BufferSource::allocate() in all error cases, with proper diagnostic messages. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- test/camera/buffer_import.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp index e7048335e031..16bfca9beeea 100644 --- a/test/camera/buffer_import.cpp +++ b/test/camera/buffer_import.cpp @@ -89,15 +89,23 @@ public: ret = video_->getFormat(&format); if (ret) { std::cout << "Failed to get format on output device" << std::endl; - return ret; + return TestFail; } format.size = config.size; format.fourcc = V4L2VideoDevice::toV4L2Fourcc(config.pixelFormat, false); - if (video_->setFormat(&format)) + if (video_->setFormat(&format)) { + std::cout << "Failed to set format on output device" << std::endl; return TestFail; + } - return video_->exportBuffers(config.bufferCount, &buffers_); + ret = video_->exportBuffers(config.bufferCount, &buffers_); + if (ret < 0) { + std::cout << "Failed to export buffers" << std::endl; + return TestFail; + } + + return TestPass; } const std::vector> &buffers() @@ -178,8 +186,8 @@ protected: BufferSource source; int ret = source.allocate(cfg); - if (ret < 0) - return TestFail; + if (ret != TestPass) + return ret; std::vector requests; for (const std::unique_ptr &buffer : source.buffers()) {