William A. Kennington III | 2f8444c | 2020-06-03 13:39:49 -0700 | [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_proj = import('cmake').subproject('googletest', required: false) |
| 5 | if gtest_proj.found() |
| 6 | gtest = declare_dependency( |
| 7 | dependencies: [ |
| 8 | dependency('threads'), |
| 9 | gtest_proj.dependency('gtest'), |
| 10 | gtest_proj.dependency('gtest_main'), |
| 11 | ]) |
| 12 | gmock = gtest_proj.dependency('gmock') |
| 13 | else |
| 14 | assert(not build_tests.enabled(), 'Googletest is required') |
| 15 | endif |
| 16 | endif |
William A. Kennington III | 1565897 | 2019-03-27 19:44:36 -0700 | [diff] [blame] | 17 | |
| 18 | tests = [ |
| 19 | 'chip', |
| 20 | 'event', |
| 21 | 'handle', |
| 22 | 'internal/fd', |
| 23 | 'mocks', |
| 24 | 'utility/aspeed', |
| 25 | ] |
| 26 | |
| 27 | foreach t : tests |
| 28 | test(t, executable(t.underscorify(), t + '.cpp', |
William A. Kennington III | 1565897 | 2019-03-27 19:44:36 -0700 | [diff] [blame] | 29 | implicit_include_directories: false, |
William A. Kennington III | 48e6288 | 2019-04-03 15:36:01 -0700 | [diff] [blame] | 30 | dependencies: [gpioplus, gtest, gmock])) |
William A. Kennington III | 1565897 | 2019-03-27 19:44:36 -0700 | [diff] [blame] | 31 | endforeach |