blob: ee57387d221f2b3436be3c83185d84e936cc2569 [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, Jozef1477fe62021-01-02 11:56:10 +010035 '../src/trigger_factory.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010036 '../src/trigger_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020037 'src/dbus_environment.cpp',
38 'src/main.cpp',
39 'src/stubs/dbus_sensor_object.cpp',
40 'src/test_detached_timer.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020041 'src/test_metric.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010042 'src/test_numeric_threshold.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020043 'src/test_persistent_json_storage.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020044 'src/test_report.cpp',
45 'src/test_report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020046 'src/test_sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020047 'src/test_sensor_cache.cpp',
Wludzik, Jozefe2362792020-10-27 17:23:55 +010048 'src/test_transform.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010049 'src/test_trigger.cpp',
50 'src/test_trigger_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020051 'src/test_unique_call.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020052 'src/utils/generate_unique_mock_id.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020053 ],
54 dependencies: [
55 boost,
56 gmock_dep,
57 gtest_dep,
58 nlohmann_json,
59 phosphor_logging,
60 sdbusplus,
61 ],
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020062 include_directories: ['../src', 'src']
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010063 ),
64 timeout: 120,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020065)