Lei YU | 5e0dcb3 | 2019-08-02 18:04:34 +0800 | [diff] [blame] | 1 | oe_sdk = get_option('oe-sdk') |
| 2 | if oe_sdk.enabled() |
| 3 | # Setup OE SYSROOT |
| 4 | OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip() |
| 5 | if OECORE_TARGET_SYSROOT == '' |
| 6 | error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.') |
| 7 | endif |
| 8 | message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT) |
| 9 | rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib']) |
| 10 | ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip() |
| 11 | dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so] |
| 12 | else |
| 13 | dynamic_linker = [] |
| 14 | endif |
| 15 | |
| 16 | gtest = dependency('gtest', main: true, disabler: true, required: build_tests) |
| 17 | gmock = dependency('gmock', disabler: true, required: build_tests) |
| 18 | |
| 19 | configure_file(output: 'config.h', |
| 20 | configuration: cdata, |
| 21 | ) |
| 22 | test_inc = include_directories('.') |
| 23 | |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 24 | test_util = executable( |
| 25 | 'test_util', |
Lei YU | 5e0dcb3 | 2019-08-02 18:04:34 +0800 | [diff] [blame] | 26 | '../src/utils.cpp', |
| 27 | 'test_utils.cpp', |
| 28 | include_directories: [psu_inc, test_inc], |
| 29 | link_args: dynamic_linker, |
| 30 | build_rpath: oe_sdk.enabled() ? rpath : '', |
| 31 | dependencies: [ |
| 32 | gtest, |
| 33 | gmock, |
| 34 | phosphor_logging, |
| 35 | phosphor_dbus_interfaces, |
| 36 | sdbusplus, |
Lei YU | ad90ad5 | 2019-08-06 11:19:28 +0800 | [diff] [blame] | 37 | ssl, |
Lei YU | 5e0dcb3 | 2019-08-02 18:04:34 +0800 | [diff] [blame] | 38 | ]) |
| 39 | |
Lei YU | 12c9f4c | 2019-09-11 15:08:15 +0800 | [diff] [blame] | 40 | test_phosphor_psu_manager = executable( |
| 41 | 'test_phosphor_psu_manager', |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 42 | '../src/activation.cpp', |
| 43 | '../src/item_updater.cpp', |
| 44 | '../src/version.cpp', |
| 45 | 'test_item_updater.cpp', |
Lei YU | 12c9f4c | 2019-09-11 15:08:15 +0800 | [diff] [blame] | 46 | 'test_activation.cpp', |
Lei YU | fda15a3 | 2019-09-19 14:43:02 +0800 | [diff] [blame] | 47 | 'test_version.cpp', |
Lei YU | f77189f | 2019-08-07 14:26:30 +0800 | [diff] [blame] | 48 | include_directories: [psu_inc, test_inc], |
| 49 | link_args: dynamic_linker, |
| 50 | build_rpath: oe_sdk.enabled() ? rpath : '', |
| 51 | dependencies: [ |
| 52 | gtest, |
| 53 | gmock, |
| 54 | phosphor_logging, |
| 55 | phosphor_dbus_interfaces, |
| 56 | sdbusplus, |
| 57 | ssl, |
| 58 | ]) |
| 59 | |
| 60 | test('util', test_util) |
Lei YU | 58c26e3 | 2019-09-27 17:52:06 +0800 | [diff] [blame] | 61 | #test('phosphor_psu_manager', test_phosphor_psu_manager) |
| 62 | test('phosphor_psu_manager', test_phosphor_psu_manager, workdir: meson.current_source_dir()) |