From 5802259b3c6ee48d1ee603595d462306f9293605 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Date: Tue, 1 Jan 2019 14:36:35 +0000
Subject: test: Use foreach iterators to simplify definitions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Create two arrays, to contain public and internal test targets, and use
the foreach iterators to automatically generate test output targets for
each entry in each array.

The public tests array is linked only against public libcamera headers,
while tests declared in the internal_tests will have access to
non-public API headers from within the libcamera sources.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/meson.build | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

(limited to 'test')

diff --git a/test/meson.build b/test/meson.build
index 9fac7e39..ae8b3fb9 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -12,10 +12,27 @@ test_includes_internal = [
     libcamera_internal_includes,
 ]
 
-list = executable('list', 'list.cpp',
-                  link_with : test_libraries,
-                  include_directories : test_includes_public)
-
 subdir('media_device')
 
-test('List Camera API tests', list)
+public_tests = [
+    ['list',            'list.cpp'],
+]
+
+internal_tests = [
+]
+
+foreach t : public_tests
+    exe = executable(t[0], t[1],
+                     link_with : test_libraries,
+                     include_directories : test_includes_public)
+
+    test(t[0], exe)
+endforeach
+
+foreach t : internal_tests
+    exe = executable(t[0], t[1],
+                     link_with : test_libraries,
+                     include_directories : test_includes_internal)
+
+    test(t[0], exe)
+endforeach
-- 
cgit v1.2.1