Brandon Kim | 55dcada | 2022-03-09 02:18:01 -0800 | [diff] [blame] | 1 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock = dependency('gmock', disabler: true, required: false) |
| 3 | if not gtest.found() or not gmock.found() |
| 4 | gtest_opt = import('cmake').subproject_options() |
| 5 | gtest_opt.append_compile_args('c++', ['-DCMAKE_CXX_FLAGS=-Wno-pedantic']) |
| 6 | gtest_proj = cmake.subproject('googletest', options: gtest_opt, required: false) |
| 7 | fmt_depj.dependency('fmt') |
| 8 | |
| 9 | if gtest_proj.found() |
| 10 | gtest = declare_dependency( |
| 11 | dependencies: [ |
| 12 | dependency('threads'), |
| 13 | gtest_proj.dependency('gtest'), |
| 14 | gtest_proj.dependency('gtest_main'), |
| 15 | ]) |
| 16 | gmock = gtest_proj.dependency('gmock') |
| 17 | endif |
| 18 | endif |
| 19 | |
Brandon Kim | fcbc3db | 2022-06-06 21:26:18 -0700 | [diff] [blame] | 20 | test_dep = declare_dependency( |
| 21 | include_directories: include_directories('include'), |
| 22 | dependencies: [bios_bmc_smm_error_logger_dep, gtest, gmock, rde_dep] |
| 23 | ) |
| 24 | |
Brandon Kim | 55dcada | 2022-03-09 02:18:01 -0800 | [diff] [blame] | 25 | gtests = [ |
| 26 | 'pci_handler', |
kasunath | a1a69f1 | 2022-05-27 14:31:38 -0700 | [diff] [blame] | 27 | 'rde_dictionary_manager', |
Brandon Kim | fcbc3db | 2022-06-06 21:26:18 -0700 | [diff] [blame] | 28 | 'buffer', |
kasunath | 37bc0df | 2022-06-07 12:40:26 -0700 | [diff] [blame] | 29 | 'external_storer_file', |
kasunath | bac958d | 2022-06-07 18:15:24 -0700 | [diff] [blame] | 30 | 'rde_handler', |
Brandon Kim | 55dcada | 2022-03-09 02:18:01 -0800 | [diff] [blame] | 31 | ] |
| 32 | foreach t : gtests |
| 33 | test(t, executable(t.underscorify(), t + '_test.cpp', |
| 34 | build_by_default: false, |
| 35 | implicit_include_directories: false, |
Brandon Kim | fcbc3db | 2022-06-06 21:26:18 -0700 | [diff] [blame] | 36 | dependencies: test_dep)) |
Brandon Kim | 55dcada | 2022-03-09 02:18:01 -0800 | [diff] [blame] | 37 | endforeach |