From 8abcce31ee2b528cba1798fbb738294e5760dccf Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 5 Oct 2022 21:16:13 +0300 Subject: test: meson: Use dictionaries instead of arrays to store test information Tests are listed in meson.build using arrays that contain the test name and source files at fixed positions. This isn't very readable, leading to code using test[0], test[1] and test[2]. Replace the arrays with dictionaries to improve readability. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Umang Jain --- test/meson.build | 84 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'test/meson.build') diff --git a/test/meson.build b/test/meson.build index 4bc01d78..05a54d5c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -26,82 +26,82 @@ subdir('v4l2_subdevice') subdir('v4l2_videodevice') public_tests = [ - ['color-space', 'color-space.cpp'], - ['geometry', 'geometry.cpp'], - ['public-api', 'public-api.cpp'], - ['signal', 'signal.cpp'], - ['span', 'span.cpp'], + {'name': 'color-space', 'sources': ['color-space.cpp']}, + {'name': 'geometry', 'sources': ['geometry.cpp']}, + {'name': 'public-api', 'sources': ['public-api.cpp']}, + {'name': 'signal', 'sources': ['signal.cpp']}, + {'name': 'span', 'sources': ['span.cpp']}, ] internal_tests = [ - ['bayer-format', 'bayer-format.cpp'], - ['byte-stream-buffer', 'byte-stream-buffer.cpp'], - ['camera-sensor', 'camera-sensor.cpp'], - ['delayed_controls', 'delayed_controls.cpp'], - ['event', 'event.cpp'], - ['event-dispatcher', 'event-dispatcher.cpp'], - ['event-thread', 'event-thread.cpp'], - ['file', 'file.cpp'], - ['flags', 'flags.cpp'], - ['hotplug-cameras', 'hotplug-cameras.cpp'], - ['message', 'message.cpp'], - ['object', 'object.cpp'], - ['object-delete', 'object-delete.cpp'], - ['object-invoke', 'object-invoke.cpp'], - ['pixel-format', 'pixel-format.cpp'], - ['shared-fd', 'shared-fd.cpp'], - ['signal-threads', 'signal-threads.cpp'], - ['threads', 'threads.cpp', [libthreads]], - ['timer', 'timer.cpp'], - ['timer-thread', 'timer-thread.cpp'], - ['unique-fd', 'unique-fd.cpp'], - ['utils', 'utils.cpp'], - ['yaml-parser', 'yaml-parser.cpp'], + {'name': 'bayer-format', 'sources': ['bayer-format.cpp']}, + {'name': 'byte-stream-buffer', 'sources': ['byte-stream-buffer.cpp']}, + {'name': 'camera-sensor', 'sources': ['camera-sensor.cpp']}, + {'name': 'delayed_controls', 'sources': ['delayed_controls.cpp']}, + {'name': 'event', 'sources': ['event.cpp']}, + {'name': 'event-dispatcher', 'sources': ['event-dispatcher.cpp']}, + {'name': 'event-thread', 'sources': ['event-thread.cpp']}, + {'name': 'file', 'sources': ['file.cpp']}, + {'name': 'flags', 'sources': ['flags.cpp']}, + {'name': 'hotplug-cameras', 'sources': ['hotplug-cameras.cpp']}, + {'name': 'message', 'sources': ['message.cpp']}, + {'name': 'object', 'sources': ['object.cpp']}, + {'name': 'object-delete', 'sources': ['object-delete.cpp']}, + {'name': 'object-invoke', 'sources': ['object-invoke.cpp']}, + {'name': 'pixel-format', 'sources': ['pixel-format.cpp']}, + {'name': 'shared-fd', 'sources': ['shared-fd.cpp']}, + {'name': 'signal-threads', 'sources': ['signal-threads.cpp']}, + {'name': 'threads', 'sources': 'threads.cpp', 'dependencies': [libthreads]}, + {'name': 'timer', 'sources': ['timer.cpp']}, + {'name': 'timer-thread', 'sources': ['timer-thread.cpp']}, + {'name': 'unique-fd', 'sources': ['unique-fd.cpp']}, + {'name': 'utils', 'sources': ['utils.cpp']}, + {'name': 'yaml-parser', 'sources': ['yaml-parser.cpp']}, ] internal_non_parallel_tests = [ - ['fence', 'fence.cpp'], - ['mapped-buffer', 'mapped-buffer.cpp'], + {'name': 'fence', 'sources': ['fence.cpp']}, + {'name': 'mapped-buffer', 'sources': ['mapped-buffer.cpp']}, ] foreach test : public_tests deps = [libcamera_public] - if test.length() > 2 - deps += test[2] + if 'dependencies' in test + deps += test['dependencies'] endif - exe = executable(test[0], test[1], + exe = executable(test['name'], test['sources'], dependencies : deps, link_with : test_libraries, include_directories : test_includes_public) - test(test[0], exe) + test(test['name'], exe) endforeach foreach test : internal_tests deps = [libcamera_private] - if test.length() > 2 - deps += test[2] + if 'dependencies' in test + deps += test['dependencies'] endif - exe = executable(test[0], test[1], + exe = executable(test['name'], test['sources'], dependencies : deps, link_with : test_libraries, include_directories : test_includes_internal) - test(test[0], exe) + test(test['name'], exe) endforeach foreach test : internal_non_parallel_tests deps = [libcamera_private] - if test.length() > 2 - deps += test[2] + if 'dependencies' in test + deps += test['dependencies'] endif - exe = executable(test[0], test[1], + exe = executable(test['name'], test['sources'], dependencies : deps, link_with : test_libraries, include_directories : test_includes_internal) - test(test[0], exe, is_parallel : false) + test(test['name'], exe, is_parallel : false) endforeach -- cgit v1.2.1