[libcamera-devel] [PATCH 3/3] test: media_device: Use foreach iterator

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Jan 11 12:18:27 CET 2019


Hi Jacopo,

On 11/01/2019 11:09, Jacopo Mondi wrote:
> Use 'foreach' iterator construct to simplify adding test targets to the
> media_device testing part.
> 

This makes me happy ;)

> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  test/media_device/meson.build | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/test/media_device/meson.build b/test/media_device/meson.build
> index b1294f6..9f55457 100644
> --- a/test/media_device/meson.build
> +++ b/test/media_device/meson.build
> @@ -1,12 +1,12 @@
> -media_device_print_test = executable('media_device_print_test',
> -				     'media_device_print_test.cpp',
> -				     link_with : test_libraries,
> -				     include_directories : test_includes_internal)
> +media_device_tests = [
> +  ['print media device',		      'media_device_print_test.cpp'],
> +  ['media device link handling',	      'media_device_link_test.cpp'],
> +]

How about put this patch first - and then your new test only needs to
add the line into this table above :)

 (which is why I like this patch)

>  
> -media_device_link_test = executable('media_device_link_test',
> -				    'media_device_link_test.cpp',
> -				    link_with : test_libraries,
> -				    include_directories : test_includes_internal)
> +foreach t : media_device_tests
> +    exe = executable(t[0], t[1],
> +                     link_with : test_libraries,
> +                     include_directories : test_includes_internal)
>  
> -test('Media Device Print Test', media_device_print_test)
> -test('Media Device Link Test', media_device_link_test)
> +    test(t[0], exe)

I think  "suite: 'media-device'" might be useful and "parallel: false"
might be essential here.

See 0e71e67925549eb8e54c1a3f81a0ba15a02c5211 for the version I did.

--
Regards

Kieran



> +endforeach
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list