blob: 21f44a00bdd6dd672b1195ce346d62e064af6823 [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
27
Lei YUd3204142021-11-16 14:57:27 +080028test(
29 'test_utils',
30 executable(
31 'test_utils',
32 'test_Utils.cpp',
33 '../src/Utils.cpp',
Ed Tanous16966b52021-09-15 15:06:59 -070034 dependencies: ut_deps_list,
Lei YUd3204142021-11-16 14:57:27 +080035 implicit_include_directories: false,
Andrew Jefferye73bd0a2023-01-25 10:39:57 +103036 include_directories: '../src',
Andrew Jefferyab8b0452024-01-11 09:55:51 +103037 ),
Lei YUd3204142021-11-16 14:57:27 +080038)
Ed Tanous828c5a62024-02-09 16:59:22 -080039
40test(
41 'test_ipmb',
42 executable(
43 'test_ipmb',
44 '../src/IpmbSensor.cpp',
45 '../src/Utils.cpp',
46 '../src/IpmbSDRSensor.cpp',
47 'test_IpmbSensor.cpp',
48 dependencies: ut_deps_list,
49 link_with: [
50 utils_a,
51 thresholds_a,
52 devicemgmt_a
53 ],
54 implicit_include_directories: false,
55 include_directories: '../src',
56 ),
57)