xref: /openbmc/pldm/test/meson.build (revision a18a1265)
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(
18          sources: [
19            '../instance_id.cpp',
20            '../dbus_impl_requester.cpp',
21            '../host_pdr_handler.cpp'])
22
23tests = [
24  'libpldmresponder_base_test',
25  'libpldmresponder_bios_test',
26  'libpldmresponder_bios_attribute_test',
27  'libpldmresponder_bios_string_attribute_test',
28  'libpldmresponder_bios_config_test',
29  'libpldmresponder_bios_integer_attribute_test',
30  'libpldmresponder_bios_enum_attribute_test',
31  'libpldmresponder_pdr_effecter_test',
32  'libpldmresponder_bios_table_test',
33  'libpldmresponder_platform_test',
34  'pldmd_instanceid_test',
35  'pldmd_registration_test',
36  'pldm_utils_test',
37  'libpldmresponder_fru_test',
38]
39
40if get_option('oem-ibm').enabled()
41  tests += [
42    '../oem/ibm/test/libpldmresponder_fileio_test'
43  ]
44endif
45
46foreach t : tests
47  test(t, executable(t.underscorify(), t + '.cpp',
48                     implicit_include_directories: false,
49                     link_args: dynamic_linker,
50                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
51                     dependencies: [
52                         libpldm,
53                         libpldmresponder,
54                         libpldmutils,
55                         gtest,
56                         gmock,
57                         pldmd,
58                         dependency('phosphor-dbus-interfaces'),
59                         dependency('sdeventplus'),
60                         dependency('sdbusplus')]),
61       workdir: meson.current_source_dir())
62endforeach
63