summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* conf: add ignoreDbusMinMax optionPatrick Venture2019-09-102-1/+140
| | | | | | | | | Add an optional field to the sensor configuration, s.t. it'll tell a dbus passive sensor to ignore the MinValue and MaxValue properties from dbus. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ia6a8c802c2dc5bf41e5e860b21d7764cc09e6b6b
* rename away from RPMPatrick Venture2019-07-163-18/+18
| | | | | | | | | | The SetPoint output from a thermal PID is likely RPM, and that value is then fed into a fan controller PID as the set-point (unit: RPM). This does not have to be RPM, however. Continue renaming variables and methods to remove the explicit unit-naming. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I570dee0c688338f9a458cac7123314717bee2b42
* rename RPMSetPoint to SetPointPatrick Venture2019-07-164-12/+12
| | | | | | | | | | | The PIDs were originally focused on collecting RPM set points from thermal PIDs and then having fan PIDs use the highest value collected, it doesn't need to be strictly an RPM set point. It does however need to be one type of value. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I1d589cf4b2688d7e86030c10496d737dc5bbdadf
* Add Fan Redundancy SupportJames Feist2019-06-052-5/+6
| | | | | | | | | | | | | | This adds fan redundancy support to passive sensors. If there are redundancy interfaces on dbus, we'll fail a sensor if the status is set to failed. Tested: Set Redundancy to Failed On Dbus, saw all fans in collection boost. Then restarted swampd, came up and still boosted. Set redundancy OK, and they all slowed down. Change-Id: I8879bef1471bbc168435d6b22dd20006b9dca133 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add stepwise parserHank Liou2019-05-281-0/+85
| | | | | | | | The json parser cannot read stepwise setting from config. This change adds support to stepwise type of pid. Change-Id: I650c5bd6a0040bf25630e33b3bd36abf388f0cd8 Signed-off-by: Hank Liou <Hank.Liou@quantatw.com>
* Check fans for failureWill Liang2019-05-231-0/+112
| | | | | | | | Add check the fan fail. If detect fan fail then into the fail safe mode. Signed-off-by: Will Liang <will.liang@quantatw.com> Change-Id: I6ef9d42e131500c1b38a708e1c6fda15dc712f60
* Make dbusconfiguration reloadable without rebootJames Feist2019-05-092-4/+4
| | | | | | | | | | | | | | | | | Now that asio is being used instead of threads, we can reload the fan configuration without having to restart the application. This moves the ownership of the passive and host bus outside of the SensorManager so that it can be recreated each reload. Tested: Watched logs and saw full fan config get reloaded after changing fan configuration Tested: Ran on json configured system and it behaved as expected. Change-Id: I00e6b27f75384fd41de2017b723f159c9691ae97 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Consolidate all util.hppJames Feist2019-05-081-1/+1
| | | | | | | | This deletes all lower level util.hpp and cats them into the top level util.hpp to avoid name conflicts. Change-Id: Ia11e4a08053a3970b0aadf21d1156ab26def36bd Signed-off-by: James Feist <james.feist@linux.intel.com>
* bugfix: grab hystersis parameter from pid jsonPatrick Venture2019-03-261-0/+49
| | | | | | | | | | The code incorrectly attempts to read the hystersis parameters from the wrong scope of the json object. This fixes it to read from the pid configuration's scope. Tested: Added a new unit-test to hit this case. Change-Id: I808bc907ec33a0b12d68a88fd316c3c9fae41516 Signed-off-by: Patrick Venture <venture@google.com>
* autotools: Fix for autoconf-archive 2019.01.19Patrick Venture2019-03-191-2/+0
| | | | | | | | | The code coverage macros from the archive changed in a backward incompatible way. This adds a workaround to autodetect either version and do the right thing. Change-Id: I63d1cdf6edb125d75872d6dae38f8602fc043431 Signed-off-by: Patrick Venture <venture@google.com>
* build: enable code coveragePatrick Venture2019-03-061-2/+10
| | | | | | | | Enable code coverage for the project. Valgrind not enabled in this step. Change-Id: I62891f6054e5e5315d7f150a1f3dcf619f2740db Signed-off-by: Patrick Venture <venture@google.com>
* build: rework gtest checksPatrick Venture2019-03-061-4/+6
| | | | | | | Rework gtest checks to be modeled after openbmc/gpioplus. Change-Id: I54539c7031dbf87fea5d2c8ad56e415be8917f7a Signed-off-by: Patrick Venture <venture@google.com>
* add tuning enable variablePatrick Venture2019-02-281-2/+2
| | | | | | | | | | | Add a variable that when set, enables tuning logging. This variable is set to false. Tuning can be enabled via "-t" "--tuning" on the command line. With a parameter is the path where to write the logging information. Change-Id: I6eb8035d56cc3301face21e9375c02fc9fcc5b31 Signed-off-by: Patrick Venture <venture@google.com>
* Expand conf namespaceJames Feist2019-02-262-6/+6
| | | | | | | | | Put rest of conf.hpp in the conf namespace. This is largely a sed replace, and wrapping from_json in conf namespace as it failed to build. Change-Id: I9fe5c7b2fface44618c43af2367035afc39bcb64 Signed-off-by: James Feist <james.feist@linux.intel.com>
* s/minThermalRPM/minThermalOutputJames Feist2019-02-263-12/+13
| | | | | | | | | | The minThermalRPM is only an RPM by the fact that that is the units of the PID. As the PID units can be anything, change this to minThermalOutput to allow for different units (i.e. percent). Change-Id: Ic53fef1159ade5a413e5d519d407947f3023d8e3 Signed-off-by: James Feist <james.feist@linux.intel.com>
* dbuspassive: allow scalingJames Feist2019-02-261-2/+5
| | | | | | | | | | | | | | | | For tachs it is beneficial to deal in percent so that multiple controllers can be used with different fan types without having to recalculate. This starts using the unused min and max fields to be able to scale readings. Since max and min are commonly on the value interface, the special value of <int64_t>::lowest() allows these to be gathered from dbus instead of having to enter them manually. Tested-by: Moved pid control to percent and printed outputs Change-Id: I9496eb92a18b68a7cd7f034d41d40ef5175c6974 Signed-off-by: James Feist <james.feist@linux.intel.com>
* stepwise: Add ceiling typeJames Feist2019-02-262-6/+7
| | | | | | | | | | | Add a stepwise ceiling type, this is used as a upper clipping curve to limit the max output based on a temperature sensor. This is commonly used for quiet fan mode where CPU throttling is allowed to preserve a max fan noise. Change-Id: I181d5913c92e5498a34e6d3f67cf99b67471479c Signed-off-by: James Feist <james.feist@linux.intel.com>
* conf change: s/feedFwdOffOffsetCoeff/feedFwdOffsetCoeff/gPatrick Venture2019-02-202-4/+4
| | | | | | | Fixup spelling mistake for configuration field name. Change-Id: I92d0af06f4e15f4408dd10f0dd9cd71099b77f4f Signed-off-by: Patrick Venture <venture@google.com>
* DBusConfiguration: Fix scalingJames Feist2019-02-151-4/+6
| | | | | | | | | | | | Revert the removal of the /100 because that caused 90% to be passed as 90 instead of .9. To counter-act this multiply the stepwise controller by 100 so that setting 50 is 50%. Tested-by: Used sensor override to make stepwise jump threshold and got desired pwm result. Change-Id: I629bf0d4b0b3bc77660c09fccae82b1bdac4c578
* add json verification for configurationsPatrick Venture2019-02-112-1/+158
| | | | | | | | Add json verificiation for configurations. A configuration is lightly validated. Change-Id: I42361daf6ad21d3480e92c3808f5fc8ab8318e0b Signed-off-by: Patrick Venture <venture@google.com>
* add support to build zones and PIDs from jsonPatrick Venture2019-02-112-1/+72
| | | | | | | Add support to build zones and PIDs from a json configuration file. Change-Id: If8608dcd3e084cebabb71fc39851044df4d5d7c2 Signed-off-by: Patrick Venture <venture@google.com>
* conf change: s/set-point/setpoint/Patrick Venture2019-02-111-1/+1
| | | | | | | Remove the dash from set-point, such that it's one word: setpoint. Change-Id: I4c3033f3c2432a53d850e8f5defbe2ac1510daf8 Signed-off-by: Patrick Venture <venture@google.com>
* conf change: sensors: read and write path renamePatrick Venture2019-02-111-10/+10
| | | | | | | | Rename the readpath and writepath for camelcase styling to make all configuration variables consistent. Change-Id: I33f475075c8f40cd2029a5c0bfda950846cd5d44 Signed-off-by: Patrick Venture <venture@google.com>
* add support to build sensors from jsonPatrick Venture2019-02-082-1/+105
| | | | | | | Add support to build sensors from a json configuration file. Change-Id: Ic5bcbcd01e085ab0d4efaed314af8dc7e82b0b9d Signed-off-by: Patrick Venture <venture@google.com>
* Move all variant usage to stdJames Feist2019-02-081-2/+3
| | | | | | | | | | This just a style change, remove variant_ns in favor of std. Tested-by: it built Change-Id: Id5a075e8b73a7724cbc5153fb7dfcf369e79c483 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add Hysteresis to pid controllersJames Feist2019-02-051-0/+68
| | | | | | | | | | | | Add hysteresis to pid controllers to lower pwm changes. It is defaulted to 0 so it should be transparent to any controller that choses not to implement it. This is the same pattern used by the stepwise controller. Tested-by: Unit tests passed Change-Id: Ib47114285b0017258b7f77eaf067d310f95a0c60 Signed-off-by: James Feist <james.feist@linux.intel.com>
* test: add phosphor-logging to test makePatrick Venture2018-12-061-2/+4
| | | | | | | The tests now require phosphor-logging to be included as a library. Change-Id: Ie85d7bc9f6ff687f80064c2a499e934f7bcf2616 Signed-off-by: Patrick Venture <venture@google.com>
* Allow multiple inputs to thermal and stepwise controllersJames Feist2018-11-151-24/+54
| | | | | | | | | | | | | Use std::max to determine which input value to apply. Also start throwing when inputs are empty as otherwise there will be a nullptr dereference. Tested-by: Added multiple inputs and application no longer segfaults and verifed max was being used. Also added unit tests. Change-Id: I7c8eda45b99247b8e92e629f036c9a46c98d9fe2 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Move all floats to doublesPatrick Venture2018-11-116-24/+24
| | | | | | | | | The code was developed initially around a pid loop implemented using floats. Therefore, the code was converting back and forth between double for sensor values as inputs and outputs from this PID loop. Change-Id: I2d2919e1165103040729c9f16bb84fde3dd6b81b Signed-off-by: Patrick Venture <venture@google.com>
* style: s/getMinThermalRpmSetPt/getMinThermalRPMSetpoint/gPatrick Venture2018-10-301-3/+3
| | | | | | | Rename method per openbmc style guide. Change-Id: Ia861028452020ccefd463415093b5fb11f929ea4 Signed-off-by: Patrick Venture <venture@google.com>
* performance: fixup missing const reference in zonePatrick Venture2018-10-301-1/+1
| | | | | | | | | Zone::getSensor is passed directly to the Sensor Manager getSensor which takes the parameter by reference. Make it use an explicit const reference at both layers. Change-Id: I4895ea2935d20b73b88d33972e44b9ac557cd988 Signed-off-by: Patrick Venture <venture@google.com>
* style: s/getZoneId/getZoneID/gPatrick Venture2018-10-301-1/+1
| | | | | | | | Acronyms are meant to be in the same case within their part of the camel case name. Change-Id: I9e55d4419617a35b0f3a85f3d55543c8fc9bd76f Signed-off-by: Patrick Venture <venture@google.com>
* dbus: passive: move exception checking into factoryPatrick Venture2018-10-301-17/+4
| | | | | | | | Move the exception checking into the factory to remove possibility of exception during construction. Change-Id: I22922f23247c0579ee2a3411b5c8cede44fe324c Signed-off-by: Patrick Venture <venture@google.com>
* style: function names should be lower camelPatrick Venture2018-10-302-14/+14
| | | | | | | Fix function names to be lower camel. Change-Id: I145e1f4c03d7740bc1525dcffbdce2f78fd61075 Signed-off-by: Patrick Venture <venture@google.com>
* style: member functions should be lower camelPatrick Venture2018-10-309-70/+70
| | | | | | | Rename member functions to be lower camel instead of snake case. Change-Id: Ib227fd3dadb6d9607290277205223a4324cd4ce5 Signed-off-by: Patrick Venture <venture@google.com>
* [dbus-passive] Add threshold fan failureJames Feist2018-10-152-0/+156
| | | | | | | | | | | | | | When a threshold is crossed for a monitored sensor, assert fan failure. Tested-by: Changed a sensor threshold so that its current reading made the threshold asserted and noticed via print messages that the sensor went into failure state. Also noticed fans ramp. Wrote unit test to verify sensor can move in and out of error state correctly. Change-Id: I83182536e4874eaba97f3f1d48d53ac110fba833 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add hysteresis to stepwise controllerJames Feist2018-09-212-0/+88
| | | | | | | | Tested-by: Ran on platform monitoring output and wrote unit test Change-Id: I74a1d21544c1a9cb4c1cb26dd4a353cbff0442d0 Signed-off-by: James Feist <james.feist@linux.intel.com>
* Add stepwise controllerJames Feist2018-09-121-3/+3
| | | | | | | | | | | | | | | This adds the ability to use stepwise curves alongside pid control. This creates a base controller class that pidcontroller and stepwise controller inherit from. Note: Hysteresis to come in follow-on patch Tested-by: Created a stepwise controller and noticed that when it crossed a threshold that it contributed to the pwm setting. Change-Id: I6cf842f80eaccafc905d620970afe91e2092d568 Signed-off-by: James Feist <james.feist@linux.intel.com>
* clang-format: fix pointer alignment, sort usingPatrick Venture2018-09-047-56/+56
| | | | | Change-Id: Id433d0ecc10c62807594b3a637e591045223faa6 Signed-off-by: Patrick Venture <venture@google.com>
* add .clang-formatPatrick Venture2018-08-3116-345/+359
| | | | | Change-Id: I6627b5569c2e0f730be7331403218b823a2c622f Signed-off-by: Patrick Venture <venture@google.com>
* add missing gmock header: read|write interface mockPatrick Venture2018-08-292-0/+4
| | | | | Change-Id: I8633300650d1f40d9d5b880ebee3be51236db3c5 Signed-off-by: Patrick Venture <venture@google.com>
* test: dbus: dbusactivereadPatrick Venture2018-06-282-1/+56
| | | | | | | Add initial unit-tests. Change-Id: Id62894faf56a645dc44c51a173a67185ea5d9cd6 Signed-off-by: Patrick Venture <venture@google.com>
* test: dbus: passive read interfacePatrick Venture2018-06-282-1/+281
| | | | | | | | | | Added basic unit-tests and added a factory for creating the DbusPassive read interface so that it can be nicely error checked. This is handled via a valid type check where the only valid types are 'fan' and 'temp'. Change-Id: I558ed09bf509d26f20c6e431bb0789074e9aa841 Signed-off-by: Patrick Venture <venture@google.com>
* dbus: transition to interface for testingPatrick Venture2018-06-221-0/+21
| | | | | | | | | | To make testing easier, the dbus objects now receive a helper interface to use instead of calling into a helper module. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I2521d9c75aec76e92d2e26dc044d01011e44d552 Signed-off-by: Patrick Venture <venture@google.com>
* test: pid: fancontrollerPatrick Venture2018-06-222-1/+243
| | | | | | | | | Adds unit-tests for the fancontroller. Bugfix: set point not initialized to 0, although bug has no impact. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I516833d8c9ed806b765ff9333801f3d57932a17b Signed-off-by: Patrick Venture <venture@google.com>
* test: pid: thermalcontrollerPatrick Venture2018-06-222-1/+123
| | | | | | | | | | | | Tests for the pid/thermalcontroller module. Fixes a bug where one could pass an incorrect number of inputs to the thermalcontroller. This can still be side-stepped by calling the constructor directly. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I3153ae4d907d9f90787b03e9d013d4349d911948 Signed-off-by: Patrick Venture <venture@google.com>
* test: pid: zonePatrick Venture2018-06-225-15/+451
| | | | | | | | | | Add unit-tests for the PID zone module. Add zone_mock. Tested: Ran on quanta-q71l board and it behaved as expected. Change-Id: I51185b2d2daacea6ffb687e8f38c4fe2b2a1bed3 Signed-off-by: Patrick Venture <venture@google.com>
* update configure and test/Makefile.amPatrick Venture2018-06-221-5/+4
| | | | | | | | Update configure.ac and test/Makefile.am to properly handle newer googletest, per gerrit/11203. Change-Id: Idcef3d81ff834457fcdc6e0aa1be76b98c64b54c Signed-off-by: Patrick Venture <venture@google.com>
* util: enable unit-testsPatrick Venture2018-06-152-1/+75
| | | | | | | Start write tests and fix a missing header inclusion. Change-Id: I4e56323f972b1358dc83a4cb61c25f98cda2a479 Signed-off-by: Patrick Venture <venture@google.com>
* test: sensors: hostPatrick Venture2018-06-143-1/+211
| | | | | | | Tests for sensors/host Change-Id: I760825c666c711d6f9c394ceefe35f8151383785 Signed-off-by: Patrick Venture <venture@google.com>
OpenPOWER on IntegriCloud