blob: 54d79e22ff3b93a3f06f396f49bab6d535578b14 [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',
Wludzik, Jozefe2362792020-10-27 17:23:55 +010043 'src/test_transform.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020044 'src/test_unique_call.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020045 'src/utils/generate_unique_mock_id.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020046 ],
47 dependencies: [
48 boost,
49 gmock_dep,
50 gtest_dep,
51 nlohmann_json,
52 phosphor_logging,
53 sdbusplus,
54 ],
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020055 include_directories: ['../src', 'src']
Krzysztof Grobelny6ccfcbf2020-11-04 09:31:36 +010056 ),
57 timeout: 120,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020058)