entity-manager: fixes for logDeviceAdded/Removed
Follow-up patch to fix issues found in comments of [1].
- Use explicit type rather than 'auto' for local variable
- Setup a return variable to avoid duplicate initial value "Unknown"
- Fix string value read to avoid uncaught exception
- Remove unused boost include
- Add unit tests
Tested: Unit tests pass.
References:
[1] https://gerrit.openbmc.org/c/openbmc/entity-manager/+/84340
Change-Id: I3d5540860e8ef8e590bc2685ce559c53dc8452b5
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/entity_manager/meson.build b/test/entity_manager/meson.build
index d0ac54c..43d4689 100644
--- a/test/entity_manager/meson.build
+++ b/test/entity_manager/meson.build
@@ -16,3 +16,22 @@
include_directories: test_include_dir,
),
)
+
+test(
+ 'test_log_device_inventory',
+ executable(
+ 'test_log_device_inventory',
+ 'log_device_inventory.cpp',
+ cpp_args: test_boost_args,
+ dependencies: [
+ boost,
+ gtest,
+ nlohmann_json_dep,
+ phosphor_logging_dep,
+ sdbusplus,
+ valijson,
+ ],
+ link_with: entity_manager_lib,
+ include_directories: test_include_dir,
+ ),
+)