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