Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [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 | |
Patrick Williams | 70c7488 | 2021-04-19 11:43:10 -0500 | [diff] [blame] | 15 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 16 | gmock = dependency('gmock', disabler: true, required: false) |
| 17 | if not gtest.found() or not gmock.found() |
| 18 | gtest_proj = import('cmake').subproject('googletest', required: false) |
| 19 | if gtest_proj.found() |
| 20 | gtest = declare_dependency( |
| 21 | dependencies: [ |
| 22 | dependency('threads'), |
| 23 | gtest_proj.dependency('gtest'), |
| 24 | gtest_proj.dependency('gtest_main'), |
| 25 | ] |
| 26 | ) |
| 27 | gmock = gtest_proj.dependency('gmock') |
| 28 | else |
| 29 | assert( |
| 30 | not get_option('tests').enabled(), |
| 31 | 'Googletest is required if tests are enabled' |
| 32 | ) |
| 33 | endif |
| 34 | endif |
| 35 | |
Pavithra Barithaya | 51efaf8 | 2020-04-02 02:42:27 -0500 | [diff] [blame] | 36 | pldmd = declare_dependency( |
| 37 | sources: [ |
Deepak Kodihalli | 1521f6d | 2020-06-16 08:51:02 -0500 | [diff] [blame] | 38 | '../pldmd/instance_id.cpp', |
| 39 | '../pldmd/dbus_impl_requester.cpp', |
Deepak Kodihalli | ac19bd6 | 2020-06-16 08:25:23 -0500 | [diff] [blame] | 40 | '../host-bmc/host_pdr_handler.cpp', |
| 41 | '../host-bmc/dbus_to_host_effecters.cpp']) |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 42 | |
| 43 | tests = [ |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 44 | 'libpldmresponder_base_test', |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 45 | 'libpldmresponder_bios_test', |
John Wang | e2efdcc | 2020-02-12 17:02:06 +0800 | [diff] [blame] | 46 | 'libpldmresponder_bios_attribute_test', |
John Wang | 29683b5 | 2020-02-27 16:41:44 +0800 | [diff] [blame] | 47 | 'libpldmresponder_bios_string_attribute_test', |
John Wang | d965934 | 2020-02-27 16:46:05 +0800 | [diff] [blame] | 48 | 'libpldmresponder_bios_config_test', |
John Wang | 95e6b3c | 2020-02-13 09:43:24 +0800 | [diff] [blame] | 49 | 'libpldmresponder_bios_integer_attribute_test', |
John Wang | 3be7085 | 2020-02-13 15:59:04 +0800 | [diff] [blame] | 50 | 'libpldmresponder_bios_enum_attribute_test', |
George Liu | 456c9a2 | 2020-01-13 11:36:22 +0800 | [diff] [blame] | 51 | 'libpldmresponder_pdr_effecter_test', |
George Liu | 4371f2b | 2020-05-09 19:55:18 +0800 | [diff] [blame] | 52 | 'libpldmresponder_pdr_sensor_test', |
Deepak Kodihalli | 557dfb0 | 2019-05-12 13:11:17 +0530 | [diff] [blame] | 53 | 'libpldmresponder_bios_table_test', |
Jinu Joy Thomas | 8e92c6c | 2019-08-06 12:22:34 +0530 | [diff] [blame] | 54 | 'libpldmresponder_platform_test', |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 55 | 'pldmd_instanceid_test', |
Deepak Kodihalli | bc669f1 | 2019-11-28 08:52:07 -0600 | [diff] [blame] | 56 | 'pldmd_registration_test', |
George Liu | 8340957 | 2019-12-24 18:42:54 +0800 | [diff] [blame] | 57 | 'pldm_utils_test', |
Deepak Kodihalli | 3b02ed8 | 2020-02-06 01:18:25 -0600 | [diff] [blame] | 58 | 'libpldmresponder_fru_test', |
Tom Joseph | 250c475 | 2020-04-15 10:32:45 +0530 | [diff] [blame] | 59 | 'libpldmresponder_dbus_to_host_effecter_test', |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 60 | ] |
| 61 | |
| 62 | if get_option('oem-ibm').enabled() |
| 63 | tests += [ |
Sampa Misra | aea5dde | 2020-08-31 08:33:47 -0500 | [diff] [blame] | 64 | '../oem/ibm/test/libpldmresponder_fileio_test', |
| 65 | '../oem/ibm/test/libpldmresponder_oem_platform_test' |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 66 | ] |
| 67 | endif |
| 68 | |
| 69 | foreach t : tests |
| 70 | test(t, executable(t.underscorify(), t + '.cpp', |
| 71 | implicit_include_directories: false, |
| 72 | link_args: dynamic_linker, |
| 73 | build_rpath: get_option('oe-sdk').enabled() ? rpath : '', |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 74 | dependencies: [ |
Patrick Williams | 6f4479c | 2021-04-16 21:39:44 -0500 | [diff] [blame] | 75 | libpldm_dep, |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 76 | libpldmresponder, |
George Liu | ab437e5 | 2020-01-19 17:12:19 +0800 | [diff] [blame] | 77 | libpldmutils, |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 78 | gtest, |
| 79 | gmock, |
Patrick Williams | 3b1dc01 | 2021-04-16 21:51:47 -0500 | [diff] [blame] | 80 | nlohmann_json, |
Deepak Kodihalli | 4de4d00 | 2019-11-11 02:41:43 -0600 | [diff] [blame] | 81 | pldmd, |
Manojkiran Eda | 001f788 | 2021-01-04 18:21:18 +0530 | [diff] [blame] | 82 | phosphor_dbus_interfaces, |
| 83 | sdeventplus, |
| 84 | sdbusplus]), |
Deepak Kodihalli | 3c275e1 | 2019-09-21 06:39:39 -0500 | [diff] [blame] | 85 | workdir: meson.current_source_dir()) |
| 86 | endforeach |