test: common: software version
Test Software Version DBus API.
Change-Id: I287b7e7957199463ec80bda8f71bf881bc0e5cb8
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/common/exampledevice/example_device.cpp b/test/common/exampledevice/example_device.cpp
index 9200bb2..c46e842 100644
--- a/test/common/exampledevice/example_device.cpp
+++ b/test/common/exampledevice/example_device.cpp
@@ -41,10 +41,14 @@
SoftwareManager(ctx, "ExampleUpdater" + std::to_string(uniqueSuffix))
{}
-ExampleCodeUpdater::ExampleCodeUpdater(sdbusplus::async::context& ctx,
- const char* swVersion) :
+ExampleCodeUpdater::ExampleCodeUpdater(
+ sdbusplus::async::context& ctx, bool createDevice, const char* swVersion) :
ExampleCodeUpdater(ctx)
{
+ if (!createDevice)
+ {
+ return;
+ }
const std::string exampleInvObjPath =
"/xyz/openbmc_project/inventory/system/board/ExampleBoard/ExampleDevice";
auto exampleDevice = std::make_unique<ExampleDevice>(ctx, &(*this));
diff --git a/test/common/exampledevice/example_device.hpp b/test/common/exampledevice/example_device.hpp
index 52da92d..67269d5 100644
--- a/test/common/exampledevice/example_device.hpp
+++ b/test/common/exampledevice/example_device.hpp
@@ -20,9 +20,12 @@
ExampleCodeUpdater(sdbusplus::async::context& ctx,
long uniqueSuffix = getRandomId());
+ // @param createDevice create an ExampleDevice. Prerequisite for param
+ // 'swVersion'.
// @param swVersion if this is nullptr, do not create the software
// version.
- ExampleCodeUpdater(sdbusplus::async::context& ctx, const char* swVersion);
+ ExampleCodeUpdater(sdbusplus::async::context& ctx, bool createDevice,
+ const char* swVersion);
std::unique_ptr<ExampleDevice>& getDevice();