build: Add meson build for phosphor-host-ipmi
Create meson and meson_options for the existing features.
Removed sample.h/cpp since that is not used at all.
Tested:
Ipmi command works fine the cleanup.
```
$ systemctl status phosphor-ipmi-host
● phosphor-ipmi-host.service - Phosphor Inband IPMI
Loaded: loaded (/lib/systemd/system/phosphor-ipmi-host.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 1970-01-08 21:20:56 UTC; 21s ago
Main PID: 24987 (ipmid)
CGroup: /system.slice/phosphor-ipmi-host.service
└─24987 /tmp/ipmid
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X30] for Ethstats Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X32] for Sys Commands
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X002B79], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X02] for I2C
Jan 08 21:20:56 $HOST ipmid[24987]: I2C_WHITELIST_CHECK is disabled, do not populate whitelist
Jan 08 21:20:56 $HOST ipmid[24987]: Registering OEM:[0X00C2CF], Cmd:[0X04] for Manual Zone Control
Jan 08 21:20:56 $HOST systemd[1]: Started Phosphor Inband IPMI.
Jan 08 21:20:56 $HOST ipmid[24987]: Loading whitelist filter
Jan 08 21:20:56 $HOST ipmid[24987]: Set restrictedMode = true
(reverse-i-search)`ipmi': systemctl status phosphor-^Cmi-host
$ ipmitool mc info
Device ID : 32
Device Revision : 1
Firmware Revision : 0.00
IPMI Version : 2.0
Manufacturer ID : 7244
Manufacturer Name : Quanta Computer Inc.
Product ID : 14426 (0x385a)
Product Name : Unknown (0x385A)
Device Available : yes
Provides Device SDRs : yes
Additional Device Support :
Sensor Device
SEL Device
FRU Inventory Device
Chassis Device
Aux Firmware Rev Info :
0x00
0x00
0x00
0x00
```
Change-Id: Ibaea9eea802b063a0207320654cbb817fde30c2a
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 0000000..3306a91
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,78 @@
+gtest = dependency('gtest', main: true, disabler: true, required: false)
+gmock = dependency('gmock', disabler: true, required: false)
+if not gtest.found() or not gmock.found()
+ gtest_opts = import('cmake').subproject_options()
+ gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'})
+ gtest_proj = import('cmake').subproject(
+ 'googletest',
+ options: gtest_opts,
+ required: false)
+ if gtest_proj.found()
+ gtest = declare_dependency(
+ dependencies: [
+ dependency('threads'),
+ gtest_proj.dependency('gtest'),
+ gtest_proj.dependency('gtest_main'),
+ ])
+ gmock = gtest_proj.dependency('gmock')
+ else
+ assert(not get_option('tests').enabled(), 'Googletest is required')
+ endif
+endif
+
+test('entitymap_json',
+ executable(
+ 'entitymap_json',
+ 'entitymap_json_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [entity_map_json_dep, gtest, gmock]
+ ))
+
+# Build/add oemrouter_unittest to test suite
+# Issue #3325
+# test('oemrouter',
+# executable(
+# 'oemrouter',
+# 'oemrouter_unittest.cpp',
+# include_directories: root_inc,
+# build_by_default: false,
+# implicit_include_directories: false,
+# dependencies: [gtest, gmock]
+# ))
+
+# Build/add message packing/unpacking unit tests
+test('message',
+ executable(
+ 'message',
+ 'message/pack.cpp',
+ 'message/payload.cpp',
+ 'message/unpack.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [phosphor_logging_dep, crypto, systemd, sdbusplus_dep, gtest, gmock]
+ ))
+
+# Build/add closesession_unittest to test suite
+test('session/closesession',
+ executable(
+ 'session_closesession',
+ 'session/closesession_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [gtest, gmock]
+ ))
+
+# Build/add sensorcommands_unittest to test suite
+test('dbus-sdr/sensorcommands',
+ executable(
+ 'dbus-sdr_sensorcommands',
+ 'dbus-sdr/sensorcommands_unittest.cpp',
+ include_directories: root_inc,
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [sensorutils_dep, gtest, gmock]
+ ))