blob: 4ec6c0e7fe742402873363b1144e1b58647f6629 [file] [log] [blame]
Lei YU5e0dcb32019-08-02 18:04:34 +08001oe_sdk = get_option('oe-sdk')
2if 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]
12else
13 dynamic_linker = []
14endif
15
16gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
17gmock = dependency('gmock', disabler: true, required: build_tests)
18
19configure_file(output: 'config.h',
20 configuration: cdata,
21)
22test_inc = include_directories('.')
23
Lei YUf77189f2019-08-07 14:26:30 +080024test_util = executable(
25 'test_util',
Lei YU5e0dcb32019-08-02 18:04:34 +080026 '../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 YUad90ad52019-08-06 11:19:28 +080037 ssl,
Lei YU5e0dcb32019-08-02 18:04:34 +080038 ])
39
Lei YUf77189f2019-08-07 14:26:30 +080040test_item_updater = executable(
41 'test_item_updater',
42 '../src/activation.cpp',
43 '../src/item_updater.cpp',
44 '../src/version.cpp',
45 'test_item_updater.cpp',
46 include_directories: [psu_inc, test_inc],
47 link_args: dynamic_linker,
48 build_rpath: oe_sdk.enabled() ? rpath : '',
49 dependencies: [
50 gtest,
51 gmock,
52 phosphor_logging,
53 phosphor_dbus_interfaces,
54 sdbusplus,
55 ssl,
56 ])
57
58test('util', test_util)
59test('item_updater', test_item_updater)