William A. Kennington III | 5e893b9 | 2020-06-04 02:47:29 -0700 | [diff] [blame] | 1 | gtest_dep = dependency('gtest', main: true, disabler: true, required: get_option('tests')) |
| 2 | gmock_dep = dependency('gmock', disabler: true, required: get_option('tests')) |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 3 | |
| 4 | tests = [ |
| 5 | 'bus/list_names', |
| 6 | 'bus/match', |
| 7 | 'exception/sdbus_error', |
| 8 | 'message/append', |
| 9 | 'message/read', |
| 10 | 'message/native_types', |
| 11 | 'message/types', |
| 12 | 'timer', |
| 13 | 'utility/tuple_to_array', |
| 14 | 'utility/type_traits', |
| 15 | ] |
| 16 | |
| 17 | foreach t : tests |
| 18 | test( |
| 19 | 'test_' + t.underscorify(), |
| 20 | executable( |
| 21 | 'test-' + t.underscorify(), |
| 22 | t + '.cpp', |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 23 | dependencies: [ |
| 24 | gtest_dep, |
| 25 | gmock_dep, |
Patrick Williams | d0285b9 | 2020-06-01 09:43:47 -0500 | [diff] [blame] | 26 | sdbusplus_dep, |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 27 | ], |
| 28 | ) |
| 29 | ) |
| 30 | endforeach |
| 31 | |
William A. Kennington III | 5e893b9 | 2020-06-04 02:47:29 -0700 | [diff] [blame] | 32 | assert( |
| 33 | not get_option('tests').enabled() or boost_dep.found(), |
| 34 | 'Boost is required when tests are enabled' |
| 35 | ) |
| 36 | |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 37 | test( |
Patrick Williams | 3a6d584 | 2020-06-09 14:59:58 -0500 | [diff] [blame] | 38 | 'test-bus_aio', |
| 39 | executable( |
| 40 | 'test-bus_aio', |
| 41 | 'bus/aio.cpp', |
| 42 | dependencies: [ |
| 43 | boost_dep, |
| 44 | gmock_dep, |
Patrick Williams | 3a6d584 | 2020-06-09 14:59:58 -0500 | [diff] [blame] | 45 | gtest_dep, |
| 46 | sdbusplus_dep, |
| 47 | ], |
| 48 | ) |
| 49 | ) |
| 50 | |
| 51 | test( |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 52 | 'test-vtable', |
| 53 | executable( |
| 54 | 'test-vtable', |
| 55 | 'vtable/vtable.cpp', |
| 56 | 'vtable/vtable_c.c', |
Patrick Williams | 617e749 | 2020-06-18 09:28:38 -0500 | [diff] [blame] | 57 | dependencies: [ |
| 58 | gtest_dep, |
| 59 | sdbusplus_dep, |
| 60 | ], |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 61 | ), |
| 62 | ) |
| 63 | |
| 64 | server_buildroot = meson.current_build_dir() |
| 65 | server_files = files( |
| 66 | run_command( |
| 67 | sdbusgen_prog, |
| 68 | '--tool', sdbusplusplus_prog, |
| 69 | '--output', server_buildroot, |
| 70 | 'server', |
| 71 | check: true |
| 72 | ).stdout().strip().split('\n') |
| 73 | ) |
| 74 | |
| 75 | test( |
| 76 | 'test-server', |
| 77 | executable( |
| 78 | 'test-server', |
| 79 | 'server/object.cpp', |
| 80 | server_files, |
Patrick Williams | d0285b9 | 2020-06-01 09:43:47 -0500 | [diff] [blame] | 81 | include_directories: include_directories('server'), |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 82 | dependencies: [ |
| 83 | gmock_dep, |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 84 | gtest_dep, |
Patrick Williams | d0285b9 | 2020-06-01 09:43:47 -0500 | [diff] [blame] | 85 | sdbusplus_dep, |
Patrick Williams | ad145e0 | 2020-05-19 16:45:15 -0500 | [diff] [blame] | 86 | ], |
| 87 | ), |
| 88 | ) |