Lei YU | f357b5a | 2020-02-27 11:52:39 +0800 | [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 | gtest = dependency('gtest', main: true, disabler: true, required: true) |
| 16 | gmock = dependency('gmock', disabler: true, required: true) |
| 17 | |
| 18 | tests = [ |
| 19 | 'libpldm_base_test', |
| 20 | 'libpldm_platform_test', |
| 21 | 'libpldm_bios_test', |
| 22 | 'libpldm_bios_table_test', |
| 23 | 'libpldm_fru_test', |
| 24 | 'libpldm_utils_test', |
| 25 | 'libpldm_pdr_test' |
| 26 | ] |
| 27 | |
| 28 | if get_option('oem-ibm').enabled() |
| 29 | tests += [ |
| 30 | '../../oem/ibm/test/libpldm_fileio_test', |
George Liu | 9008d28 | 2020-03-12 11:20:35 +0800 | [diff] [blame] | 31 | '../../oem/ibm/test/libpldm_host_test', |
Lei YU | f357b5a | 2020-02-27 11:52:39 +0800 | [diff] [blame] | 32 | ] |
| 33 | endif |
| 34 | |
| 35 | foreach t : tests |
| 36 | test(t, executable(t.underscorify(), t + '.cpp', |
| 37 | implicit_include_directories: false, |
| 38 | link_args: dynamic_linker, |
| 39 | build_rpath: get_option('oe-sdk').enabled() ? rpath : '', |
| 40 | dependencies: [ |
| 41 | libpldm, |
| 42 | gtest, |
| 43 | gmock]), |
| 44 | workdir: meson.current_source_dir()) |
| 45 | endforeach |
| 46 | |