[v2,4/6] test: fence: Increase timeout for fence test
diff mbox series

Message ID 20240529154341.10426-5-laurent.pinchart@ideasonboard.com
State Accepted
Commit dedf9cf264656c7ce396fb66b69e3c8fcfd458c4
Headers show
Series
  • vimc scaling improvements
Related show

Commit Message

Laurent Pinchart May 29, 2024, 3:43 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.

By itself, that change could increase the test time quite substantially
on fast platforms, so break from the capture loop as soon as we capture
enough frames.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
Changes since v1:

- Update comment
---
 test/fence.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Daniel Scally June 1, 2024, 10:14 p.m. UTC | #1
On 29/05/2024 16:43, Laurent Pinchart wrote:
> 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.
>
> By itself, that change could increase the test time quite substantially
> on fast platforms, so break from the capture loop as soon as we capture
> enough frames.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
> Changes since v1:
>
> - Update comment
> ---
>   test/fence.cpp | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/test/fence.cpp b/test/fence.cpp
> index a8fba7284d82..8095b22895c7 100644
> --- a/test/fence.cpp
> +++ b/test/fence.cpp
> @@ -327,10 +327,14 @@ int FenceTest::run()
>   	Timer fenceTimer;
>   	fenceTimer.timeout.connect(this, &FenceTest::signalFence);
>   
> -	/* Loop for one second. */
> +	/*
> +	 * Loop long enough for all requests to complete, allowing 500ms per
> +	 * request.
> +	 */
>   	Timer timer;
> -	timer.start(1000ms);
> -	while (timer.isRunning() && expectedCompletionResult_) {
> +	timer.start(500ms * (signalledRequestId_ + 1));
> +	while (timer.isRunning() && expectedCompletionResult_ &&
> +	       completedRequestId_ <= signalledRequestId_ + 1) {
>   		if (completedRequestId_ == signalledRequestId_ - 1 && setFence_)
>   			/*
>   			 * The request just before signalledRequestId_ has just
Kieran Bingham June 3, 2024, 8:51 a.m. UTC | #2
Quoting Laurent Pinchart (2024-05-29 16:43:39)
> 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.
> 
> By itself, that change could increase the test time quite substantially
> on fast platforms, so break from the capture loop as soon as we capture
> enough frames.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> Changes since v1:
> 
> - Update comment
> ---
>  test/fence.cpp | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/test/fence.cpp b/test/fence.cpp
> index a8fba7284d82..8095b22895c7 100644
> --- a/test/fence.cpp
> +++ b/test/fence.cpp
> @@ -327,10 +327,14 @@ int FenceTest::run()
>         Timer fenceTimer;
>         fenceTimer.timeout.connect(this, &FenceTest::signalFence);
>  
> -       /* Loop for one second. */
> +       /*
> +        * Loop long enough for all requests to complete, allowing 500ms per
> +        * request.
> +        */

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

>         Timer timer;
> -       timer.start(1000ms);
> -       while (timer.isRunning() && expectedCompletionResult_) {
> +       timer.start(500ms * (signalledRequestId_ + 1));
> +       while (timer.isRunning() && expectedCompletionResult_ &&
> +              completedRequestId_ <= signalledRequestId_ + 1) {
>                 if (completedRequestId_ == signalledRequestId_ - 1 && setFence_)
>                         /*
>                          * The request just before signalledRequestId_ has just
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/test/fence.cpp b/test/fence.cpp
index a8fba7284d82..8095b22895c7 100644
--- a/test/fence.cpp
+++ b/test/fence.cpp
@@ -327,10 +327,14 @@  int FenceTest::run()
 	Timer fenceTimer;
 	fenceTimer.timeout.connect(this, &FenceTest::signalFence);
 
-	/* Loop for one second. */
+	/*
+	 * Loop long enough for all requests to complete, allowing 500ms per
+	 * request.
+	 */
 	Timer timer;
-	timer.start(1000ms);
-	while (timer.isRunning() && expectedCompletionResult_) {
+	timer.start(500ms * (signalledRequestId_ + 1));
+	while (timer.isRunning() && expectedCompletionResult_ &&
+	       completedRequestId_ <= signalledRequestId_ + 1) {
 		if (completedRequestId_ == signalledRequestId_ - 1 && setFence_)
 			/*
 			 * The request just before signalledRequestId_ has just