regulators: Add Services& services to classes
Modify the configure() method in the System, Chassis, Device, and Rail
classes to have a new first parameter: Services& services.
Fix mock_services.hpp bug.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I6ef41de65d2c5b68c55edb42189ba9c0f2e436ed
diff --git a/phosphor-regulators/test/chassis_tests.cpp b/phosphor-regulators/test/chassis_tests.cpp
index eca6d97..481d71d 100644
--- a/phosphor-regulators/test/chassis_tests.cpp
+++ b/phosphor-regulators/test/chassis_tests.cpp
@@ -21,6 +21,7 @@
#include "id_map.hpp"
#include "journal.hpp"
#include "mock_journal.hpp"
+#include "mock_services.hpp"
#include "mocked_i2c_interface.hpp"
#include "pmbus_read_sensor_action.hpp"
#include "presence_detection.hpp"
@@ -180,6 +181,9 @@
{
// Test where no devices were specified in constructor
{
+ // Create mock services.
+ MockServices services{};
+
// Create Chassis
std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(1);
Chassis* chassisPtr = chassis.get();
@@ -192,7 +196,7 @@
// Call configure()
journal::clear();
- chassisPtr->configure(system);
+ chassisPtr->configure(services, system);
EXPECT_EQ(journal::getDebugMessages().size(), 0);
EXPECT_EQ(journal::getErrMessages().size(), 0);
std::vector<std::string> expectedInfoMessages{"Configuring chassis 1"};
@@ -201,6 +205,9 @@
// Test where devices were specified in constructor
{
+ // Create mock services.
+ MockServices services{};
+
std::vector<std::unique_ptr<Device>> devices{};
// Create Device vdd0_reg
@@ -252,7 +259,7 @@
// Call configure()
journal::clear();
- chassisPtr->configure(system);
+ chassisPtr->configure(services, system);
std::vector<std::string> expectedDebugMessages{
"Configuring vdd0_reg: volts=1.300000",
"Configuring vdd1_reg: volts=1.200000"};