[v1,5/6] test: v4l2_videodevice: Increase timeout for vimc capture tests
diff mbox series

Message ID 20240424234224.9658-6-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • vimc scaling improvements
Related show

Commit Message

Laurent Pinchart April 24, 2024, 11:42 p.m. UTC
On slower machines, a 1s timeout to capture frames with vimc can be too
short and cause test failures. Make the timeout proportional to the
number of frames expected to be captured, using a conservative low
estimate of the frame rate at 2fps. This does not increase the test time
if the vimc driver is fast enough to produce frames.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/v4l2_videodevice/capture_async.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Kieran Bingham May 29, 2024, 2:14 p.m. UTC | #1
Quoting Laurent Pinchart (2024-04-25 00:42:23)
> On slower machines, a 1s timeout to capture frames with vimc can be too
> short and cause test failures. Make the timeout proportional to the
> number of frames expected to be captured, using a conservative low
> estimate of the frame rate at 2fps. This does not increase the test time
> if the vimc driver is fast enough to produce frames.

But ... does increase now to 15 seconds maximum from a 10 seconds
maximum before? Not an issue specifically - just my interpretation of:

> -               timeout.start(10000ms);
> +               timeout.start(500ms * 30);

sounds like it's different from the commit message.

Anyway, either way - it's not an issue - just wording of what is
happening.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  test/v4l2_videodevice/capture_async.cpp | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp
> index 42e1e671790b..673664615ada 100644
> --- a/test/v4l2_videodevice/capture_async.cpp
> +++ b/test/v4l2_videodevice/capture_async.cpp
> @@ -61,10 +61,12 @@ protected:
>                 if (ret)
>                         return TestFail;
>  
> -               timeout.start(10000ms);
> +               const unsigned int nFrames = 30;
> +
> +               timeout.start(500ms * nFrames);
>                 while (timeout.isRunning()) {
>                         dispatcher->processEvents();
> -                       if (frames > 30)
> +                       if (frames > nFrames)
>                                 break;
>                 }
>  
> @@ -73,8 +75,9 @@ protected:
>                         return TestFail;
>                 }
>  
> -               if (frames < 30) {
> -                       std::cout << "Failed to capture 30 frames within timeout." << std::endl;
> +               if (frames < nFrames) {
> +                       std::cout << "Failed to capture " << nFrames
> +                                 << " frames within timeout." << std::endl;
>                         return TestFail;
>                 }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>
Laurent Pinchart May 29, 2024, 3:25 p.m. UTC | #2
On Wed, May 29, 2024 at 03:14:09PM +0100, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2024-04-25 00:42:23)
> > On slower machines, a 1s timeout to capture frames with vimc can be too
> > short and cause test failures. Make the timeout proportional to the
> > number of frames expected to be captured, using a conservative low
> > estimate of the frame rate at 2fps. This does not increase the test time
> > if the vimc driver is fast enough to produce frames.
> 
> But ... does increase now to 15 seconds maximum from a 10 seconds
> maximum before? Not an issue specifically - just my interpretation of:
> 
> > -               timeout.start(10000ms);
> > +               timeout.start(500ms * 30);
> 
> sounds like it's different from the commit message.

The commit message should have mentioned 10s, not 1s. I'll fix that.

On fast machines the test time isn't increased as we break after
nFrames, well below the 10s limit.

> Anyway, either way - it's not an issue - just wording of what is
> happening.
> 
> 
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  test/v4l2_videodevice/capture_async.cpp | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> > 
> > diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp
> > index 42e1e671790b..673664615ada 100644
> > --- a/test/v4l2_videodevice/capture_async.cpp
> > +++ b/test/v4l2_videodevice/capture_async.cpp
> > @@ -61,10 +61,12 @@ protected:
> >                 if (ret)
> >                         return TestFail;
> >  
> > -               timeout.start(10000ms);
> > +               const unsigned int nFrames = 30;
> > +
> > +               timeout.start(500ms * nFrames);
> >                 while (timeout.isRunning()) {
> >                         dispatcher->processEvents();
> > -                       if (frames > 30)
> > +                       if (frames > nFrames)
> >                                 break;
> >                 }
> >  
> > @@ -73,8 +75,9 @@ protected:
> >                         return TestFail;
> >                 }
> >  
> > -               if (frames < 30) {
> > -                       std::cout << "Failed to capture 30 frames within timeout." << std::endl;
> > +               if (frames < nFrames) {
> > +                       std::cout << "Failed to capture " << nFrames
> > +                                 << " frames within timeout." << std::endl;
> >                         return TestFail;
> >                 }
> >

Patch
diff mbox series

diff --git a/test/v4l2_videodevice/capture_async.cpp b/test/v4l2_videodevice/capture_async.cpp
index 42e1e671790b..673664615ada 100644
--- a/test/v4l2_videodevice/capture_async.cpp
+++ b/test/v4l2_videodevice/capture_async.cpp
@@ -61,10 +61,12 @@  protected:
 		if (ret)
 			return TestFail;
 
-		timeout.start(10000ms);
+		const unsigned int nFrames = 30;
+
+		timeout.start(500ms * nFrames);
 		while (timeout.isRunning()) {
 			dispatcher->processEvents();
-			if (frames > 30)
+			if (frames > nFrames)
 				break;
 		}
 
@@ -73,8 +75,9 @@  protected:
 			return TestFail;
 		}
 
-		if (frames < 30) {
-			std::cout << "Failed to capture 30 frames within timeout." << std::endl;
+		if (frames < nFrames) {
+			std::cout << "Failed to capture " << nFrames
+				  << " frames within timeout." << std::endl;
 			return TestFail;
 		}