Message ID | 20200118212619.16174-1-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your patch. On 2020-01-18 23:26:19 +0200, Laurent Pinchart wrote: > 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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> > --- > 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<std::unique_ptr<FrameBuffer>> &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<Request *> requests; > for (const std::unique_ptr<FrameBuffer> &buffer : source.buffers()) { > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
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<std::unique_ptr<FrameBuffer>> &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<Request *> requests; for (const std::unique_ptr<FrameBuffer> &buffer : source.buffers()) {
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 <laurent.pinchart@ideasonboard.com> --- test/camera/buffer_import.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)