xref: /openbmc/telemetry/tests/meson.build (revision b5645947c66135d64c016b7cbc8aee392deb1822)
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'),
9*b5645947SKrzysztof 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        [
2673da6906SKrzysztof Grobelny            '../src/persistent_json_storage.cpp',
277f06f613SKrzysztof Grobelny            '../src/report.cpp',
287f06f613SKrzysztof Grobelny            '../src/report_manager.cpp',
29*b5645947SKrzysztof Grobelny            '../src/sensor.cpp',
307f06f613SKrzysztof Grobelny            '../src/sensor_cache.cpp',
31*b5645947SKrzysztof Grobelny            'src/dbus_environment.cpp',
32*b5645947SKrzysztof Grobelny            'src/main.cpp',
33*b5645947SKrzysztof Grobelny            'src/stubs/dbus_sensor_object.cpp',
34*b5645947SKrzysztof Grobelny            'src/test_detached_timer.cpp',
3573da6906SKrzysztof Grobelny            'src/test_persistent_json_storage.cpp',
36*b5645947SKrzysztof Grobelny            'src/test_sensor.cpp',
377f06f613SKrzysztof Grobelny            'src/test_sensor_cache.cpp',
38*b5645947SKrzysztof Grobelny            'src/test_unique_call.cpp',
397f06f613SKrzysztof Grobelny            'src/utils/generate_unique_mock_id.cpp',
4073da6906SKrzysztof Grobelny        ],
4173da6906SKrzysztof Grobelny        dependencies: [
4273da6906SKrzysztof Grobelny            boost,
4373da6906SKrzysztof Grobelny            gmock_dep,
4473da6906SKrzysztof Grobelny            gtest_dep,
4573da6906SKrzysztof Grobelny            nlohmann_json,
4673da6906SKrzysztof Grobelny            phosphor_logging,
4773da6906SKrzysztof Grobelny            sdbusplus,
4873da6906SKrzysztof Grobelny        ],
497f06f613SKrzysztof Grobelny        include_directories: ['../src', 'src']
5073da6906SKrzysztof Grobelny    )
5173da6906SKrzysztof Grobelny)
52