xref: /openbmc/telemetry/tests/meson.build (revision 76833cb5ce1d3b55c060cd145812a7a4a7ac9c31)
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',
33*76833cb5SWludzik, Jozef            '../src/trigger.cpp',
34*76833cb5SWludzik, Jozef            '../src/trigger_manager.cpp',
35b5645947SKrzysztof Grobelny            'src/dbus_environment.cpp',
36b5645947SKrzysztof Grobelny            'src/main.cpp',
37b5645947SKrzysztof Grobelny            'src/stubs/dbus_sensor_object.cpp',
38b5645947SKrzysztof Grobelny            'src/test_detached_timer.cpp',
39c8e3a64aSKrzysztof Grobelny            'src/test_metric.cpp',
4073da6906SKrzysztof Grobelny            'src/test_persistent_json_storage.cpp',
412f9f9b87SWludzik, Jozef            'src/test_report.cpp',
422f9f9b87SWludzik, Jozef            'src/test_report_manager.cpp',
43b5645947SKrzysztof Grobelny            'src/test_sensor.cpp',
447f06f613SKrzysztof Grobelny            'src/test_sensor_cache.cpp',
45e2362796SWludzik, Jozef            'src/test_transform.cpp',
46*76833cb5SWludzik, Jozef            'src/test_trigger.cpp',
47*76833cb5SWludzik, Jozef            'src/test_trigger_manager.cpp',
48b5645947SKrzysztof Grobelny            'src/test_unique_call.cpp',
497f06f613SKrzysztof Grobelny            'src/utils/generate_unique_mock_id.cpp',
5073da6906SKrzysztof Grobelny        ],
5173da6906SKrzysztof Grobelny        dependencies: [
5273da6906SKrzysztof Grobelny            boost,
5373da6906SKrzysztof Grobelny            gmock_dep,
5473da6906SKrzysztof Grobelny            gtest_dep,
5573da6906SKrzysztof Grobelny            nlohmann_json,
5673da6906SKrzysztof Grobelny            phosphor_logging,
5773da6906SKrzysztof Grobelny            sdbusplus,
5873da6906SKrzysztof Grobelny        ],
597f06f613SKrzysztof Grobelny        include_directories: ['../src', 'src']
606ccfcbf5SKrzysztof Grobelny    ),
616ccfcbf5SKrzysztof Grobelny    timeout: 120,
6273da6906SKrzysztof Grobelny)
63