SunnySrivastava1984 | 7ef5442 | 2019-12-03 02:47:37 -0600 | [diff] [blame^] | 1 | if 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] |
| 11 | else |
| 12 | dynamic_linker = [] |
| 13 | endif |
| 14 | |
| 15 | gmock = dependency('gmock', disabler: true, required: build_tests) |
| 16 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
| 17 | |
| 18 | application_src = ['../impl.cpp'] |
| 19 | |
| 20 | test('store_test', executable('store_test', |
| 21 | ['store/store.cpp', application_src], |
| 22 | build_rpath: get_option('oe-sdk').enabled() ? rpath : '', |
| 23 | |
| 24 | link_args: dynamic_linker, |
| 25 | dependencies: [ |
| 26 | gtest, |
| 27 | gmock, |
| 28 | sdbusplus, |
| 29 | phosphor_logging, |
| 30 | ], |
| 31 | include_directories: '..' |
| 32 | ), |
| 33 | workdir: meson.current_source_dir()) |
| 34 | |
| 35 | vpd_test = ['ipz_parser/parser.cpp', |
| 36 | 'keyword_vpd_parser_test/kw_vpd_test.cpp' |
| 37 | ] |
| 38 | application_src += ['../keyword_vpd_parser.cpp', |
| 39 | '../vpdecc/vpdecc.c', |
| 40 | '../vpdecc/vpdecc_support.c' |
| 41 | ] |
| 42 | foreach t : vpd_test |
| 43 | test(t, executable(t.underscorify(), |
| 44 | [t, application_src], |
| 45 | build_rpath: get_option('oe-sdk').enabled() ? rpath : '', |
| 46 | |
| 47 | link_args: dynamic_linker, |
| 48 | cpp_args: '-DIPZ_PARSER', |
| 49 | c_args: ['-Wno-unused-parameter', |
| 50 | '-Wno-unused-variable'], |
| 51 | dependencies: [ |
| 52 | gtest, |
| 53 | gmock, |
| 54 | sdbusplus, |
| 55 | phosphor_logging, |
| 56 | ], |
| 57 | include_directories: '..' |
| 58 | ), |
| 59 | workdir: meson.current_source_dir()) |
| 60 | endforeach |