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 | |
| 15 | |
| 16 | tests = [ |
Andrew Jeffery | b27cebf | 2023-04-24 11:17:05 +0930 | [diff] [blame] | 17 | 'instance-id', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 18 | 'libpldm_base_test', |
| 19 | 'libpldm_platform_test', |
| 20 | 'libpldm_bios_test', |
| 21 | 'libpldm_bios_table_test', |
| 22 | 'libpldm_fru_test', |
| 23 | 'libpldm_utils_test', |
| 24 | 'libpldm_pdr_test', |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 25 | 'libpldm_firmware_update_test', |
| 26 | 'msgbuf', |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 27 | ] |
| 28 | |
Andrew Jeffery | ba05dba | 2023-08-29 14:43:04 +0930 | [diff] [blame] | 29 | if get_option('abi').contains('testing') |
| 30 | tests += [ 'transport' ] |
| 31 | endif |
| 32 | |
Andrew Jeffery | 8de8e1e | 2023-06-09 14:37:18 +0930 | [diff] [blame] | 33 | if get_option('oem-ibm').allowed() |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 34 | tests += [ |
| 35 | 'oem/ibm/libpldm_fileio_test', |
| 36 | 'oem/ibm/libpldm_host_test', |
| 37 | ] |
| 38 | endif |
| 39 | |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 40 | src_includes = include_directories('..' / 'src', '..' / 'include' / 'libpldm') |
| 41 | |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 42 | foreach t : tests |
| 43 | test(t, executable(t.underscorify(), t + '.cpp', |
| 44 | implicit_include_directories: false, |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 45 | include_directories: src_includes, |
Andrew Jeffery | 9c76679 | 2022-08-10 23:12:49 +0930 | [diff] [blame] | 46 | dependencies: [ |
| 47 | libpldm_dep, |
| 48 | gtest_dep, |
| 49 | gmock_dep]), |
| 50 | workdir: meson.current_source_dir()) |
| 51 | endforeach |
| 52 | |
Andrew Jeffery | 73d9176 | 2023-06-28 12:19:19 +0930 | [diff] [blame] | 53 | test('bios_table_iter', executable('bios_table_iter', |
| 54 | 'bios_table_iter.c', |
| 55 | implicit_include_directories: false, |
| 56 | include_directories: src_includes)) |
| 57 | |
Andrew Jeffery | c63f63a | 2023-02-24 22:29:33 +1030 | [diff] [blame] | 58 | test('msgbuf_generic', executable('msgbuf_generic', |
| 59 | 'msgbuf_generic.c', |
| 60 | implicit_include_directories: false, |
| 61 | include_directories: src_includes)) |