blob: 9bf34ed6ac7e03247706497dabc374d036a4c6ae [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 = [
Patrick Williamsa5171972021-04-16 20:10:01 -050027 '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',
Patrick Williamsa5171972021-04-16 20:10:01 -050034]
35foreach t : tests
36 test(
37 'test_' + t.underscorify(),
38 executable(
39 'test-' + t.underscorify(),
40 t + '.cpp',
William A. Kennington IIIb6b25572021-05-19 17:09:41 -070041 'common.cpp',
Patrick Williamsa5171972021-04-16 20:10:01 -050042 log_manager_sources,
43 '../phosphor-rsyslog-config/server-conf.cpp',
Patrick Williamsa5171972021-04-16 20:10:01 -050044 dependencies: [
Patrick Williamsa5171972021-04-16 20:10:01 -050045 gmock_dep,
46 gtest_dep,
Patrick Williamsd9f0d642021-04-21 15:43:21 -050047 log_manager_deps,
William A. Kennington IIIe0538842021-06-11 02:01:58 -070048 phosphor_logging_dep,
Patrick Williamsa5171972021-04-16 20:10:01 -050049 ],
50 include_directories: include_directories('..', '../gen'),
51 )
52 )
53endforeach
Lei YU972dd4f2023-12-12 04:04:19 +000054
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