blob: 1538b7f2df8c6b8179ca6bdd8df30f65985c4bb5 [file] [log] [blame]
Patrick Williamsa5171972021-04-16 20:10:01 -05001gtest_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
Patrick Williamsd9f0d642021-04-21 15:43:21 -050022if not get_option('openpower-pel-extension').disabled()
23 subdir('openpower-pels')
24endif
25
Patrick Williamsa5171972021-04-16 20:10:01 -050026tests = [
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: [
Patrick Williamsa5171972021-04-16 20:10:01 -050052 gmock_dep,
53 gtest_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050054 log_manager_deps,
Patrick Williamsa5171972021-04-16 20:10:01 -050055 ],
56 include_directories: include_directories('..', '../gen'),
57 )
58 )
59endforeach