blob: b2cdbc1d48fadc371fef1bea6c3aa18dff37130f [file] [log] [blame]
William A. Kennington IIIbbd1b562020-02-20 15:15:19 -08001gtest = dependency('gtest', main: true, disabler: true, required: false)
2gmock = dependency('gmock', disabler: true, required: false)
3if not gtest.found() or not gmock.found()
William A. Kennington III61869e02021-04-15 12:29:56 -07004 gtest_opts = import('cmake').subproject_options()
5 gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'})
William A. Kennington III159a3562021-02-04 15:00:41 -08006 gtest_proj = import('cmake').subproject(
7 'googletest',
William A. Kennington III61869e02021-04-15 12:29:56 -07008 options: gtest_opts,
William A. Kennington III159a3562021-02-04 15:00:41 -08009 required: false)
William A. Kennington IIIbbd1b562020-02-20 15:15:19 -080010 if gtest_proj.found()
11 gtest = declare_dependency(
12 dependencies: [
13 dependency('threads'),
14 gtest_proj.dependency('gtest'),
15 gtest_proj.dependency('gtest_main'),
16 ])
17 gmock = gtest_proj.dependency('gmock')
18 else
19 assert(not build_tests.enabled(), 'Googletest is required')
20 endif
21endif
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080022
William A. Kennington III159a3562021-02-04 15:00:41 -080023
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080024tests = [
25 'clock',
26 'event',
27 'exception',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080028 'source/base',
29 'source/child',
30 'source/event',
31 'source/io',
32 'source/signal',
33 'source/time',
William A. Kennington IIIa4c76ea2022-11-21 16:20:41 -080034 'utility/sdbus',
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080035 'utility/timer',
36]
37
38foreach t : tests
William A. Kennington IIIa4c76ea2022-11-21 16:20:41 -080039 test(t,
40 executable(
41 t.underscorify(),
42 t + '.cpp',
43 implicit_include_directories: false,
44 dependencies: [
45 dependency('sdbusplus'),
46 sdeventplus_dep,
47 gtest,
48 gmock,
49 ]))
William A. Kennington IIId4b33e92018-12-04 17:22:05 -080050endforeach