xref: /openbmc/libpldm/tests/meson.build (revision 615344fc)
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: true)
5    gtest_dep = declare_dependency(
6        dependencies: [
7            dependency('threads'),
8            gtest_proj.dependency('gtest'),
9            gtest_proj.dependency('gtest_main'),
10        ],
11    )
12    gmock_dep = gtest_proj.dependency('gmock')
13endif
14
15test_include_dirs = [libpldm_include_dir, include_directories('../src')]
16
17tests = ['instance-id', 'msgbuf', 'responder', 'utils']
18
19subdir('dsp')
20
21# The 'test' transport APIs will never be marked stable as they are just for
22# testing.
23if get_option('abi').contains('testing')
24    subdir('transport')
25endif
26
27if get_option('oem-ibm').allowed()
28    subdir('oem/ibm')
29endif
30
31if get_option('oem-meta').allowed()
32    subdir('oem/meta')
33endif
34
35foreach t : tests
36    test(
37        t,
38        executable(
39            t.underscorify(),
40            t + '.cpp',
41            implicit_include_directories: false,
42            include_directories: test_include_dirs,
43            dependencies: [libpldm_dep, gtest_dep, gmock_dep],
44        ),
45        workdir: meson.current_source_dir(),
46    )
47endforeach
48
49test(
50    'msgbuf_generic',
51    executable(
52        'msgbuf_generic',
53        'msgbuf_generic.c',
54        implicit_include_directories: false,
55        include_directories: test_include_dirs,
56    ),
57)
58