[libcamera-devel,3/3] test: process: Extend timeout duration

Message ID 20190910090418.30502-4-kieran.bingham@ideasonboard.com
State Accepted
Commit ff09b6d3788731eadc31b6f73252243577b3d3d3
Headers show
Series
  • test: process: Cleanup to process test
Related show

Commit Message

Kieran Bingham Sept. 10, 2019, 9:04 a.m. UTC
The process test runs for just 100mS. The spawned process runs for at
least 50mS. Ordinarily this should allow plenty of time for both the
process to be spawned and run, but when adding extra debug
instrumentation, the processes can be slowed down, leading to a false
negative test failure.

Extend the timeout to 2 seconds to allow the short process to be run
correctly - but use the now initialised exitStatus_ to exit the event
loop as soon as the process has completed.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 test/process/process_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Sept. 10, 2019, 9:45 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Tue, Sep 10, 2019 at 10:04:18AM +0100, Kieran Bingham wrote:
> The process test runs for just 100mS. The spawned process runs for at
> least 50mS. Ordinarily this should allow plenty of time for both the
> process to be spawned and run, but when adding extra debug
> instrumentation, the processes can be slowed down, leading to a false
> negative test failure.
> 
> Extend the timeout to 2 seconds to allow the short process to be run
> correctly - but use the now initialised exitStatus_ to exit the event
> loop as soon as the process has completed.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  test/process/process_test.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/process/process_test.cpp b/test/process/process_test.cpp
> index f3cabe0a36c7..7e7b3c2c8bf3 100644
> --- a/test/process/process_test.cpp
> +++ b/test/process/process_test.cpp
> @@ -56,8 +56,8 @@ protected:
>  			return TestFail;
>  		}
>  
> -		timeout.start(100);
> -		while (timeout.isRunning())
> +		timeout.start(2000);
> +		while (timeout.isRunning() && exitStatus_ == Process::NotExited)
>  			dispatcher->processEvents();
>  
>  		if (exitStatus_ != Process::NormalExit) {

Patch

diff --git a/test/process/process_test.cpp b/test/process/process_test.cpp
index f3cabe0a36c7..7e7b3c2c8bf3 100644
--- a/test/process/process_test.cpp
+++ b/test/process/process_test.cpp
@@ -56,8 +56,8 @@  protected:
 			return TestFail;
 		}
 
-		timeout.start(100);
-		while (timeout.isRunning())
+		timeout.start(2000);
+		while (timeout.isRunning() && exitStatus_ == Process::NotExited)
 			dispatcher->processEvents();
 
 		if (exitStatus_ != Process::NormalExit) {