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