Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 1 | gtest_dep = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock_dep = dependency('gmock', disabler: true, required: false) |
| 3 | if 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 Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 9 | gtest_proj.dependency('gtest') |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 10 | ] |
| 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 |
| 19 | endif |
| 20 | |
| 21 | test( |
| 22 | 'telemetry-ut', |
| 23 | executable( |
| 24 | 'telemetry-ut', |
| 25 | [ |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 26 | '../src/metric.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame^] | 27 | '../src/numeric_threshold.cpp', |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 28 | '../src/persistent_json_storage.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 29 | '../src/report.cpp', |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 30 | '../src/report_factory.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 31 | '../src/report_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 32 | '../src/sensor.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 33 | '../src/sensor_cache.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 34 | '../src/trigger.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame^] | 35 | '../src/trigger_factory.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 36 | '../src/trigger_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 37 | 'src/dbus_environment.cpp', |
| 38 | 'src/main.cpp', |
| 39 | 'src/stubs/dbus_sensor_object.cpp', |
| 40 | 'src/test_detached_timer.cpp', |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 41 | 'src/test_metric.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame^] | 42 | 'src/test_numeric_threshold.cpp', |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 43 | 'src/test_persistent_json_storage.cpp', |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 44 | 'src/test_report.cpp', |
| 45 | 'src/test_report_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 46 | 'src/test_sensor.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 47 | 'src/test_sensor_cache.cpp', |
Wludzik, Jozef | e236279 | 2020-10-27 17:23:55 +0100 | [diff] [blame] | 48 | 'src/test_transform.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 49 | 'src/test_trigger.cpp', |
| 50 | 'src/test_trigger_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 51 | 'src/test_unique_call.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 52 | 'src/utils/generate_unique_mock_id.cpp', |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 53 | ], |
| 54 | dependencies: [ |
| 55 | boost, |
| 56 | gmock_dep, |
| 57 | gtest_dep, |
| 58 | nlohmann_json, |
| 59 | phosphor_logging, |
| 60 | sdbusplus, |
| 61 | ], |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 62 | include_directories: ['../src', 'src'] |
Krzysztof Grobelny | 6ccfcbf | 2020-11-04 09:31:36 +0100 | [diff] [blame] | 63 | ), |
| 64 | timeout: 120, |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 65 | ) |