xref: /openbmc/phosphor-logging/test/meson.build (revision 271408b5)
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    'elog_quiesce_test',
28    'elog_update_ts_test',
29    'extensions_test',
30    'remote_logging_test_address',
31    'remote_logging_test_config',
32    'remote_logging_test_port',
33    'sdtest',
34    'serialization_test_path',
35    'serialization_test_properties',
36    'elog_errorwrap_test',
37]
38foreach t : tests
39    test(
40        'test_' + t.underscorify(),
41        executable(
42            'test-' + t.underscorify(),
43            t + '.cpp',
44            log_manager_sources,
45            '../phosphor-rsyslog-config/server-conf.cpp',
46            link_with: libphosphor_logging,
47            cpp_args: [
48                '-DTESTCASE=' + t.underscorify(),
49                '-DTESTCASE_' + t.underscorify(),
50            ],
51            dependencies: [
52                gmock_dep,
53                gtest_dep,
54                log_manager_deps,
55            ],
56            include_directories: include_directories('..', '../gen'),
57        )
58    )
59endforeach
60