Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 1 | gtest_dep = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock_dep = dependency('gmock', disabler: true, required: false) |
| 3 | if not gtest_dep.found() or not gmock_dep.found() |
| 4 | gtest_proj = import('cmake').subproject('googletest', required: true) |
| 5 | gtest_dep = declare_dependency( |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 6 | dependencies: [ |
| 7 | dependency('threads'), |
| 8 | gtest_proj.dependency('gtest'), |
| 9 | gtest_proj.dependency('gtest_main'), |
| 10 | ], |
| 11 | ) |
| 12 | gmock_dep = gtest_proj.dependency('gmock') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 13 | endif |
| 14 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 15 | test_include_dirs = [libpldm_include_dir, include_directories('../src')] |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 16 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 17 | tests = ['instance-id', 'msgbuf', 'responder', 'utils'] |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 18 | |
Andrew Jeffery | 48761c6 | 2024-06-03 15:48:26 +0930 | [diff] [blame] | 19 | subdir('dsp') |
| 20 | |
Andrew Jeffery | 9ca7670 | 2024-06-03 13:32:41 +0930 | [diff] [blame] | 21 | # The 'test' transport APIs will never be marked stable as they are just for |
| 22 | # testing. |
Andrew Jeffery | ba05dba | 2023-08-29 14:43:04 +0930 | [diff] [blame] | 23 | if get_option('abi').contains('testing') |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 24 | subdir('transport') |
Andrew Jeffery | ba05dba | 2023-08-29 14:43:04 +0930 | [diff] [blame] | 25 | endif |
| 26 | |
Andrew Jeffery | 8de8e1e | 2023-06-09 14:37:18 +0930 | [diff] [blame] | 27 | if get_option('oem-ibm').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 28 | subdir('oem/ibm') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 29 | endif |
| 30 | |
Delphine CC Chiu | 22fad39 | 2023-10-27 11:05:01 +0800 | [diff] [blame] | 31 | if get_option('oem-meta').allowed() |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 32 | subdir('oem/meta') |
Delphine CC Chiu | 22fad39 | 2023-10-27 11:05:01 +0800 | [diff] [blame] | 33 | endif |
| 34 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 35 | foreach t : tests |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 36 | test( |
| 37 | t, |
| 38 | executable( |
| 39 | t.underscorify(), |
| 40 | t + '.cpp', |
| 41 | implicit_include_directories: false, |
| 42 | include_directories: test_include_dirs, |
| 43 | dependencies: [libpldm_dep, gtest_dep, gmock_dep], |
| 44 | ), |
| 45 | workdir: meson.current_source_dir(), |
| 46 | ) |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 47 | endforeach |
| 48 | |
Andrew Jeffery | e984a46 | 2024-09-07 11:23:28 +0200 | [diff] [blame^] | 49 | test( |
| 50 | 'msgbuf_generic', |
| 51 | executable( |
| 52 | 'msgbuf_generic', |
| 53 | 'msgbuf_generic.c', |
| 54 | implicit_include_directories: false, |
| 55 | include_directories: test_include_dirs, |
| 56 | ), |
| 57 | ) |