#
bd9bc00b |
| 21-Aug-2019 |
Kun Yi <kunyi731@gmail.com> |
Rework envMock
Instead of mocking all the functions, only mock std::getenv. Now each test only needs to provide an EnvImpl that delegate calls to mockEnv in order to inject dependencies on std::gete
Rework envMock
Instead of mocking all the functions, only mock std::getenv. Now each test only needs to provide an EnvImpl that delegate calls to mockEnv in order to inject dependencies on std::getenv. This for several reasons: 1. Any call to env::getEnv() will be calling the real implementation of the C++ code, and testing real code is better than testing mocks. 2. It is easier to write a fake class that takes a config string which can greatly simplify test cases. 3. We can now write unit tests that ensure the number of times std::getenv gets called (should be once, but multiple times right now).
Tested: unit tests still pass
Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: I3e5aff7fa5d025de1b8ae798af43b97d31151ab9
show more ...
|
#
043d3230 |
| 31-Aug-2018 |
Patrick Venture <venture@google.com> |
add .clang-format
Change-Id: I94ce26d595367e08d6fb3734535bcd855f1b1473 Signed-off-by: Patrick Venture <venture@google.com>
|
#
7c424807 |
| 04-May-2018 |
Matt Spinler <spinler@us.ibm.com> |
Support indirections other than just "label"
The current code only allowed the MODE_<type><Num> env var to be "label" when doing DBus naming indirection.
Add support to allow it to be anything, and
Support indirections other than just "label"
The current code only allowed the MODE_<type><Num> env var to be "label" when doing DBus naming indirection.
Add support to allow it to be anything, and then use that value to do the lookup.
For example, if MODE_temp1 = "foo", then the code will read the temp1_foo file to find the value to append to LABEL to find the DBus object name. So if temp1_foo contained a 42, then the code will use the LABEL_temp42 var to find the object name.
Tested: Test on the OpenPower OCC device which use 'label' and now 'function_id' for the indirections.
Change-Id: I1f3115a2d37d008efca74748ac7eff8434d8320a Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
a24c8808 |
| 17-Apr-2018 |
Patrick Venture <venture@google.com> |
move calls to cstdlib::getenv to env::getEnv
Wrapped the cstdlib::getenv() call into env::getEnv so that it can be tested by mocking the env namespace, by just dropping in test_env.cpp which impleme
move calls to cstdlib::getenv to env::getEnv
Wrapped the cstdlib::getenv() call into env::getEnv so that it can be tested by mocking the env namespace, by just dropping in test_env.cpp which implements those methods and tying them a singleton upon which we can set expectations.
Note: regardless of the approach taken to mock this, wrapping this method is a good fix.
Change-Id: I65d22da08fc3dd76e6860f728c54e6c847ed07de Signed-off-by: Patrick Venture <venture@google.com>
show more ...
|
#
7a5285de |
| 17-Apr-2018 |
Patrick Venture <venture@google.com> |
move getEnv methods into env namespace
Move the getEnv(...) methods into the env namespace, for consistency.
Change-Id: I4055d9456c17f8b20071cdee1b8e531c10fb0c7e Signed-off-by: Patrick Venture <ven
move getEnv methods into env namespace
Move the getEnv(...) methods into the env namespace, for consistency.
Change-Id: I4055d9456c17f8b20071cdee1b8e531c10fb0c7e Signed-off-by: Patrick Venture <venture@google.com>
show more ...
|
#
9331ab78 |
| 29-Jan-2018 |
Patrick Venture <venture@google.com> |
Add fan pwm interface target
The current daemon only supports RPM-based fan control, whereas the hwmon interface for PWM is often present. This implements the Fan Control PWM dbus interface.
This
Add fan pwm interface target
The current daemon only supports RPM-based fan control, whereas the hwmon interface for PWM is often present. This implements the Fan Control PWM dbus interface.
This CL is not the complete solution, but if mixed with a follow-on CL that does this, I think it'll be ideal. For instance, this assumes the pwm number matches, whereas the other CL lets you specify the corresponding PWM target for the fan.
Change-Id: I23aaa0619cdefba0a004ac0d26dc6b928e78f1e8 Signed-off-by: Patrick Venture <venture@google.com>
show more ...
|
#
5ac7b19f |
| 12-Oct-2017 |
Matt Spinler <spinler@us.ibm.com> |
Remove getIndirectLabelEnv
It is no longer used.
Change-Id: I4713fbd9232dfeed045125cbb827b4fe98c53717 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
|
#
82d507d0 |
| 12-Oct-2017 |
Matt Spinler <spinler@us.ibm.com> |
Add getIndirectID function
This function will look up the sensor ID for a sensor when it is specified in a label file in hwmon sysfs.
This functionality was previously all contained in getIndirectl
Add getIndirectID function
This function will look up the sensor ID for a sensor when it is specified in a label file in hwmon sysfs.
This functionality was previously all contained in getIndirectlLabelEnv(). A future commit will remove this function entirely and just use getIndirectID() and getEnv() to look up the label for the indirect case.
Change-Id: Ifeb636eb0e58a6204f782f64e9aba839b812a967 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
049e0dd2 |
| 12-Oct-2017 |
Matt Spinler <spinler@us.ibm.com> |
Add another version of getEnv
The new version takes the type and ID parameters separately as opposed to together in a key_type.
Change-Id: I7796e8e6d680ffb640028e91eb3dcc8e7d99bc2e Signed-off-by: M
Add another version of getEnv
The new version takes the type and ID parameters separately as opposed to together in a key_type.
Change-Id: I7796e8e6d680ffb640028e91eb3dcc8e7d99bc2e Signed-off-by: Matt Spinler <spinler@us.ibm.com>
show more ...
|
#
1f8a9586 |
| 12-Jun-2017 |
Tom Joseph <tomjoseph@in.ibm.com> |
Add a level of indirection when naming the DBUS objects
The current design ignores the itemX_label sysfs attribute, if the environment variable is populated with the MODE_itemX="label", then fetch t
Add a level of indirection when naming the DBUS objects
The current design ignores the itemX_label sysfs attribute, if the environment variable is populated with the MODE_itemX="label", then fetch the label from itemX_label file.The actual label for the dbus object is fetched from the environment variable LABEL_item<label>.
Resolves openbmc/openbmc#1633
Change-Id: I0d4baaa91073dd5db75ac62277d78ad9b3065e64 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
show more ...
|
#
f3df6b4f |
| 06-Jan-2017 |
Brad Bishop <bradleyb@fuzziesquirrel.com> |
Add configuration discovery helper method
Sensor configuration is passed to the application via the enviroment. Create a map of environment values for a given sensor.
Change-Id: I8369eda27798fd9472
Add configuration discovery helper method
Sensor configuration is passed to the application via the enviroment. Create a map of environment values for a given sensor.
Change-Id: I8369eda27798fd9472166e898b8d6166c6997392 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
show more ...
|