xref: /openbmc/libpldm/tests/meson.build (revision d480b704759dc6e112264672a4a4457132dd290a)
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
15
16tests = [
17  'instance-id',
18  'libpldm_base_test',
19  'libpldm_bios_table_test',
20  'libpldm_bios_test',
21  'libpldm_firmware_update_test',
22  'libpldm_fru_test',
23  'libpldm_pdr_test',
24  'libpldm_platform_test',
25  'libpldm_utils_test',
26  'msgbuf',
27  'responder',
28]
29
30# The 'test' transport APIs will never be marked stable as they are just for
31# testing.
32if get_option('abi').contains('testing')
33  subdir('transport')
34endif
35
36if get_option('oem-ibm').allowed()
37  subdir('oem/ibm')
38endif
39
40if get_option('oem-meta').allowed()
41  subdir('oem/meta')
42endif
43
44test_include_dirs = [ libpldm_include_dir, include_directories('../src') ]
45
46foreach t : tests
47  test(t, executable(t.underscorify(), t + '.cpp',
48                     implicit_include_directories: false,
49                     include_directories: test_include_dirs,
50                     dependencies: [
51                         libpldm_dep,
52                         gtest_dep,
53                         gmock_dep]),
54       workdir: meson.current_source_dir())
55endforeach
56
57test('bios_table_iter', executable('bios_table_iter',
58                                   'bios_table_iter.c',
59                                   implicit_include_directories: false,
60                                   include_directories: test_include_dirs))
61
62test('msgbuf_generic', executable('msgbuf_generic',
63                                  'msgbuf_generic.c',
64                                  implicit_include_directories: false,
65                                  include_directories: test_include_dirs))
66