blob: dba787025d9a719d390b0401ee6af6e6d68c3b69 [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 Jefferycc45aed2023-09-10 23:03:29 +093027 'responder',
Andrew Jeffery9c766792022-08-10 23:12:49 +093028]
29
Andrew Jefferyba05dba2023-08-29 14:43:04 +093030if get_option('abi').contains('testing')
Andrew Jeffery2aa237d2023-09-22 18:21:06 +093031 tests += [
32 'transport',
33 'transport/send_recv_one',
34 'transport/send_recv_timeout',
35 'transport/send_recv_unwanted',
36 'transport/send_recv_wrong_pldm_type',
37 'transport/send_recv_wrong_command_code'
38 ]
Andrew Jefferyba05dba2023-08-29 14:43:04 +093039endif
40
Andrew Jeffery8de8e1e2023-06-09 14:37:18 +093041if get_option('oem-ibm').allowed()
Andrew Jeffery9c766792022-08-10 23:12:49 +093042 tests += [
43 'oem/ibm/libpldm_fileio_test',
44 'oem/ibm/libpldm_host_test',
45 ]
46endif
47
Delphine CC Chiu22fad392023-10-27 11:05:01 +080048if get_option('oem-meta').allowed()
49 tests += [
50 'oem/meta/libpldm_fileio_test',
51 ]
52endif
53
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103054test_include_dirs = [ libpldm_include_dir, include_directories('../src') ]
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103055
Andrew Jeffery9c766792022-08-10 23:12:49 +093056foreach t : tests
57 test(t, executable(t.underscorify(), t + '.cpp',
58 implicit_include_directories: false,
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103059 include_directories: test_include_dirs,
Andrew Jeffery9c766792022-08-10 23:12:49 +093060 dependencies: [
61 libpldm_dep,
62 gtest_dep,
63 gmock_dep]),
64 workdir: meson.current_source_dir())
65endforeach
66
Andrew Jeffery73d91762023-06-28 12:19:19 +093067test('bios_table_iter', executable('bios_table_iter',
68 'bios_table_iter.c',
69 implicit_include_directories: false,
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103070 include_directories: test_include_dirs))
Andrew Jeffery73d91762023-06-28 12:19:19 +093071
Andrew Jefferyc63f63a2023-02-24 22:29:33 +103072test('msgbuf_generic', executable('msgbuf_generic',
73 'msgbuf_generic.c',
74 implicit_include_directories: false,
Andrew Jefferyb0c1d202023-11-07 22:08:44 +103075 include_directories: test_include_dirs))