xref: /openbmc/phosphor-logging/test/meson.build (revision d069f0da)
1gtest_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'),
9                gtest_proj.dependency('gtest'),
10                gtest_proj.dependency('gtest_main'),
11            ]
12        )
13        gmock_dep = gtest_proj.dependency('gmock')
14  else
15        assert(
16            not get_option('tests').enabled(),
17            'Googletest is required if tests are enabled'
18        )
19  endif
20endif
21
22if not get_option('openpower-pel-extension').disabled()
23    subdir('openpower-pels')
24endif
25
26tests = [
27    'extensions_test',
28    'remote_logging_test_address',
29    'remote_logging_test_config',
30    'remote_logging_test_port',
31    'sdtest',
32    'serialization_test_path',
33    'serialization_test_properties',
34]
35foreach t : tests
36    test(
37        'test_' + t.underscorify(),
38        executable(
39            'test-' + t.underscorify(),
40            t + '.cpp',
41            'common.cpp',
42            log_manager_sources,
43            '../phosphor-rsyslog-config/server-conf.cpp',
44            dependencies: [
45                gmock_dep,
46                gtest_dep,
47                log_manager_deps,
48                phosphor_logging_dep,
49            ],
50            include_directories: include_directories('..', '../gen'),
51        )
52    )
53endforeach
54
55tests_non_parallel = [
56    'elog_quiesce_test',
57    'elog_update_ts_test',
58    'elog_errorwrap_test',
59]
60
61foreach t : tests_non_parallel
62    test(
63        'test_' + t.underscorify(),
64        executable(
65            'test-' + t.underscorify(),
66            t + '.cpp',
67            'common.cpp',
68            log_manager_sources,
69            '../phosphor-rsyslog-config/server-conf.cpp',
70            dependencies: [
71                gmock_dep,
72                gtest_dep,
73                log_manager_deps,
74                phosphor_logging_dep,
75            ],
76            include_directories: include_directories('..', '../gen'),
77        ),
78        is_parallel: false,
79    )
80endforeach
81