blob: 0415e963d8b0d6e706a402c1453a9e59d1ffb19f [file] [log] [blame]
Andrew Jeffery2f20c5a2021-05-27 14:52:49 +09301gtest_dep = dependency('gtest', main: true, disabler: true, required: false)
2gmock_dep = dependency('gmock', disabler: true, required: false)
3if not gtest_dep.found() or not gmock_dep.found()
4 gtest_proj = import('cmake').subproject('googletest', required: false)
5 if gtest_proj.found()
6 gtest_dep = declare_dependency(
7 dependencies: [
8 dependency('threads'),
9 gtest_proj.dependency('gtest'),
10 gtest_proj.dependency('gtest_main'),
Andrew Jefferyab8b0452024-01-11 09:55:51 +103011 ],
Andrew Jeffery2f20c5a2021-05-27 14:52:49 +093012 )
13 gmock_dep = gtest_proj.dependency('gmock')
14 else
15 assert(
Patrick Williams5bc307f2023-11-29 06:44:23 -060016 not get_option('tests').allowed(),
Andrew Jefferyab8b0452024-01-11 09:55:51 +103017 'Googletest is required if tests are enabled',
Andrew Jeffery2f20c5a2021-05-27 14:52:49 +093018 )
19 endif
20endif
Brad Bishopfeb19ef2019-11-07 18:02:16 -050021
Ed Tanous16966b52021-09-15 15:06:59 -070022ut_deps_list = [
23 gtest_dep,
24]
25
26ut_deps_list += default_deps
George Liud7be5552024-09-20 10:39:09 +080027src_inc = include_directories('..')
Ed Tanous16966b52021-09-15 15:06:59 -070028
Lei YUd3204142021-11-16 14:57:27 +080029test(
30 'test_utils',
31 executable(
32 'test_utils',
33 'test_Utils.cpp',
George Liud7be5552024-09-20 10:39:09 +080034 '../Utils.cpp',
Ed Tanous16966b52021-09-15 15:06:59 -070035 dependencies: ut_deps_list,
Lei YUd3204142021-11-16 14:57:27 +080036 implicit_include_directories: false,
George Liud7be5552024-09-20 10:39:09 +080037 include_directories: src_inc,
Andrew Jefferyab8b0452024-01-11 09:55:51 +103038 ),
Lei YUd3204142021-11-16 14:57:27 +080039)
Ed Tanous828c5a62024-02-09 16:59:22 -080040
41test(
42 'test_ipmb',
43 executable(
44 'test_ipmb',
George Liud7be5552024-09-20 10:39:09 +080045 '../ipmb/IpmbSensor.cpp',
46 '../Utils.cpp',
47 '../ipmb/IpmbSDRSensor.cpp',
Ed Tanous828c5a62024-02-09 16:59:22 -080048 'test_IpmbSensor.cpp',
49 dependencies: ut_deps_list,
50 link_with: [
51 utils_a,
52 thresholds_a,
53 devicemgmt_a
54 ],
55 implicit_include_directories: false,
George Liud7be5552024-09-20 10:39:09 +080056 include_directories: src_inc,
Ed Tanous828c5a62024-02-09 16:59:22 -080057 ),
58)