fixup: test: example device
- Fix the update progress loop in
test/common/exampledevice/example_device.cpp.
The update progress should be incremented there.
- Move a comment to the relevant lines in
test/common/exampledevice/example_updater_main.cpp
Tested: Unit tests pass.
Change-Id: I5fa908e1c6f95eaaa2710853c065fc341a30035f
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 59acd39..78a46f5 100644
--- a/test/common/exampledevice/example_device.cpp
+++ b/test/common/exampledevice/example_device.cpp
@@ -89,7 +89,7 @@
// The percentage should be monotonic and increasing.
for (auto progress = 0; progress <= 100; progress += 20)
{
- setUpdateProgress(90);
+ setUpdateProgress(progress);
}
co_return true;
diff --git a/test/common/exampledevice/example_updater_main.cpp b/test/common/exampledevice/example_updater_main.cpp
index 425ab35..fbd7994 100644
--- a/test/common/exampledevice/example_updater_main.cpp
+++ b/test/common/exampledevice/example_updater_main.cpp
@@ -8,6 +8,15 @@
sdbusplus::async::task<void> init(ExampleCodeUpdater& updater)
// NOLINTEND(readability-static-accessed-through-instance)
{
+ /*
+ * In Concrete updaters, the initDevices() function needs to be called,
+ * which in turn invokes the virtual initDevice() function implemented here.
+ * However, in ExampleUpdater, the initDevice() function is called directly
+ * because there is no example configuration from EM to consume, which would
+ * otherwise cause the initDevices() API to throw an error. Therefore,
+ * calling initDevice() directly in this case.
+ */
+
co_await updater.initDevice("", "", ExampleDevice::defaultConfig);
co_return;
@@ -19,15 +28,6 @@
ExampleCodeUpdater updater(ctx);
- /*
- * In Concrete updaters, the initDevices() function needs to be called,
- * which in turn invokes the virtual initDevice() function implemented here.
- * However, in ExampleUpdater, the initDevice() function is called directly
- * because there is no example configuration from EM to consume, which would
- * otherwise cause the initDevices() API to throw an error. Therefore,
- * calling initDevice() directly in this case.
- */
-
// NOLINTNEXTLINE(clang-analyzer-core.uninitialized.Branch)
ctx.spawn(init(updater));