diff --git a/.clang-format b/.clang-format index d43e884d..28e33286 100644 --- a/.clang-format +++ b/.clang-format @@ -87,7 +87,7 @@ IndentWidth: 4 IndentWrappedFunctionNames: true InsertNewlineAtEOF: true KeepEmptyLinesAtTheStartOfBlocks: false -LambdaBodyIndentation: OuterScope +LambdaBodyIndentation: Signature LineEnding: LF MacroBlockBegin: '' MacroBlockEnd: '' @@ -98,13 +98,14 @@ ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PackConstructorInitializers: BinPack PenaltyBreakAssignment: 25 -PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakBeforeFirstCallParameter: 50 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 -PenaltyIndentedWhitespace: 0 +PenaltyIndentedWhitespace: 1 PointerAlignment: Left QualifierAlignment: Left ReferenceAlignment: Left diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp index 46532a6b..2edb3cc0 100644 --- a/dbus/dbusactiveread.hpp +++ b/dbus/dbusactiveread.hpp @@ -22,8 +22,8 @@ class DbusActiveRead : public ReadInterface DbusActiveRead(sdbusplus::bus_t& bus, const std::string& path, const std::string& service, std::unique_ptr helper) : - ReadInterface(), - _bus(bus), _path(path), _service(service), _helper(std::move(helper)) + ReadInterface(), _bus(bus), _path(path), _service(service), + _helper(std::move(helper)) {} ReadReturn read(void) override; diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp index 2a06b309..7905e286 100644 --- a/dbus/dbusconfiguration.cpp +++ b/dbus/dbusconfiguration.cpp @@ -84,10 +84,10 @@ inline std::string sensorNameToDbusName(const std::string& sensorName) std::vector getSelectedProfiles(sdbusplus::bus_t& bus) { std::vector ret; - auto mapper = bus.new_method_call("xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", - "GetSubTree"); + auto mapper = + bus.new_method_call("xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTree"); mapper.append("/", 0, std::array{thermalControlIface}); std::unordered_map< std::string, std::unordered_map>> @@ -281,8 +281,8 @@ inline void getCycleTimeSetting( auto findAttributeName = zone.find(attributeName); if (findAttributeName != zone.end()) { - double tmpAttributeValue = std::visit(VariantToDoubleVisitor(), - zone.at(attributeName)); + double tmpAttributeValue = + std::visit(VariantToDoubleVisitor(), zone.at(attributeName)); if (tmpAttributeValue >= 1.0) { value = static_cast(tmpAttributeValue); @@ -380,10 +380,10 @@ void populatePidInfo( getPIDAttribute(base, "OutLimitMax")); info.pidInfo.outLim.min = std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "OutLimitMin")); - info.pidInfo.slewNeg = std::visit(VariantToDoubleVisitor(), - getPIDAttribute(base, "SlewNeg")); - info.pidInfo.slewPos = std::visit(VariantToDoubleVisitor(), - getPIDAttribute(base, "SlewPos")); + info.pidInfo.slewNeg = + std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewNeg")); + info.pidInfo.slewPos = + std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewPos")); bool checkHysterWithSetpt = false; double negativeHysteresis = 0; @@ -401,18 +401,18 @@ void populatePidInfo( } if (findNeg != base.end()) { - negativeHysteresis = std::visit(VariantToDoubleVisitor(), - findNeg->second); + negativeHysteresis = + std::visit(VariantToDoubleVisitor(), findNeg->second); } if (findPos != base.end()) { - positiveHysteresis = std::visit(VariantToDoubleVisitor(), - findPos->second); + positiveHysteresis = + std::visit(VariantToDoubleVisitor(), findPos->second); } if (findDerivative != base.end()) { - derivativeCoeff = std::visit(VariantToDoubleVisitor(), - findDerivative->second); + derivativeCoeff = + std::visit(VariantToDoubleVisitor(), findDerivative->second); } info.pidInfo.checkHysterWithSetpt = checkHysterWithSetpt; @@ -432,16 +432,16 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer, createMatches(bus, timer); - auto mapper = bus.new_method_call("xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", - "GetSubTree"); - mapper.append("/", 0, - std::array{ - objectManagerInterface, pidConfigurationInterface, - pidZoneConfigurationInterface, - stepwiseConfigurationInterface, sensorInterface, - defaultPwmInterface}); + auto mapper = + bus.new_method_call("xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetSubTree"); + mapper.append( + "/", 0, + std::array{ + objectManagerInterface, pidConfigurationInterface, + pidZoneConfigurationInterface, stepwiseConfigurationInterface, + sensorInterface, defaultPwmInterface}); std::unordered_map< std::string, std::unordered_map>> respData; @@ -516,8 +516,8 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer, catch (const sdbusplus::exception_t&) { // this shouldn't happen, probably means daemon crashed - throw std::runtime_error("Error getting managed objects from " + - owner.first); + throw std::runtime_error( + "Error getting managed objects from " + owner.first); } for (auto& pathPair : configuration) @@ -562,8 +562,8 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer, for (const std::string& profile : profiles) { if (std::find(selectedProfiles.begin(), - selectedProfiles.end(), - profile) != selectedProfiles.end()) + selectedProfiles.end(), profile) != + selectedProfiles.end()) { found = true; break; @@ -908,11 +908,11 @@ bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer, offsetType = std::get(findSetpointOffset->second); if (std::find(thresholds::types.begin(), - thresholds::types.end(), - offsetType) == thresholds::types.end()) + thresholds::types.end(), offsetType) == + thresholds::types.end()) { - throw std::runtime_error("Unsupported type: " + - offsetType); + throw std::runtime_error( + "Unsupported type: " + offsetType); } } diff --git a/dbus/dbushelper.cpp b/dbus/dbushelper.cpp index 038e7844..6c1e1c08 100644 --- a/dbus/dbushelper.cpp +++ b/dbus/dbushelper.cpp @@ -43,10 +43,10 @@ using namespace phosphor::logging; std::string DbusHelper::getService(const std::string& intf, const std::string& path) { - auto mapper = _bus.new_method_call("xyz.openbmc_project.ObjectMapper", - "/xyz/openbmc_project/object_mapper", - "xyz.openbmc_project.ObjectMapper", - "GetObject"); + auto mapper = + _bus.new_method_call("xyz.openbmc_project.ObjectMapper", + "/xyz/openbmc_project/object_mapper", + "xyz.openbmc_project.ObjectMapper", "GetObject"); mapper.append(path); mapper.append(std::vector({intf})); diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp index 09637361..aa4cbaf0 100644 --- a/dbus/dbuspassive.cpp +++ b/dbus/dbuspassive.cpp @@ -93,9 +93,8 @@ DbusPassive::DbusPassive( std::unique_ptr helper, const SensorProperties& settings, bool failed, const std::string& path, const std::shared_ptr& redundancy) : - ReadInterface(), - _signal(bus, getMatch(path), dbusHandleSignal, this), _id(id), - _helper(std::move(helper)), _failed(failed), path(path), + ReadInterface(), _signal(bus, getMatch(path), dbusHandleSignal, this), + _id(id), _helper(std::move(helper)), _failed(failed), path(path), redundancy(redundancy) { @@ -277,8 +276,8 @@ int handleSensorValue(sdbusplus::message_t& msg, DbusPassive* owner) auto valPropMap = msgData.find("Value"); if (valPropMap != msgData.end()) { - double value = std::visit(VariantToDoubleVisitor(), - valPropMap->second); + double value = + std::visit(VariantToDoubleVisitor(), valPropMap->second); owner->updateValue(value, false); } diff --git a/dbus/dbuspassiveredundancy.cpp b/dbus/dbuspassiveredundancy.cpp index 640e5872..fa8ce58a 100644 --- a/dbus/dbuspassiveredundancy.cpp +++ b/dbus/dbuspassiveredundancy.cpp @@ -50,56 +50,57 @@ DbusPassiveRedundancy::DbusPassiveRedundancy(sdbusplus::bus_t& bus) : "type='signal',member='PropertiesChanged',arg0namespace='" + std::string(redundancy::interface) + "'", std::move([this](sdbusplus::message_t& message) { - std::string objectName; - std::unordered_map>> - result; - try - { - message.read(objectName, result); - } - catch (const sdbusplus::exception_t&) - { - std::cerr << "Error reading match data"; - return; - } - auto findStatus = result.find("Status"); - if (findStatus == result.end()) - { - return; - } - std::string status = std::get(findStatus->second); - - auto methodCall = - passiveBus.new_method_call(message.get_sender(), message.get_path(), - properties::interface, properties::get); - methodCall.append(redundancy::interface, redundancy::collection); - std::variant> collection; - - try - { - auto reply = passiveBus.call(methodCall); - reply.read(collection); - } - catch (const sdbusplus::exception_t&) - { - std::cerr << "Error reading match data"; - return; - } - - auto data = std::get>(collection); - if (status.rfind("Failed") != std::string::npos) - { - failed.insert(data.begin(), data.end()); - } - else - { - for (const auto& d : data) - { - failed.erase(d); - } - } -})), + std::string objectName; + std::unordered_map< + std::string, + std::variant>> + result; + try + { + message.read(objectName, result); + } + catch (const sdbusplus::exception_t&) + { + std::cerr << "Error reading match data"; + return; + } + auto findStatus = result.find("Status"); + if (findStatus == result.end()) + { + return; + } + std::string status = std::get(findStatus->second); + + auto methodCall = passiveBus.new_method_call( + message.get_sender(), message.get_path(), + properties::interface, properties::get); + methodCall.append(redundancy::interface, redundancy::collection); + std::variant> collection; + + try + { + auto reply = passiveBus.call(methodCall); + reply.read(collection); + } + catch (const sdbusplus::exception_t&) + { + std::cerr << "Error reading match data"; + return; + } + + auto data = std::get>(collection); + if (status.rfind("Failed") != std::string::npos) + { + failed.insert(data.begin(), data.end()); + } + else + { + for (const auto& d : data) + { + failed.erase(d); + } + } + })), passiveBus(bus) { populateFailures(); @@ -141,9 +142,9 @@ void DbusPassiveRedundancy::populateFailures(void) { for (const auto& [owner, _] : interfaceDict) { - auto call = passiveBus.new_method_call(owner.c_str(), path.c_str(), - properties::interface, - properties::getAll); + auto call = passiveBus.new_method_call( + owner.c_str(), path.c_str(), properties::interface, + properties::getAll); call.append(redundancy::interface); std::unordered_map< diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp index 95315466..baae941c 100644 --- a/dbus/dbuswrite.cpp +++ b/dbus/dbuswrite.cpp @@ -78,9 +78,9 @@ void DbusWritePercent::write(double value, bool force, int64_t* written) } } auto writeBus = sdbusplus::bus::new_default(); - auto mesg = writeBus.new_method_call(connectionName.c_str(), path.c_str(), - "org.freedesktop.DBus.Properties", - "Set"); + auto mesg = + writeBus.new_method_call(connectionName.c_str(), path.c_str(), + "org.freedesktop.DBus.Properties", "Set"); mesg.append(pwmInterface, "Target", std::variant(static_cast(ovalue))); @@ -103,10 +103,9 @@ void DbusWritePercent::write(double value, bool force, int64_t* written) return; } -std::unique_ptr - DbusWrite::createDbusWrite(const std::string& path, int64_t min, - int64_t max, - std::unique_ptr helper) +std::unique_ptr DbusWrite::createDbusWrite( + const std::string& path, int64_t min, int64_t max, + std::unique_ptr helper) { std::string connectionName; @@ -141,9 +140,9 @@ void DbusWrite::write(double value, bool force, int64_t* written) } } auto writeBus = sdbusplus::bus::new_default(); - auto mesg = writeBus.new_method_call(connectionName.c_str(), path.c_str(), - "org.freedesktop.DBus.Properties", - "Set"); + auto mesg = + writeBus.new_method_call(connectionName.c_str(), path.c_str(), + "org.freedesktop.DBus.Properties", "Set"); mesg.append(pwmInterface, "Target", std::variant(static_cast(value))); diff --git a/dbus/dbuswrite.hpp b/dbus/dbuswrite.hpp index 1beac27f..9aec84c5 100644 --- a/dbus/dbuswrite.hpp +++ b/dbus/dbuswrite.hpp @@ -37,8 +37,7 @@ class DbusWritePercent : public WriteInterface DbusWritePercent(const std::string& path, int64_t min, int64_t max, const std::string& connectionName) : - WriteInterface(min, max), - path(path), connectionName(connectionName) + WriteInterface(min, max), path(path), connectionName(connectionName) {} void write(double value) override; @@ -59,8 +58,7 @@ class DbusWrite : public WriteInterface DbusWrite(const std::string& path, int64_t min, int64_t max, const std::string& connectionName) : - WriteInterface(min, max), - path(path), connectionName(connectionName) + WriteInterface(min, max), path(path), connectionName(connectionName) {} void write(double value) override; diff --git a/ipmi/main_ipmi.cpp b/ipmi/main_ipmi.cpp index 8e58b258..d1eed134 100644 --- a/ipmi/main_ipmi.cpp +++ b/ipmi/main_ipmi.cpp @@ -48,8 +48,8 @@ void setupGlobalOemFanControl() oem::obmcOemNumber, oem::Cmd::fanManualCmd); using namespace std::placeholders; - router->registerHandler(oem::obmcOemNumber, oem::Cmd::fanManualCmd, - std::bind(pid_control::ipmi::manualModeControl, - &pid_control::ipmi::handler, _1, _2, _3, - _4)); + router->registerHandler( + oem::obmcOemNumber, oem::Cmd::fanManualCmd, + std::bind(pid_control::ipmi::manualModeControl, + &pid_control::ipmi::handler, _1, _2, _3, _4)); } diff --git a/ipmi/manualcmds.cpp b/ipmi/manualcmds.cpp index 0025d596..d9c9c49d 100644 --- a/ipmi/manualcmds.cpp +++ b/ipmi/manualcmds.cpp @@ -39,9 +39,8 @@ namespace ipmi static constexpr auto manualProperty = "Manual"; static constexpr auto failsafeProperty = "FailSafe"; -ipmi_ret_t ZoneControlIpmiHandler::getFailsafeModeState(const uint8_t* reqBuf, - uint8_t* replyBuf, - size_t* dataLen) +ipmi_ret_t ZoneControlIpmiHandler::getFailsafeModeState( + const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen) { bool current; @@ -53,8 +52,8 @@ ipmi_ret_t ZoneControlIpmiHandler::getFailsafeModeState(const uint8_t* reqBuf, const auto request = reinterpret_cast(&reqBuf[0]); - ipmi_ret_t rc = _control->getFanCtrlProperty(request->zone, ¤t, - failsafeProperty); + ipmi_ret_t rc = + _control->getFanCtrlProperty(request->zone, ¤t, failsafeProperty); if (rc) { return rc; @@ -71,9 +70,8 @@ ipmi_ret_t ZoneControlIpmiHandler::getFailsafeModeState(const uint8_t* reqBuf, * * */ -ipmi_ret_t ZoneControlIpmiHandler::getManualModeState(const uint8_t* reqBuf, - uint8_t* replyBuf, - size_t* dataLen) +ipmi_ret_t ZoneControlIpmiHandler::getManualModeState( + const uint8_t* reqBuf, uint8_t* replyBuf, size_t* dataLen) { bool current; @@ -85,8 +83,8 @@ ipmi_ret_t ZoneControlIpmiHandler::getManualModeState(const uint8_t* reqBuf, const auto request = reinterpret_cast(&reqBuf[0]); - ipmi_ret_t rc = _control->getFanCtrlProperty(request->zone, ¤t, - manualProperty); + ipmi_ret_t rc = + _control->getFanCtrlProperty(request->zone, ¤t, manualProperty); if (rc) { return rc; @@ -123,10 +121,9 @@ ipmi_ret_t ZoneControlIpmiHandler::setManualModeState( } /* Three command packages: get, set true, set false */ -ipmi_ret_t manualModeControl(ZoneControlIpmiHandler* handler, - [[maybe_unused]] ipmi_cmd_t cmd, - const uint8_t* reqBuf, uint8_t* replyCmdBuf, - size_t* dataLen) +ipmi_ret_t manualModeControl( + ZoneControlIpmiHandler* handler, [[maybe_unused]] ipmi_cmd_t cmd, + const uint8_t* reqBuf, uint8_t* replyCmdBuf, size_t* dataLen) { // FanCtrlRequest is the smaller of the requests, so it's at a minimum. if (*dataLen < sizeof(struct FanCtrlRequest)) diff --git a/main.cpp b/main.cpp index c83aa9fa..76c5d19e 100644 --- a/main.cpp +++ b/main.cpp @@ -143,8 +143,8 @@ void restartControlLoops() { auto jsonData = parseValidateJson(path); sensorConfig = buildSensorsFromJson(jsonData); - std::tie(zoneConfig, - zoneDetailsConfig) = buildPIDsFromJson(jsonData); + std::tie(zoneConfig, zoneDetailsConfig) = + buildPIDsFromJson(jsonData); } catch (const std::exception& e) { @@ -163,8 +163,8 @@ void restartControlLoops() } state::mgmr = buildSensors(sensorConfig, passiveBus, hostBus); - state::zones = buildZones(zoneConfig, zoneDetailsConfig, state::mgmr, - modeControlBus); + state::zones = + buildZones(zoneConfig, zoneDetailsConfig, state::mgmr, modeControlBus); if (0 == state::zones.size()) { diff --git a/pid/buildjson.cpp b/pid/buildjson.cpp index ddfeb717..feb3bb83 100644 --- a/pid/buildjson.cpp +++ b/pid/buildjson.cpp @@ -57,8 +57,8 @@ void from_json(const json& j, conf::ControllerInfo& c) findMissingAcceptable->get_to(missingAcceptableNames); } - c.inputs = spliceInputs(inputNames, inputTempToMargin, - missingAcceptableNames); + c.inputs = + spliceInputs(inputNames, inputTempToMargin, missingAcceptableNames); /* TODO: We need to handle parsing other PID controller configurations. * We can do that by checking for different keys and making the decision diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp index fc262430..378ef9bd 100644 --- a/pid/fancontroller.cpp +++ b/pid/fancontroller.cpp @@ -28,10 +28,9 @@ namespace pid_control { -std::unique_ptr - FanController::createFanPid(ZoneInterface* owner, const std::string& id, - const std::vector& inputs, - const ec::pidinfo& initial) +std::unique_ptr FanController::createFanPid( + ZoneInterface* owner, const std::string& id, + const std::vector& inputs, const ec::pidinfo& initial) { if (inputs.size() == 0) { diff --git a/pid/fancontroller.hpp b/pid/fancontroller.hpp index c2b76b9f..700f6510 100644 --- a/pid/fancontroller.hpp +++ b/pid/fancontroller.hpp @@ -19,15 +19,14 @@ namespace pid_control class FanController : public PIDController { public: - static std::unique_ptr - createFanPid(ZoneInterface* owner, const std::string& id, - const std::vector& inputs, - const ec::pidinfo& initial); + static std::unique_ptr createFanPid( + ZoneInterface* owner, const std::string& id, + const std::vector& inputs, const ec::pidinfo& initial); FanController(const std::string& id, const std::vector& inputs, ZoneInterface* owner) : - PIDController(id, owner), - _inputs(inputs), _direction(FanSpeedDirection::NEUTRAL) + PIDController(id, owner), _inputs(inputs), + _direction(FanSpeedDirection::NEUTRAL) {} ~FanController(); double inputProc(void) override; diff --git a/pid/stepwisecontroller.hpp b/pid/stepwisecontroller.hpp index a3b3965e..5a8dc3b3 100644 --- a/pid/stepwisecontroller.hpp +++ b/pid/stepwisecontroller.hpp @@ -24,8 +24,7 @@ class StepwiseController : public Controller StepwiseController(const std::string& id, const std::vector& inputs, ZoneInterface* owner) : - Controller(), - _owner(owner), _id(id), _inputs(inputs) + Controller(), _owner(owner), _id(id), _inputs(inputs) {} double inputProc(void) override; diff --git a/pid/thermalcontroller.cpp b/pid/thermalcontroller.cpp index ddb58939..cf8564b8 100644 --- a/pid/thermalcontroller.cpp +++ b/pid/thermalcontroller.cpp @@ -48,8 +48,8 @@ ThermalType getThermalType(const std::string& typeString) bool isThermalType(const std::string& typeString) { - static const std::vector thermalTypes = {"temp", "margin", - "power", "powersum"}; + static const std::vector thermalTypes = { + "temp", "margin", "power", "powersum"}; return std::count(thermalTypes.begin(), thermalTypes.end(), typeString); } @@ -128,10 +128,10 @@ double ThermalController::inputProc(void) if (debugEnabled) { - std::cerr << "Converting temp to margin: temp " - << cachedValue << ", Tjmax " - << in.convertMarginZero << ", margin " - << marginValue << "\n"; + std::cerr + << "Converting temp to margin: temp " << cachedValue + << ", Tjmax " << in.convertMarginZero << ", margin " + << marginValue << "\n"; } cachedValue = marginValue; diff --git a/pid/thermalcontroller.hpp b/pid/thermalcontroller.hpp index ac551d24..b1990476 100644 --- a/pid/thermalcontroller.hpp +++ b/pid/thermalcontroller.hpp @@ -53,8 +53,7 @@ class ThermalController : public PIDController ThermalController(const std::string& id, const std::vector& inputs, const ThermalType& type, ZoneInterface* owner) : - PIDController(id, owner), - _inputs(inputs), type(type) + PIDController(id, owner), _inputs(inputs), type(type) {} double inputProc(void) override; diff --git a/pid/zone.cpp b/pid/zone.cpp index 5332efe7..39ddc6d8 100644 --- a/pid/zone.cpp +++ b/pid/zone.cpp @@ -617,9 +617,8 @@ std::string DbusPidZone::leader() const return _maximumSetPointName; } -void DbusPidZone::updateThermalPowerDebugInterface(std::string pidName, - std::string leader, - double input, double output) +void DbusPidZone::updateThermalPowerDebugInterface( + std::string pidName, std::string leader, double input, double output) { if (leader.empty()) { diff --git a/pid/zone_interface.hpp b/pid/zone_interface.hpp index 31f32566..52639f8b 100644 --- a/pid/zone_interface.hpp +++ b/pid/zone_interface.hpp @@ -115,10 +115,9 @@ class ZoneInterface virtual void processThermals(void) = 0; /** Update thermal/power debug dbus properties */ - virtual void updateThermalPowerDebugInterface(std::string pidName, - std::string leader, - double input, - double output) = 0; + virtual void updateThermalPowerDebugInterface( + std::string pidName, std::string leader, double input, + double output) = 0; }; } // namespace pid_control diff --git a/sensors/host.cpp b/sensors/host.cpp index ae638965..51d38a45 100644 --- a/sensors/host.cpp +++ b/sensors/host.cpp @@ -33,13 +33,12 @@ void scaleHelper(T& ptr, int64_t value) } } -std::unique_ptr HostSensor::createTemp(const std::string& name, - int64_t timeout, - sdbusplus::bus_t& bus, - const char* objPath, bool defer) +std::unique_ptr HostSensor::createTemp( + const std::string& name, int64_t timeout, sdbusplus::bus_t& bus, + const char* objPath, bool defer) { - auto sensor = std::make_unique(name, timeout, bus, objPath, - defer); + auto sensor = + std::make_unique(name, timeout, bus, objPath, defer); sensor->value(0); // DegreesC and value of 0 are the defaults at present, therefore testing diff --git a/sensors/host.hpp b/sensors/host.hpp index 83b98892..b97b137d 100644 --- a/sensors/host.hpp +++ b/sensors/host.hpp @@ -39,10 +39,9 @@ using ValueType = std::conditional_t; class HostSensor : public Sensor, public ValueObject { public: - static std::unique_ptr createTemp(const std::string& name, - int64_t timeout, - sdbusplus::bus_t& bus, - const char* objPath, bool defer); + static std::unique_ptr + createTemp(const std::string& name, int64_t timeout, + sdbusplus::bus_t& bus, const char* objPath, bool defer); HostSensor(const std::string& name, int64_t timeout, sdbusplus::bus_t& bus, const char* objPath, bool defer) : diff --git a/sensors/pluggable.hpp b/sensors/pluggable.hpp index 0dc1c71e..bd5bc1fa 100644 --- a/sensors/pluggable.hpp +++ b/sensors/pluggable.hpp @@ -18,8 +18,8 @@ class PluggableSensor : public Sensor PluggableSensor(const std::string& name, int64_t timeout, std::unique_ptr reader, std::unique_ptr writer) : - Sensor(name, timeout), - _reader(std::move(reader)), _writer(std::move(writer)) + Sensor(name, timeout), _reader(std::move(reader)), + _writer(std::move(writer)) {} ReadReturn read(void) override; diff --git a/test/dbus_active_unittest.cpp b/test/dbus_active_unittest.cpp index 562dd73f..c9f663ee 100644 --- a/test/dbus_active_unittest.cpp +++ b/test/dbus_active_unittest.cpp @@ -45,10 +45,10 @@ TEST(DbusActiveReadTest, Read_VerifyCallsToDbusForValue) .WillOnce(Invoke([&]([[maybe_unused]] const std::string& service, [[maybe_unused]] const std::string& path, SensorProperties* prop) { - prop->scale = -3; - prop->value = 10000; - prop->unit = "x"; - })); + prop->scale = -3; + prop->value = 10000; + prop->unit = "x"; + })); DbusActiveRead ar(bus_mock, path, service, std::move(helper)); diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp index 29c73dc3..91203368 100644 --- a/test/dbus_passive_unittest.cpp +++ b/test/dbus_passive_unittest.cpp @@ -79,13 +79,13 @@ class DbusPassiveTestObj : public ::testing::Test .WillOnce(Invoke([&]([[maybe_unused]] const std::string& service, [[maybe_unused]] const std::string& path, SensorProperties* prop) { - prop->scale = _scale; - prop->value = _value; - prop->unit = "x"; - prop->min = 0; - prop->max = 0; - prop->available = true; - })); + prop->scale = _scale; + prop->value = _value; + prop->unit = "x"; + prop->min = 0; + prop->max = 0; + prop->available = true; + })); EXPECT_CALL(*helper, thresholdsAsserted(StrEq("asdf"), StrEq(path))) .WillOnce(Return(false)); @@ -168,18 +168,18 @@ TEST_F(DbusPassiveTestObj, VerifyHandlesDbusSignal) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = Value; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = Value; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -206,10 +206,10 @@ TEST_F(DbusPassiveTestObj, VerifyHandlesDbusSignal) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'x', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - int64_t* s = static_cast(p); - *s = xValue; - return 0; - })); + int64_t* s = static_cast(p); + *s = xValue; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -241,18 +241,18 @@ TEST_F(DbusPassiveTestObj, VerifyIgnoresOtherPropertySignal) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = Scale; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = Scale; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -279,10 +279,10 @@ TEST_F(DbusPassiveTestObj, VerifyIgnoresOtherPropertySignal) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'x', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - int64_t* s = static_cast(p); - *s = xScale; - return 0; - })); + int64_t* s = static_cast(p); + *s = xScale; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -312,18 +312,18 @@ TEST_F(DbusPassiveTestObj, VerifyCriticalThresholdAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = criticalAlarm; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = criticalAlarm; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -356,10 +356,10 @@ TEST_F(DbusPassiveTestObj, VerifyCriticalThresholdAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = alarm; - return 0; - })); + bool* s = static_cast(p); + *s = alarm; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -389,18 +389,18 @@ TEST_F(DbusPassiveTestObj, VerifyCriticalThresholdDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = criticalAlarm; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = criticalAlarm; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -433,10 +433,10 @@ TEST_F(DbusPassiveTestObj, VerifyCriticalThresholdDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = alarm; - return 0; - })); + bool* s = static_cast(p); + *s = alarm; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -466,18 +466,18 @@ TEST_F(DbusPassiveTestObj, VerifyAvailableDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = property; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = property; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -510,10 +510,10 @@ TEST_F(DbusPassiveTestObj, VerifyAvailableDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = asserted; - return 0; - })); + bool* s = static_cast(p); + *s = asserted; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -545,18 +545,18 @@ TEST_F(DbusPassiveTestObj, VerifyAvailableAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = property; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = property; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -589,10 +589,10 @@ TEST_F(DbusPassiveTestObj, VerifyAvailableAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = asserted; - return 0; - })); + bool* s = static_cast(p); + *s = asserted; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -621,13 +621,13 @@ class DbusPassiveTestUnaSensorNotAsFailedObj : public ::testing::Test .WillOnce(Invoke([&]([[maybe_unused]] const std::string& service, [[maybe_unused]] const std::string& path, SensorProperties* prop) { - prop->scale = _scale; - prop->value = _value; - prop->unit = "x"; - prop->min = 0; - prop->max = 0; - prop->available = true; - })); + prop->scale = _scale; + prop->value = _value; + prop->unit = "x"; + prop->min = 0; + prop->max = 0; + prop->available = true; + })); EXPECT_CALL(*helper, thresholdsAsserted(StrEq("asdf"), StrEq(path))) .WillOnce(Return(false)); @@ -669,18 +669,18 @@ TEST_F(DbusPassiveTestUnaSensorNotAsFailedObj, VerifyAvailableDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = property; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = property; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -713,10 +713,10 @@ TEST_F(DbusPassiveTestUnaSensorNotAsFailedObj, VerifyAvailableDeassert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = asserted; - return 0; - })); + bool* s = static_cast(p); + *s = asserted; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ @@ -750,18 +750,18 @@ TEST_F(DbusPassiveTestUnaSensorNotAsFailedObj, VerifyAvailableAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - // Read the first parameter, the string. - *s = intf; - return 0; - })) + const char** s = static_cast(p); + // Read the first parameter, the string. + *s = intf; + return 0; + })) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - const char** s = static_cast(p); - *s = property; - // Read the string in the pair (dictionary). - return 0; - })); + const char** s = static_cast(p); + *s = property; + // Read the string in the pair (dictionary). + return 0; + })); // std::map EXPECT_CALL(sdbus_mock, @@ -794,10 +794,10 @@ TEST_F(DbusPassiveTestUnaSensorNotAsFailedObj, VerifyAvailableAssert) EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'b', NotNull())) .WillOnce(Invoke([&]([[maybe_unused]] sd_bus_message* m, [[maybe_unused]] char type, void* p) { - bool* s = static_cast(p); - *s = asserted; - return 0; - })); + bool* s = static_cast(p); + *s = asserted; + return 0; + })); EXPECT_CALL(sdbus_mock, sd_bus_message_exit_container(IsNull())) .WillOnce(Return(0)) /* variant. */ diff --git a/test/helpers.hpp b/test/helpers.hpp index 378a4aec..4d3faea9 100644 --- a/test/helpers.hpp +++ b/test/helpers.hpp @@ -66,9 +66,9 @@ void SetupDbusObject(sdbusplus::SdBusMock* sdbus_mock, bool defer, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ(properties[(*index)++].c_str(), names[0]); - return 0; - })); + EXPECT_STREQ(properties[(*index)++].c_str(), names[0]); + return 0; + })); } return; diff --git a/test/pid_thermalcontroller_unittest.cpp b/test/pid_thermalcontroller_unittest.cpp index 8abedf59..b4b1e5d6 100644 --- a/test/pid_thermalcontroller_unittest.cpp +++ b/test/pid_thermalcontroller_unittest.cpp @@ -118,8 +118,8 @@ TEST(ThermalControllerTest, InputProc_MultipleInputsAbsolute) ZoneMock z; - std::vector inputs = {{"fleeting0"}, - {"fleeting1"}}; + std::vector inputs = { + {"fleeting0"}, {"fleeting1"}}; double setpoint = 10.0; ec::pidinfo initial; @@ -140,8 +140,8 @@ TEST(ThermalControllerTest, InputProc_MultipleInputsMargin) ZoneMock z; - std::vector inputs = {{"fleeting0"}, - {"fleeting1"}}; + std::vector inputs = { + {"fleeting0"}, {"fleeting1"}}; double setpoint = 10.0; ec::pidinfo initial; @@ -162,8 +162,8 @@ TEST(ThermalControllerTest, InputProc_MultipleInputsSummation) ZoneMock z; - std::vector inputs = {{"fleeting0"}, - {"fleeting1"}}; + std::vector inputs = { + {"fleeting0"}, {"fleeting1"}}; double setpoint = 10.0; ec::pidinfo initial; diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp index 1f6e6721..3e8077cb 100644 --- a/test/pid_zone_unittest.cpp +++ b/test/pid_zone_unittest.cpp @@ -68,8 +68,8 @@ TEST(PidZoneConstructorTest, BoringConstructorTest) properties, &d); std::string sensorname = "temp1"; - std::string pidsensorpath = "/xyz/openbmc_project/settings/fanctrl/zone1/" + - sensorname; + std::string pidsensorpath = + "/xyz/openbmc_project/settings/fanctrl/zone1/" + sensorname; double de; std::vector propertiesenable; @@ -154,8 +154,8 @@ class PidZoneTest : public ::testing::Test std::string sensorname = "temp1"; std::string sensorType = "temp"; - std::string pidsensorpath = "/xyz/openbmc_project/settings/fanctrl/zone1/" + - sensorname; + std::string pidsensorpath = + "/xyz/openbmc_project/settings/fanctrl/zone1/" + sensorname; std::unique_ptr zone; }; @@ -190,9 +190,9 @@ TEST_F(PidZoneTest, AddPidControlProcessGetAndSetEnableTest_BehavesAsExpected) .WillOnce(Invoke( [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ("Enable", names[0]); - return 0; - })); + EXPECT_STREQ("Enable", names[0]); + return 0; + })); zone->addPidControlProcess(sensorname, sensorType, setpoint, bus_mock_enable, pidsensorpath.c_str(), defer); @@ -248,9 +248,9 @@ TEST_F(PidZoneTest, RpmSetPoints_AddMaxClear_BehaveAsExpected) .WillOnce(Invoke( [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ("Enable", names[0]); - return 0; - })); + EXPECT_STREQ("Enable", names[0]); + return 0; + })); zone->addPidControlProcess(sensorname, sensorType, setpoint, bus_mock_enable, pidsensorpath.c_str(), defer); @@ -292,9 +292,9 @@ TEST_F(PidZoneTest, RpmSetPoints_AddBelowMinimum_BehavesAsExpected) .WillOnce(Invoke( [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ("Enable", names[0]); - return 0; - })); + EXPECT_STREQ("Enable", names[0]); + return 0; + })); zone->addPidControlProcess(sensorname, sensorType, setpoint, bus_mock_enable, pidsensorpath.c_str(), defer); @@ -362,13 +362,13 @@ TEST_F(PidZoneTest, ThermalInputs_FailsafeToValid_ReadsSensors) std::string name1 = "temp1"; int64_t timeout = 1; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "temp2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -414,13 +414,13 @@ TEST_F(PidZoneTest, FanInputTest_VerifiesFanValuesCached) std::string name1 = "fan1"; int64_t timeout = 2; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "fan2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -462,13 +462,13 @@ TEST_F(PidZoneTest, ThermalInput_ValueTimeoutEntersFailSafeMode) int64_t timeout = 1; std::string name1 = "temp1"; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "temp2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -524,13 +524,13 @@ TEST_F(PidZoneTest, ThermalInput_MissingIsAcceptableNoFailSafe) int64_t timeout = 1; std::string name1 = "temp1"; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "temp2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -620,13 +620,13 @@ TEST_F(PidZoneTest, FanInputTest_FailsafeToValid_ReadsSensors) std::string name1 = "fan1"; int64_t timeout = 2; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "fan2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -673,13 +673,13 @@ TEST_F(PidZoneTest, FanInputTest_ValueTimeoutEntersFailSafeMode) std::string name1 = "fan1"; int64_t timeout = 2; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string name2 = "fan2"; - std::unique_ptr sensor2 = std::make_unique(name2, - timeout); + std::unique_ptr sensor2 = + std::make_unique(name2, timeout); SensorMock* sensor_ptr2 = reinterpret_cast(sensor2.get()); std::string type = "unchecked"; @@ -732,8 +732,8 @@ TEST_F(PidZoneTest, GetSensorTest_ReturnsExpected) int64_t timeout = 1; std::string name1 = "temp1"; - std::unique_ptr sensor1 = std::make_unique(name1, - timeout); + std::unique_ptr sensor1 = + std::make_unique(name1, timeout); SensorMock* sensor_ptr1 = reinterpret_cast(sensor1.get()); std::string type = "unchecked"; @@ -807,9 +807,9 @@ TEST_F(PidZoneTest, ManualModeDbusTest_VerifySetManualBehavesAsExpected) .WillOnce(Invoke( [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ("Manual", names[0]); - return 0; - })); + EXPECT_STREQ("Manual", names[0]); + return 0; + })); // Method under test will set the manual mode to true and broadcast this // change on dbus. diff --git a/test/sensor_host_unittest.cpp b/test/sensor_host_unittest.cpp index cb5ede4a..e9800cf3 100644 --- a/test/sensor_host_unittest.cpp +++ b/test/sensor_host_unittest.cpp @@ -51,8 +51,8 @@ TEST(HostSensorTest, CreateHostTempSensorTest) sd_bus_emit_object_removed(IsNull(), StrEq(objPath))) .WillOnce(Return(0)); - std::unique_ptr s = HostSensor::createTemp(name, timeout, bus_mock, - objPath, defer); + std::unique_ptr s = + HostSensor::createTemp(name, timeout, bus_mock, objPath, defer); } TEST(HostSensorTest, VerifyWriteThenReadMatches) @@ -77,8 +77,8 @@ TEST(HostSensorTest, VerifyWriteThenReadMatches) sd_bus_emit_object_removed(IsNull(), StrEq(objPath))) .WillOnce(Return(0)); - std::unique_ptr s = HostSensor::createTemp(name, timeout, bus_mock, - objPath, defer); + std::unique_ptr s = + HostSensor::createTemp(name, timeout, bus_mock, objPath, defer); // Value is updated from dbus calls only (normally). HostSensor* hs = static_cast(s.get()); @@ -93,9 +93,9 @@ TEST(HostSensorTest, VerifyWriteThenReadMatches) .WillOnce(Invoke( [=]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path, [[maybe_unused]] const char* interface, const char** names) { - EXPECT_STREQ("Value", names[0]); - return 0; - })); + EXPECT_STREQ("Value", names[0]); + return 0; + })); std::chrono::high_resolution_clock::time_point t1 = std::chrono::high_resolution_clock::now(); diff --git a/test/sensor_manager_unittest.cpp b/test/sensor_manager_unittest.cpp index b5b67c71..85865a88 100644 --- a/test/sensor_manager_unittest.cpp +++ b/test/sensor_manager_unittest.cpp @@ -53,8 +53,8 @@ TEST(SensorManagerTest, AddSensorInvalidTypeTest) std::string name = "name"; std::string type = "invalid"; int64_t timeout = 1; - std::unique_ptr sensor = std::make_unique(name, - timeout); + std::unique_ptr sensor = + std::make_unique(name, timeout); Sensor* sensor_ptr = sensor.get(); s.addSensor(type, name, std::move(sensor));