blob: 73846f6cbf6abc9fd3075e23ab751d338f9c1323 [file] [log] [blame]
Krzysztof Grobelny73da6902020-09-24 13:42:04 +02001gtest_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'),
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +02009 gtest_proj.dependency('gtest')
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020010 ]
11 )
12 gmock_dep = gtest_proj.dependency('gmock')
13 else
14 assert(
15 not get_option('tests').enabled(),
16 'Googletest is required if tests are enabled'
17 )
18 endif
19endif
20
21test(
22 'telemetry-ut',
23 executable(
24 'telemetry-ut',
25 [
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020026 '../src/metric.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020027 '../src/persistent_json_storage.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020028 '../src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020029 '../src/report_factory.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020030 '../src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020031 '../src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020032 '../src/sensor_cache.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020033 'src/dbus_environment.cpp',
34 'src/main.cpp',
35 'src/stubs/dbus_sensor_object.cpp',
36 'src/test_detached_timer.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020037 'src/test_metric.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020038 'src/test_persistent_json_storage.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020039 'src/test_report.cpp',
40 'src/test_report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020041 'src/test_sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020042 'src/test_sensor_cache.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020043 'src/test_unique_call.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020044 'src/utils/generate_unique_mock_id.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020045 ],
46 dependencies: [
47 boost,
48 gmock_dep,
49 gtest_dep,
50 nlohmann_json,
51 phosphor_logging,
52 sdbusplus,
53 ],
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020054 include_directories: ['../src', 'src']
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020055 )
56)