fix CI failed
- Refs about removing add_object_vtable:
https://gerrit.openbmc.org/c/openbmc/phosphor-hwmon/+/73009
- initial some struct data
Signed-off-by: Harvey Wu <Harvey.Wu@quantatw.com>
Change-Id: Iacc62eb1b8cd2b1e092efdbcb3abafb8afb896c7
diff --git a/dbus/dbushelper_interface.hpp b/dbus/dbushelper_interface.hpp
index 6d7e506..2ea6230 100644
--- a/dbus/dbushelper_interface.hpp
+++ b/dbus/dbushelper_interface.hpp
@@ -8,13 +8,13 @@
struct SensorProperties
{
- int64_t scale;
- double value;
- double min;
- double max;
+ int64_t scale = 0;
+ double value = 0.0;
+ double min = 0.0;
+ double max = 0.0;
std::string unit;
- bool available;
- bool unavailableAsFailed;
+ bool available = false;
+ bool unavailableAsFailed = false;
};
class DbusHelperInterface
diff --git a/pid/ec/pid.hpp b/pid/ec/pid.hpp
index 9db08fd..bc81504 100644
--- a/pid/ec/pid.hpp
+++ b/pid/ec/pid.hpp
@@ -10,8 +10,8 @@
typedef struct
{
- double min;
- double max;
+ double min = 0.0;
+ double max = 0.0;
} limits_t;
/* Note: If you update these structs you need to update the copy code in
@@ -19,27 +19,27 @@
*/
typedef struct
{
- bool initialized; // has pid been initialized
- bool checkHysterWithSetpt; // compare current input and setpoint to check
- // hysteresis
+ bool initialized = false; // has pid been initialized
+ bool checkHysterWithSetpt = false; // compare current input and setpoint to
+ // check hysteresis
- double ts; // sample time in seconds
- double integral; // integral of error
- double lastOutput; // value of last output
- double lastError; // value of last error
+ double ts = 0.0; // sample time in seconds
+ double integral = 0.0; // integral of error
+ double lastOutput = 0.0; // value of last output
+ double lastError = 0.0; // value of last error
- double proportionalCoeff; // coeff for P
- double integralCoeff; // coeff for I
- double derivativeCoeff; // coeff for D
- double feedFwdOffset; // offset coeff for feed-forward term
- double feedFwdGain; // gain for feed-forward term
+ double proportionalCoeff = 0.0; // coeff for P
+ double integralCoeff = 0.0; // coeff for I
+ double derivativeCoeff = 0.0; // coeff for D
+ double feedFwdOffset = 0.0; // offset coeff for feed-forward term
+ double feedFwdGain = 0.0; // gain for feed-forward term
- limits_t integralLimit; // clamp of integral
- limits_t outLim; // clamp of output
- double slewNeg;
- double slewPos;
- double positiveHysteresis;
- double negativeHysteresis;
+ limits_t integralLimit; // clamp of integral
+ limits_t outLim; // clamp of output
+ double slewNeg = 0.0;
+ double slewPos = 0.0;
+ double positiveHysteresis = 0.0;
+ double negativeHysteresis = 0.0;
} pid_info_t;
double pid(pid_info_t* pidinfoptr, double input, double setpoint,
@@ -48,21 +48,21 @@
/* Condensed version for use by the configuration. */
struct pidinfo
{
- bool checkHysterWithSetpt; // compare current input and setpoint to check
- // hysteresis
+ bool checkHysterWithSetpt = 0.0; // compare current input and setpoint to
+ // check hysteresis
- double ts; // sample time in seconds
- double proportionalCoeff; // coeff for P
- double integralCoeff; // coeff for I
- double derivativeCoeff; // coeff for D
- double feedFwdOffset; // offset coeff for feed-forward term
- double feedFwdGain; // gain for feed-forward term
- ec::limits_t integralLimit; // clamp of integral
- ec::limits_t outLim; // clamp of output
- double slewNeg;
- double slewPos;
- double positiveHysteresis;
- double negativeHysteresis;
+ double ts = 0.0; // sample time in seconds
+ double proportionalCoeff = 0.0; // coeff for P
+ double integralCoeff = 0.0; // coeff for I
+ double derivativeCoeff = 0.0; // coeff for D
+ double feedFwdOffset = 0.0; // offset coeff for feed-forward term
+ double feedFwdGain = 0.0; // gain for feed-forward term
+ ec::limits_t integralLimit; // clamp of integral
+ ec::limits_t outLim; // clamp of output
+ double slewNeg = 0.0;
+ double slewPos = 0.0;
+ double positiveHysteresis = 0.0;
+ double negativeHysteresis = 0.0;
};
} // namespace ec
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 4d3faea..c1715fe 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -42,12 +42,6 @@
const std::string& path, const std::string& intf,
const std::vector<std::string>& properties, double* index)
{
- EXPECT_CALL(*sdbus_mock,
- sd_bus_add_object_vtable(IsNull(), NotNull(), StrEq(path),
- StrEq(intf), NotNull(), NotNull()))
- .Times(::testing::AnyNumber())
- .WillOnce(Return(0));
-
if (!defer)
{
EXPECT_CALL(*sdbus_mock,
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 3e8077c..b494896 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -76,13 +76,6 @@
SetupDbusObject(&sdbus_mock_enable, defer, pidsensorpath.c_str(),
enableInterface, propertiesenable, &de);
- EXPECT_CALL(sdbus_mock_enable,
- sd_bus_add_object_vtable(
- IsNull(), NotNull(), StrEq(pidsensorpath.c_str()),
- StrEq(debugThermalPowerInterface), NotNull(), NotNull()))
- .Times(::testing::AnyNumber())
- .WillOnce(Return(0));
-
DbusPidZone p(zone, minThermalOutput, failSafePercent, cycleTime, m,
bus_mock_mode, objPath, defer, accSetPoint);
// Success.
@@ -119,13 +112,6 @@
SetupDbusObject(&sdbus_mock_enable, defer, pidsensorpath.c_str(),
enableInterface, propertiesenable,
&propertyenable_index);
- EXPECT_CALL(sdbus_mock_enable,
- sd_bus_add_object_vtable(IsNull(), NotNull(),
- StrEq(pidsensorpath.c_str()),
- StrEq(debugThermalPowerInterface),
- NotNull(), NotNull()))
- .Times(::testing::AnyNumber())
- .WillOnce(Return(0));
zone = std::make_unique<DbusPidZone>(
zoneId, minThermalOutput, failSafePercent, cycleTime, mgr,
@@ -210,8 +196,7 @@
// Access the internal pid configuration to clear it out (unrelated to the
// test).
- ec::pid_info_t* info = tpid->getPIDInfo();
- std::memset(info, 0x00, sizeof(ec::pid_info_t));
+ [[maybe_unused]] ec::pid_info_t* info = tpid->getPIDInfo();
zone->addFanPID(std::move(tpid));
@@ -757,8 +742,7 @@
// Access the internal pid configuration to clear it out (unrelated to the
// test).
- ec::pid_info_t* info = tpid->getPIDInfo();
- std::memset(info, 0x00, sizeof(ec::pid_info_t));
+ [[maybe_unused]] ec::pid_info_t* info = tpid->getPIDInfo();
zone->addThermalPID(std::move(tpid));
@@ -782,8 +766,7 @@
// Access the internal pid configuration to clear it out (unrelated to the
// test).
- ec::pid_info_t* info = tpid->getPIDInfo();
- std::memset(info, 0x00, sizeof(ec::pid_info_t));
+ [[maybe_unused]] ec::pid_info_t* info = tpid->getPIDInfo();
zone->addFanPID(std::move(tpid));