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( |
| 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') |
| 13 | endif |
| 14 | |
Andrew Jeffery | 48761c6 | 2024-06-03 15:48:26 +0930 | [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 | |
| 17 | tests = [ |
Andrew Jeffery | b27cebf | 2023-04-24 11:17:05 +0930 | [diff] [blame] | 18 | 'instance-id', |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 19 | 'msgbuf', |
Andrew Jeffery | cc45aed | 2023-09-10 23:03:29 +0930 | [diff] [blame] | 20 | 'responder', |
Andrew Jeffery | 48761c6 | 2024-06-03 15:48:26 +0930 | [diff] [blame] | 21 | 'utils', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 22 | ] |
| 23 | |
Andrew Jeffery | 48761c6 | 2024-06-03 15:48:26 +0930 | [diff] [blame] | 24 | subdir('dsp') |
| 25 | |
Andrew Jeffery | 9ca7670 | 2024-06-03 13:32:41 +0930 | [diff] [blame] | 26 | # The 'test' transport APIs will never be marked stable as they are just for |
| 27 | # testing. |
Andrew Jeffery | ba05dba | 2023-08-29 14:43:04 +0930 | [diff] [blame] | 28 | if get_option('abi').contains('testing') |
Andrew Jeffery | d480b70 | 2024-06-03 14:55:32 +0930 | [diff] [blame] | 29 | subdir('transport') |
Andrew Jeffery | ba05dba | 2023-08-29 14:43:04 +0930 | [diff] [blame] | 30 | endif |
| 31 | |
Andrew Jeffery | 8de8e1e | 2023-06-09 14:37:18 +0930 | [diff] [blame] | 32 | if get_option('oem-ibm').allowed() |
Andrew Jeffery | d480b70 | 2024-06-03 14:55:32 +0930 | [diff] [blame] | 33 | subdir('oem/ibm') |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 34 | endif |
| 35 | |
Delphine CC Chiu | 22fad39 | 2023-10-27 11:05:01 +0800 | [diff] [blame] | 36 | if get_option('oem-meta').allowed() |
Andrew Jeffery | d480b70 | 2024-06-03 14:55:32 +0930 | [diff] [blame] | 37 | subdir('oem/meta') |
Delphine CC Chiu | 22fad39 | 2023-10-27 11:05:01 +0800 | [diff] [blame] | 38 | endif |
| 39 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 40 | foreach t : tests |
| 41 | test(t, executable(t.underscorify(), t + '.cpp', |
| 42 | implicit_include_directories: false, |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 43 | include_directories: test_include_dirs, |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 44 | dependencies: [ |
| 45 | libpldm_dep, |
| 46 | gtest_dep, |
| 47 | gmock_dep]), |
| 48 | workdir: meson.current_source_dir()) |
| 49 | endforeach |
| 50 | |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 51 | test('msgbuf_generic', executable('msgbuf_generic', |
| 52 | 'msgbuf_generic.c', |
| 53 | implicit_include_directories: false, |
Andrew Jeffery | b0c1d20 | 2023-11-07 22:08:44 +1030 | [diff] [blame] | 54 | include_directories: test_include_dirs)) |