xref: /openbmc/openpower-vpd-parser/test/meson.build (revision a4a2adfa96d2c491b1baf776013a6442bc88c78b)
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
14libgpiodcxx = dependency('libgpiodcxx')
15dependecy_list = [gtest_dep, gmock_dep, sdbusplus, phosphor_logging, phosphor_dbus_interfaces, libgpiodcxx]
16
17configuration_inc = include_directories('..', '../vpd-manager', 'vpd-manager-test', '../vpd-parser')
18
19vpd_test = ['store/store.cpp',
20            'ipz_parser/parser.cpp',
21            'keyword_vpd_parser_test/kw_vpd_test.cpp',
22            'vpd-manager-test/reader_test.cpp',
23            'vpd-manager-test/editor_test.cpp'
24]
25
26application_src =['../impl.cpp',
27                   '../vpd-parser/ipz_parser.cpp',
28                   '../ibm_vpd_utils.cpp',
29                   '../common_utility.cpp',
30                   '../vpd-manager/reader_impl.cpp',
31                   '../vpd-parser/keyword_vpd_parser.cpp',
32                   '../vpd-manager/editor_impl.cpp',
33                   '../vpd-parser/parser_factory.cpp',
34                   '../vpd-parser/memory_vpd_parser.cpp'
35                  ]
36
37foreach t : vpd_test
38    test(t, executable(t.underscorify(),
39            [t, application_src],
40    build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
41    link_args: dynamic_linker,
42    cpp_args: ['-DIPZ_PARSER', '-DManagerTest'],
43    c_args: ['-Wno-unused-parameter',
44      '-Wno-unused-variable'],
45    dependencies: dependecy_list,
46    include_directories: configuration_inc,
47    link_with : libvpdecc,
48    ),
49    workdir: meson.current_source_dir())
50endforeach
51