blob: 393f73f6a25ba9068b62dc4ca99ceb3ba3071359 [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',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010027 '../src/numeric_threshold.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020028 '../src/persistent_json_storage.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020029 '../src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020030 '../src/report_factory.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020031 '../src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020032 '../src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020033 '../src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010034 '../src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010035 '../src/trigger_actions.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010036 '../src/trigger_factory.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010037 '../src/trigger_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020038 'src/dbus_environment.cpp',
39 'src/main.cpp',
40 'src/stubs/dbus_sensor_object.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010041 'src/test_conversion.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020042 'src/test_detached_timer.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020043 'src/test_metric.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010044 'src/test_numeric_threshold.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020045 'src/test_persistent_json_storage.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020046 'src/test_report.cpp',
47 'src/test_report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020048 'src/test_sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020049 'src/test_sensor_cache.cpp',
Wludzik, Jozefe2362792020-10-27 17:23:55 +010050 'src/test_transform.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010051 'src/test_trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010052 'src/test_trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010053 'src/test_trigger_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020054 'src/test_unique_call.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020055 'src/utils/generate_unique_mock_id.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020056 ],
57 dependencies: [
58 boost,
59 gmock_dep,
60 gtest_dep,
61 nlohmann_json,
62 phosphor_logging,
63 sdbusplus,
64 ],
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020065 include_directories: ['../src', 'src']
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010066 ),
67 timeout: 120,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020068)