[libcamera-devel,2/3] test: v4l2_videodevice: dequeue_watchdog: Check return value of streamOn
diff mbox series

Message ID 20220407083719.21631-3-laurent.pinchart@ideasonboard.com
State Accepted
Commit 3980448e9f46f9ca2f27b38187215543984e3f5d
Headers show
Series
  • test: Fix dequeue_watchdog test failure when running the whole test suite
Related show

Commit Message

Laurent Pinchart April 7, 2022, 8:37 a.m. UTC
If the streamOn() call fails, there is no way the test will then
succeed. Catch it and return a failure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/v4l2_videodevice/dequeue_watchdog.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Nicolas Dufresne via libcamera-devel April 7, 2022, 11:16 a.m. UTC | #1
Hi Laurent,

On Thu, Apr 07, 2022 at 11:37:18AM +0300, Laurent Pinchart via libcamera-devel wrote:
> If the streamOn() call fails, there is no way the test will then
> succeed. Catch it and return a failure.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  test/v4l2_videodevice/dequeue_watchdog.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/test/v4l2_videodevice/dequeue_watchdog.cpp b/test/v4l2_videodevice/dequeue_watchdog.cpp
> index 2282e3958c03..320d14c8e442 100644
> --- a/test/v4l2_videodevice/dequeue_watchdog.cpp
> +++ b/test/v4l2_videodevice/dequeue_watchdog.cpp
> @@ -50,7 +50,11 @@ protected:
>  			}
>  		}
>  
> -		capture_->streamOn();
> +		ret = capture_->streamOn();
> +		if (ret < 0) {
> +			std::cout << "Failed to start streaming" << std::endl;
> +			return TestFail;
> +		}
>  
>  		timeout.start(5s);
>  		while (timeout.isRunning()) {

Patch
diff mbox series

diff --git a/test/v4l2_videodevice/dequeue_watchdog.cpp b/test/v4l2_videodevice/dequeue_watchdog.cpp
index 2282e3958c03..320d14c8e442 100644
--- a/test/v4l2_videodevice/dequeue_watchdog.cpp
+++ b/test/v4l2_videodevice/dequeue_watchdog.cpp
@@ -50,7 +50,11 @@  protected:
 			}
 		}
 
-		capture_->streamOn();
+		ret = capture_->streamOn();
+		if (ret < 0) {
+			std::cout << "Failed to start streaming" << std::endl;
+			return TestFail;
+		}
 
 		timeout.start(5s);
 		while (timeout.isRunning()) {