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

Message ID 20190111110956.14812-4-jacopo@jmondi.org
State Superseded
Headers show
Series
  • test: media_device: Add link handling test
Related show

Commit Message

Jacopo Mondi Jan. 11, 2019, 11:09 a.m. UTC
Use 'foreach' iterator construct to simplify adding test targets to the
media_device testing part.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 test/media_device/meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Kieran Bingham Jan. 11, 2019, 11:18 a.m. UTC | #1
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@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
>

Patch

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'],
+]
 
-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)
+endforeach