[libcamera-devel] [PATCH] test: timer: Add dynamically allocated timer test

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Jul 1 23:42:49 CEST 2019


Hi Laurent,

Thanks for your work.

On 2019-07-01 23:27:12 +0300, Laurent Pinchart wrote:
> Timers should be automatically stopped and unregistered when deleted.
> Add a test to verify this is the case.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

Will you push this together with the timer fix or should I?

> ---
>  test/timer.cpp | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/test/timer.cpp b/test/timer.cpp
> index 41c132bd1ab2..addebce3c784 100644
> --- a/test/timer.cpp
> +++ b/test/timer.cpp
> @@ -152,6 +152,17 @@ protected:
>  			return TestFail;
>  		}
>  
> +		/*
> +		 * Test that dynamically allocated timers are stopped when
> +		 * deleted. This will result in a crash on failure.
> +		 */
> +		ManagedTimer *dyntimer = new ManagedTimer();
> +		dyntimer->start(100);
> +		delete dyntimer;
> +
> +		timer.start(200);
> +		dispatcher->processEvents();
> +
>  		return TestPass;
>  	}
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list