blob: 36f87fff9474e4919ddf77b5a314f70c0efca779 [file] [log] [blame]
Lei YU5e0dcb32019-08-02 18:04:34 +08001oe_sdk = get_option('oe-sdk')
Patrick Williamsce6c5c52023-11-29 06:44:33 -06002if oe_sdk.allowed()
Patrick Williams8a08ac12025-02-01 08:37:15 -05003 # Setup OE SYSROOT
4 OECORE_TARGET_SYSROOT = run_command(
5 'sh',
6 '-c',
7 'echo $OECORE_TARGET_SYSROOT',
8 ).stdout().strip()
9 if OECORE_TARGET_SYSROOT == ''
10 error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
11 endif
12 message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
13 rpath = ':'.join(
14 [OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'],
15 )
16 ld_so = run_command(
17 'sh',
18 '-c',
19 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1',
20 ).stdout().strip()
21 dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
Lei YU5e0dcb32019-08-02 18:04:34 +080022else
Patrick Williams8a08ac12025-02-01 08:37:15 -050023 dynamic_linker = []
Lei YU5e0dcb32019-08-02 18:04:34 +080024endif
25
26gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
27gmock = dependency('gmock', disabler: true, required: build_tests)
28
Patrick Williams8a08ac12025-02-01 08:37:15 -050029configure_file(output: 'config.h', configuration: cdata)
Lei YU5e0dcb32019-08-02 18:04:34 +080030test_inc = include_directories('.')
31
Lei YUf77189f2019-08-07 14:26:30 +080032test_util = executable(
Patrick Williams8a08ac12025-02-01 08:37:15 -050033 'test_util',
34 '../src/utils.cpp',
35 'test_utils.cpp',
36 include_directories: [psu_inc, test_inc],
37 link_args: dynamic_linker,
38 build_rpath: oe_sdk.allowed() ? rpath : '',
39 dependencies: [
40 gtest,
41 gmock,
42 phosphor_logging,
43 phosphor_dbus_interfaces,
44 sdbusplus,
45 ssl,
46 ],
47)
Lei YU5e0dcb32019-08-02 18:04:34 +080048
Lei YU12c9f4c2019-09-11 15:08:15 +080049test_phosphor_psu_manager = executable(
Patrick Williams8a08ac12025-02-01 08:37:15 -050050 'test_phosphor_psu_manager',
51 '../src/activation.cpp',
52 '../src/item_updater.cpp',
53 '../src/version.cpp',
54 'test_item_updater.cpp',
55 'test_activation.cpp',
56 'test_version.cpp',
57 include_directories: [psu_inc, test_inc],
58 link_args: dynamic_linker,
59 build_rpath: oe_sdk.allowed() ? rpath : '',
60 dependencies: [
61 gtest,
62 gmock,
63 phosphor_logging,
64 phosphor_dbus_interfaces,
65 sdbusplus,
66 ssl,
67 ],
68)
Lei YUf77189f2019-08-07 14:26:30 +080069
70test('util', test_util)
Lei YU58c26e32019-09-27 17:52:06 +080071#test('phosphor_psu_manager', test_phosphor_psu_manager)
Patrick Williams8a08ac12025-02-01 08:37:15 -050072test(
73 'phosphor_psu_manager',
74 test_phosphor_psu_manager,
75 workdir: meson.current_source_dir(),
76)