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