xref: /openbmc/telemetry/tests/meson.build (revision e2362796befa500153beb22d3eae0a959bf825f4)
173da6906SKrzysztof Grobelnygtest_dep = dependency('gtest', main: true, disabler: true, required: false)
273da6906SKrzysztof Grobelnygmock_dep = dependency('gmock', disabler: true, required: false)
373da6906SKrzysztof Grobelnyif not gtest_dep.found() or not gmock_dep.found()
473da6906SKrzysztof Grobelny    gtest_proj = import('cmake').subproject('googletest', required: false)
573da6906SKrzysztof Grobelny    if gtest_proj.found()
673da6906SKrzysztof Grobelny        gtest_dep = declare_dependency(
773da6906SKrzysztof Grobelny            dependencies: [
873da6906SKrzysztof Grobelny                dependency('threads'),
9b5645947SKrzysztof Grobelny                gtest_proj.dependency('gtest')
1073da6906SKrzysztof Grobelny            ]
1173da6906SKrzysztof Grobelny        )
1273da6906SKrzysztof Grobelny        gmock_dep = gtest_proj.dependency('gmock')
1373da6906SKrzysztof Grobelny  else
1473da6906SKrzysztof Grobelny        assert(
1573da6906SKrzysztof Grobelny            not get_option('tests').enabled(),
1673da6906SKrzysztof Grobelny            'Googletest is required if tests are enabled'
1773da6906SKrzysztof Grobelny        )
1873da6906SKrzysztof Grobelny  endif
1973da6906SKrzysztof Grobelnyendif
2073da6906SKrzysztof Grobelny
2173da6906SKrzysztof Grobelnytest(
2273da6906SKrzysztof Grobelny    'telemetry-ut',
2373da6906SKrzysztof Grobelny    executable(
2473da6906SKrzysztof Grobelny        'telemetry-ut',
2573da6906SKrzysztof Grobelny        [
26c8e3a64aSKrzysztof Grobelny            '../src/metric.cpp',
2773da6906SKrzysztof Grobelny            '../src/persistent_json_storage.cpp',
287f06f613SKrzysztof Grobelny            '../src/report.cpp',
292f9f9b87SWludzik, Jozef            '../src/report_factory.cpp',
307f06f613SKrzysztof Grobelny            '../src/report_manager.cpp',
31b5645947SKrzysztof Grobelny            '../src/sensor.cpp',
327f06f613SKrzysztof Grobelny            '../src/sensor_cache.cpp',
33b5645947SKrzysztof Grobelny            'src/dbus_environment.cpp',
34b5645947SKrzysztof Grobelny            'src/main.cpp',
35b5645947SKrzysztof Grobelny            'src/stubs/dbus_sensor_object.cpp',
36b5645947SKrzysztof Grobelny            'src/test_detached_timer.cpp',
37c8e3a64aSKrzysztof Grobelny            'src/test_metric.cpp',
3873da6906SKrzysztof Grobelny            'src/test_persistent_json_storage.cpp',
392f9f9b87SWludzik, Jozef            'src/test_report.cpp',
402f9f9b87SWludzik, Jozef            'src/test_report_manager.cpp',
41b5645947SKrzysztof Grobelny            'src/test_sensor.cpp',
427f06f613SKrzysztof Grobelny            'src/test_sensor_cache.cpp',
43*e2362796SWludzik, Jozef            'src/test_transform.cpp',
44b5645947SKrzysztof Grobelny            'src/test_unique_call.cpp',
457f06f613SKrzysztof Grobelny            'src/utils/generate_unique_mock_id.cpp',
4673da6906SKrzysztof Grobelny        ],
4773da6906SKrzysztof Grobelny        dependencies: [
4873da6906SKrzysztof Grobelny            boost,
4973da6906SKrzysztof Grobelny            gmock_dep,
5073da6906SKrzysztof Grobelny            gtest_dep,
5173da6906SKrzysztof Grobelny            nlohmann_json,
5273da6906SKrzysztof Grobelny            phosphor_logging,
5373da6906SKrzysztof Grobelny            sdbusplus,
5473da6906SKrzysztof Grobelny        ],
557f06f613SKrzysztof Grobelny        include_directories: ['../src', 'src']
5673da6906SKrzysztof Grobelny    )
5773da6906SKrzysztof Grobelny)
58