blob: e9d88ec4d1d8a34286a64d1f541898c61877cb40 [file] [log] [blame]
Andrew Jeffery9c766792022-08-10 23:12:49 +09301gtest_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 = [
Andrew Jefferyb27cebf2023-04-24 11:17:05 +093017 'instance-id',
Andrew Jeffery9c766792022-08-10 23:12:49 +093018 'libpldm_base_test',
19 'libpldm_platform_test',
20 'libpldm_bios_test',
21 'libpldm_bios_table_test',
22 'libpldm_fru_test',
23 'libpldm_utils_test',
24 'libpldm_pdr_test',
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103025 'libpldm_firmware_update_test',
26 'msgbuf',
Andrew Jeffery9a6ba892023-07-18 22:22:14 +093027 'transport',
Andrew Jeffery9c766792022-08-10 23:12:49 +093028]
29
Andrew Jeffery8de8e1e2023-06-09 14:37:18 +093030if get_option('oem-ibm').allowed()
Andrew Jeffery9c766792022-08-10 23:12:49 +093031 tests += [
32 'oem/ibm/libpldm_fileio_test',
33 'oem/ibm/libpldm_host_test',
34 ]
35endif
36
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103037src_includes = include_directories('..' / 'src', '..' / 'include' / 'libpldm')
38
Andrew Jeffery9c766792022-08-10 23:12:49 +093039foreach t : tests
40 test(t, executable(t.underscorify(), t + '.cpp',
41 implicit_include_directories: false,
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103042 include_directories: src_includes,
Andrew Jeffery9c766792022-08-10 23:12:49 +093043 dependencies: [
44 libpldm_dep,
45 gtest_dep,
46 gmock_dep]),
47 workdir: meson.current_source_dir())
48endforeach
49
Andrew Jeffery73d91762023-06-28 12:19:19 +093050test('bios_table_iter', executable('bios_table_iter',
51 'bios_table_iter.c',
52 implicit_include_directories: false,
53 include_directories: src_includes))
54
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103055test('msgbuf_generic', executable('msgbuf_generic',
56 'msgbuf_generic.c',
57 implicit_include_directories: false,
58 include_directories: src_includes))