[libcamera-devel] [PATCH 4/5] test: media_device: Convert to foreach
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Jan 2 10:23:25 CET 2019
Hi Kieran,
Thank you for the patch.
On Tuesday, 1 January 2019 23:29:46 EET Kieran Bingham wrote:
> Prevent duplication of boilerplate code as the suite grows by
> establishing the foreach pattern in the media_device test suite.
This results in duplicating the code for the foreach pattern though. I wonder
whether we could do better. How about something like
diff --git a/test/media_device/meson.build b/test/media_device/meson.build
index a7ebed102e24..5f14197b005f 100644
--- a/test/media_device/meson.build
+++ b/test/media_device/meson.build
@@ -1,5 +1,3 @@
-media_device_test = executable('media_device_test', 'media_device_test.cpp',
- link_with : test_libraries,
- include_directories : test_includes_internal)
-
-test('Media Device Test', media_device_test)
+internal_tests += [
+ ['media_device_test', files(['media_device_test.cpp'])],
+]
diff --git a/test/meson.build b/test/meson.build
index 184a7eeb5e27..69e4855013ec 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,7 +1,5 @@
subdir('libtest')
-subdir('media_device')
-
public_tests = [
['list', 'list.cpp'],
]
@@ -9,6 +7,8 @@ public_tests = [
internal_tests = [
]
+subdir('media_device')
+
foreach t : public_tests
exe = executable(t[0], t[1],
link_with : test_libraries,
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> test/media_device/meson.build | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/test/media_device/meson.build b/test/media_device/meson.build
> index a7ebed102e24..d9394b0545d8 100644
> --- a/test/media_device/meson.build
> +++ b/test/media_device/meson.build
> @@ -1,5 +1,11 @@
> -media_device_test = executable('media_device_test',
> 'media_device_test.cpp', - link_with :
> test_libraries,
> - include_directories :
> test_includes_internal) +media_device_tests = [
> + ['media_device_test', 'media_device_test.cpp'],
> +]
>
> -test('Media Device Test', media_device_test)
> +foreach t : media_device_tests
> + exe = executable(t[0], t[1],
> + link_with : test_libraries,
> + include_directories : test_includes_internal)
> +
> + test(t[0], exe, suite: 'media_device', is_parallel: false)
> +endforeach
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list