From patchwork Fri Dec 21 09:08:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 72 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CCD8760B0C for ; Fri, 21 Dec 2018 10:08:07 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4D305558; Fri, 21 Dec 2018 10:08:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1545383287; bh=taOlGqXBiSWxM+kNjAzxBgZcpQ6gwla1N2uM7UUBJUE=; h=From:To:Cc:Subject:Date:From; b=KJQdic0rCZAZIkcEs1bLbXtaTiFPkLMlFyfIskpW1HqfNYuWvULwEPmDTKdxverj8 UwA46dtFKpp6MetbFic9BSpMIHlTScRex7Yx5kkNNypdyQpK6GuJuUm+9HEOM2eDh5 1g1RZ5d9hGfQdTqmcgU6n+g96zoEDEpX2jBA22/g= From: Kieran Bingham To: LibCamera Devel Date: Fri, 21 Dec 2018 09:08:04 +0000 Message-Id: <20181221090804.8208-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.17.1 Subject: [libcamera-devel] [PATCH] test: Use foreach iterators to simplify definitions X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2018 09:08:08 -0000 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. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- This patch applies on top of the series "[PATCH 0/5] test: Define libtest" just posted. test/meson.build | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test/meson.build b/test/meson.build index 50ec11853203..754527324c7d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -12,8 +12,26 @@ test_includes_internal = [ libcamera_internal_includes, ] -test_init = executable('test_init', 'init.cpp', - link_with : test_libraries, - include_directories : test_includes_public) +public_tests = [ + [ 'test_init', 'init.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('Initialisation test', test_init) + test(t[0], exe) +endforeach