xref: /openbmc/pldm/test/meson.build (revision 1f4df219)
1if get_option('oe-sdk').enabled()
2  # Setup OE SYSROOT
3  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
4  if OECORE_TARGET_SYSROOT == ''
5      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
6  endif
7  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
8  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
9  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
10  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
11else
12  dynamic_linker = []
13endif
14
15gtest = dependency('gtest', main: true, disabler: true, required: true)
16gmock = dependency('gmock', disabler: true, required: true)
17pldmd = declare_dependency(sources: '../instance_id.cpp')
18
19tests = [
20  'libpldm_base_test',
21  'libpldm_platform_test',
22  'libpldmresponder_base_test',
23  'libpldm_bios_test',
24  'libpldm_bios_table_test',
25  'libpldmresponder_bios_test',
26  'libpldmresponder_pdr_state_effecter_test',
27  'libpldmresponder_bios_table_test',
28  'libpldmresponder_platform_test',
29  'libpldm_fru_test',
30  'libpldm_utils_test',
31  'pldmd_instanceid_test',
32  'pldmd_registration_test',
33  'pldm_utils_test',
34  'libpldmresponder_fru_test'
35]
36
37if get_option('oem-ibm').enabled()
38  tests += [
39    '../oem/ibm/test/libpldm_fileio_test',
40    '../oem/ibm/test/libpldmresponder_fileio_test'
41  ]
42endif
43
44foreach t : tests
45  test(t, executable(t.underscorify(), t + '.cpp',
46                     implicit_include_directories: false,
47                     link_args: dynamic_linker,
48                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
49                     dependencies: [
50                         libpldm,
51                         libpldmresponder,
52                         libpldmutils,
53                         gtest,
54                         gmock,
55                         pldmd,
56                         dependency('phosphor-dbus-interfaces'),
57                         dependency('sdbusplus')]),
58       workdir: meson.current_source_dir())
59endforeach
60