xref: /openbmc/openpower-hw-diags/test/meson.build (revision 08c21c256309cbfe10b2dd7c55b68e86fb8a4640)
18018391dSZane Shelley# Get the gtest/gmock dependencies.
28018391dSZane Shelleygtest_dep = dependency('gtest', main: true, disabler: true, required: false)
38018391dSZane Shelleygmock_dep = dependency('gmock', disabler: true, required: false)
48018391dSZane Shelleyif not gtest_dep.found() or not gmock_dep.found()
58018391dSZane Shelley    cmake = import('cmake')
68018391dSZane Shelley    gtest_proj = cmake.subproject('googletest',
78018391dSZane Shelley                                  required: false)
88018391dSZane Shelley    if gtest_proj.found()
98018391dSZane Shelley        gtest_dep = declare_dependency(
108018391dSZane Shelley            dependencies: [
118018391dSZane Shelley                dependency('threads'),
128018391dSZane Shelley                gtest_proj.dependency('gtest'),
138018391dSZane Shelley                gtest_proj.dependency('gtest_main'),
148018391dSZane Shelley            ]
158018391dSZane Shelley        )
168018391dSZane Shelley        gmock_dep = gtest_proj.dependency('gmock')
178018391dSZane Shelley    else
188018391dSZane Shelley        assert(not get_option('tests').enabled(),
198018391dSZane Shelley               'Googletest is required if tests are enabled')
208018391dSZane Shelley    endif
218018391dSZane Shelleyendif
228018391dSZane Shelley
23*08c21c25SZane Shelley# NOTE: We cannot link to `util_lib` because that is built without
24*08c21c25SZane Shelley#       `-DTEST_TRACE` and any of the util functions that use `trace.hpp` will
25*08c21c25SZane Shelley#       throw a linker error because we don't have access to phosphor-logging
26*08c21c25SZane Shelley#       in test ... yet.
27*08c21c25SZane Shelley
280c44c2feSZane Shelleytest_arg = [
290c44c2feSZane Shelley    '-DTEST_TRACE',
300c44c2feSZane Shelley]
310c44c2feSZane Shelley
32afc6acdaSZane Shelley# Compile the test dts into a binary for pdbg.
33afc6acdaSZane Shelleypdbg_test_dtb = custom_target('build_pdbg_test_dtb',
34*08c21c25SZane Shelley    input   : files('pdbg-test.dts'),
35*08c21c25SZane Shelley    output  : 'pdbg-test.dtb',
36afc6acdaSZane Shelley    command : [ find_program('dtc'), '-I', 'dts', '-O', 'dtb',
37afc6acdaSZane Shelley                '-o', '@OUTPUT@', '@INPUT@' ])
38afc6acdaSZane Shelley
39d195b716SZane Shelleypdbg_env = 'PDBG_DTB=' + pdbg_test_dtb.full_path()
40d195b716SZane Shelley
419ae5ca41SBen Tyner# end2end code exerciser for experiment and testing
429ae5ca41SBen Tynersubdir('end2end')
439ae5ca41SBen Tyner
44*08c21c25SZane Shelley################################################################################
45*08c21c25SZane Shelley
46*08c21c25SZane Shelleytc = 'test-bin-stream'
47*08c21c25SZane Shelley
48*08c21c25SZane Shelleysrc = [
49*08c21c25SZane Shelley  files(
50*08c21c25SZane Shelley    tc + '.cpp',
51*08c21c25SZane Shelley  ),
52248cbf83SZane Shelley]
53248cbf83SZane Shelley
54*08c21c25SZane Shelleydep = [ gtest_dep ]
55*08c21c25SZane Shelley
56*08c21c25SZane Shelleyvar = [ ]
57*08c21c25SZane Shelley
58*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
59*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
60*08c21c25SZane Shelley
61*08c21c25SZane Shelleytest(tc, exe, env: var)
62*08c21c25SZane Shelley
63*08c21c25SZane Shelley################################################################################
64*08c21c25SZane Shelley
65*08c21c25SZane Shelleytc = 'test-ffdc-file'
66*08c21c25SZane Shelley
67*08c21c25SZane Shelleysrc = [
68*08c21c25SZane Shelley  files(
69*08c21c25SZane Shelley    tc + '.cpp',
70*08c21c25SZane Shelley    '../util/ffdc_file.cpp',
71*08c21c25SZane Shelley    '../util/temporary_file.cpp',
72*08c21c25SZane Shelley  ),
73*08c21c25SZane Shelley]
74*08c21c25SZane Shelley
75*08c21c25SZane Shelleydep = [ gtest_dep ]
76*08c21c25SZane Shelley
77*08c21c25SZane Shelleyvar = [ ]
78*08c21c25SZane Shelley
79*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
80*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
81*08c21c25SZane Shelley
82*08c21c25SZane Shelleytest(tc, exe, env: var)
83*08c21c25SZane Shelley
84*08c21c25SZane Shelley################################################################################
85*08c21c25SZane Shelley
86*08c21c25SZane Shelleytc = 'test-lpc-timeout'
87*08c21c25SZane Shelley
88*08c21c25SZane Shelleysrc = [
89*08c21c25SZane Shelley  files(
90*08c21c25SZane Shelley    tc + '.cpp',
912c228cdcSZane Shelley    '../analyzer/plugins/p10-plugins.cpp',
92979e2871SZane Shelley    '../analyzer/service_data.cpp',
93cb766a45SZane Shelley    '../util/pdbg.cpp',
94e90b85dcSZane Shelley    'pdbg-sim-only.cpp',
95*08c21c25SZane Shelley  ),
96*08c21c25SZane Shelley  pdbg_test_dtb,
97*08c21c25SZane Shelley]
98e90b85dcSZane Shelley
99*08c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ]
100*08c21c25SZane Shelley
101*08c21c25SZane Shelleyvar = [ pdbg_env ]
102*08c21c25SZane Shelley
103*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
104*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
105*08c21c25SZane Shelley
106*08c21c25SZane Shelleytest(tc, exe, env: var)
107*08c21c25SZane Shelley
108*08c21c25SZane Shelley################################################################################
109*08c21c25SZane Shelley
110*08c21c25SZane Shelleytc = 'test-pdbg-dts'
111*08c21c25SZane Shelley
112*08c21c25SZane Shelleysrc = [
113*08c21c25SZane Shelley  files(
114*08c21c25SZane Shelley    tc + '.cpp',
115*08c21c25SZane Shelley    '../util/pdbg.cpp',
116*08c21c25SZane Shelley  ),
117*08c21c25SZane Shelley  pdbg_test_dtb,
118*08c21c25SZane Shelley]
119*08c21c25SZane Shelley
120*08c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ]
121*08c21c25SZane Shelley
122*08c21c25SZane Shelleyvar = [ pdbg_env ]
123*08c21c25SZane Shelley
124*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
125*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
126*08c21c25SZane Shelley
127*08c21c25SZane Shelleytest(tc, exe, env: var)
128*08c21c25SZane Shelley
129*08c21c25SZane Shelley################################################################################
130*08c21c25SZane Shelley
131*08c21c25SZane Shelleytc = 'test-pll-unlock'
132*08c21c25SZane Shelley
133*08c21c25SZane Shelleysrc = [
134*08c21c25SZane Shelley  files(
135*08c21c25SZane Shelley    tc + '.cpp',
136*08c21c25SZane Shelley    '../analyzer/plugins/p10-plugins.cpp',
137*08c21c25SZane Shelley    '../analyzer/service_data.cpp',
138*08c21c25SZane Shelley    '../util/pdbg.cpp',
139*08c21c25SZane Shelley    'pdbg-sim-only.cpp',
140*08c21c25SZane Shelley  ),
141*08c21c25SZane Shelley  pdbg_test_dtb,
142*08c21c25SZane Shelley]
143*08c21c25SZane Shelley
144*08c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ]
145*08c21c25SZane Shelley
146*08c21c25SZane Shelleyvar = [ pdbg_env ]
147*08c21c25SZane Shelley
148*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
149*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
150*08c21c25SZane Shelley
151*08c21c25SZane Shelleytest(tc, exe, env: var)
152*08c21c25SZane Shelley
153*08c21c25SZane Shelley################################################################################
154*08c21c25SZane Shelley
155*08c21c25SZane Shelleytc = 'test-resolution'
156*08c21c25SZane Shelley
157*08c21c25SZane Shelleysrc = [
158*08c21c25SZane Shelley  files(
159*08c21c25SZane Shelley    tc + '.cpp',
160*08c21c25SZane Shelley    '../analyzer/resolution.cpp',
161*08c21c25SZane Shelley    '../analyzer/service_data.cpp',
162*08c21c25SZane Shelley    '../util/pdbg.cpp',
163*08c21c25SZane Shelley  ),
164*08c21c25SZane Shelley  pdbg_test_dtb,
165*08c21c25SZane Shelley]
166*08c21c25SZane Shelley
167*08c21c25SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ]
168*08c21c25SZane Shelley
169*08c21c25SZane Shelleyvar = [ pdbg_env ]
170*08c21c25SZane Shelley
171*08c21c25SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
172*08c21c25SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
173*08c21c25SZane Shelley
174*08c21c25SZane Shelleytest(tc, exe, env: var)
175d195b716SZane Shelley
176d195b716SZane Shelley################################################################################
177d195b716SZane Shelley
178d195b716SZane Shelleytc = 'test-tod-step-check-fault'
179d195b716SZane Shelley
180d195b716SZane Shelleysrc = [
181d195b716SZane Shelley  files(
182d195b716SZane Shelley    tc + '.cpp',
183d195b716SZane Shelley    '../analyzer/plugins/p10-tod-plugins.cpp',
184d195b716SZane Shelley    '../analyzer/service_data.cpp',
185d195b716SZane Shelley    '../util/pdbg.cpp',
186d195b716SZane Shelley  ),
187d195b716SZane Shelley  pdbg_test_dtb,
188d195b716SZane Shelley]
189d195b716SZane Shelley
190d195b716SZane Shelleydep = [ libhei_dep, libpdbg_dep, gtest_dep ]
191d195b716SZane Shelley
192d195b716SZane Shelleyvar = [ pdbg_env ]
193d195b716SZane Shelley
194d195b716SZane Shelleyexe = executable(tc.underscorify(), src, dependencies: dep,
195d195b716SZane Shelley                 cpp_args: test_arg, include_directories: incdir)
196d195b716SZane Shelley
197d195b716SZane Shelleytest(tc, exe, env: var)
198d195b716SZane Shelley
199