History log of /openbmc/phosphor-hwmon/test/ (Results 1 – 25 of 45)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
02e598ab16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Iabfeec3ff53427c317ef9c0b5bf06326ab9a1e17
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

82f2db6e22-Jul-2024 Matt Spinler <spinler@us.ibm.com>

Remove add_object_vtable expect from fanpwm UT

For some reason, having an expect on the sdbusplus mock
sd_bus_add_object_vtable causes valgrind to fail in CI with errors such
as:

```
==729843== Con

Remove add_object_vtable expect from fanpwm UT

For some reason, having an expect on the sdbusplus mock
sd_bus_add_object_vtable causes valgrind to fail in CI with errors such
as:

```
==729843== Conditional jump or move depends on uninitialized value(s)
==729843== at 0x5CB89AB: std::unique_ptr<sd_bus_slot, sdbusplus::slot::details::SlotDeleter>::~unique_ptr() (unique_ptr.h:403)
==729843== by 0x5CB8665: sdbusplus::slot::slot::~slot() (slot.hpp:43)
==729843== by 0x5CC3CC9: sdbusplus::server::interface::interface::~interface() (interface.cpp:38)
==729843== by 0x13189B: sdbusplus::server::xyz::openbmc_project::control::FanPwm::~FanPwm() (server.hpp:32)
==729843== by 0x13E267: sdbusplus::server::object::details::compose<sdbusplus::server::xyz::openbmc_project::control::FanPwm>::~compose() (object.hpp:181)
==729843== by 0x13E4BC: sdbusplus::server::object::object<sdbusplus::server::xyz::openbmc_project::control::FanPwm>::~object() (object.hpp:95)
==729843== by 0x13C5C9: hwmon::FanPwm::~FanPwm() (fan_pwm.hpp:18)
==729843== by 0x12C0D1: FanPwmTest_BasicConstructorDeferredTest_Test::TestBody() (fanpwm_unittest.cpp:76)
==729843== by 0x5E089FC: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2638)
==729843== by 0x5DFE67A: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (gtest.cc:2674)
==729843== by 0x5DD3BA3: testing::Test::Run() (gtest.cc:2713)
==729843== by 0x5DD4661: testing::TestInfo::Run() (gtest.cc:2859)
```

There are 4 more stanzas of similar 'Conditional jump or move...'
errors. None of these show up without the vtable expect.

Other repositories that use this same expect also fail.

I opened sdbusplus issue openbmc/sdbusplus#97 for the problem. I spent
time looking into it, and did not figure anything out.

This commit just removes the call to it because in these testcases the
FanPwm object, which is just derived from the sdbuplus interface object,
is simply created on the stack:

```
hwmon::FanPwm f(...);
```

The unit tests aren't actually testing any code that conditionally
creates a FanPwm interface on D-Bus, so checking that it happens isn't
that useful and seems to more just be testing sdbusplus.

Change-Id: Idf2df085bf909af1ad94ba06863c4605831a3824
Signed-off-by: Matt Spinler <spinler@us.ibm.com>

show more ...

58bd8ba829-Nov-2023 Patrick Williams <patrick@stwcx.xyz>

build: use allowed over enabled

Meson feature options are typically in a tri-state of enabled, disabled,
or auto. The enabled and disabled functions on an option (from
`get_option`) no longer retur

build: use allowed over enabled

Meson feature options are typically in a tri-state of enabled, disabled,
or auto. The enabled and disabled functions on an option (from
`get_option`) no longer return true for auto features. Instead, the
expectation is to use `allowed()` which is true for both enabled and auto.

Switch all uses of `enabled` to `allowed`.

Change-Id: I0fe9c9363a6a6dc1cd508da03ab30dde022c5526
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

c8e818dd20-Oct-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I542db97d7dc7fe5b03ffedbbdbff968d4c1bb032
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

e8771fd410-May-2023 Patrick Williams <patrick@stwcx.xyz>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Change-Id: I267a17e007b99caed10aef060e7dd9a0bcc5fc2e
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...

9c40534529-May-2021 William A. Kennington III <wak@google.com>

build: test: Fix invalid variable

We don't define the build_tests variable, reference the option directly
instead.

Change-Id: Ic190c083c2c4ebd4c1b3715cea39b563e0294b6d
Signed-off-by: William A. Ken

build: test: Fix invalid variable

We don't define the build_tests variable, reference the option directly
instead.

Change-Id: Ic190c083c2c4ebd4c1b3715cea39b563e0294b6d
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...

bb25973a05-May-2021 William A. Kennington III <wak@google.com>

meson: Cleanup tests and make them execute again

The tests were previously building but not executing. Fix the build so
they execute and pass again.

Change-Id: I6e29eadd4f51cf47d05f7172f37c76688955

meson: Cleanup tests and make them execute again

The tests were previously building but not executing. Fix the build so
they execute and pass again.

Change-Id: I6e29eadd4f51cf47d05f7172f37c76688955ac61
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...

f9aff80505-May-2021 William A. Kennington III <wak@google.com>

meson: Cleanup library linking

Change-Id: Ie1fa47ec3c6f2d2a88f8487f3a533c5ebd801612
Signed-off-by: William A. Kennington III <wak@google.com>

6f42e35628-Apr-2021 Matt Spinler <spinler@us.ibm.com>

Remove autotools files

Now that meson is enabled in the bitbake build, remove support for
building with autotools.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I49d66ca766d7d3475f454

Remove autotools files

Now that meson is enabled in the bitbake build, remove support for
building with autotools.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I49d66ca766d7d3475f454675124b3008f70bde4f

show more ...

82921ae802-Feb-2021 Matt Spinler <spinler@us.ibm.com>

Change an sdbusplus mock signature

The signature of sd_bus_emit_properties_changed_strv changed.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I94cd218d04e4a79444314684020da1a1ff3969a3

5e034afc24-Jun-2020 Matt Spinler <spinler@us.ibm.com>

Print the failing filename in the journal msg

Instead of hiding the name of the file that had the failed access in the
journal metadata, put it in the journal message so debug is easier.

Uses the f

Print the failing filename in the journal msg

Instead of hiding the name of the file that had the failed access in the
journal metadata, put it in the journal message so debug is easier.

Uses the fmt library.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ice3958ffb576adf0b06ef7eab7d2fc03aa526819

show more ...

5906173a07-Oct-2019 Brad Bishop <bradleyb@fuzziesquirrel.com>

build: add support for building with meson

Follow the OpenBMC herd and support a more modern, more comprehensible,
more performant build framework.

To build using meson:
meson build
ninja -C bu

build: add support for building with meson

Follow the OpenBMC herd and support a more modern, more comprehensible,
more performant build framework.

To build using meson:
meson build
ninja -C build
ninja -C build install

Maintain support for:
Configurable dbus parameters:
BUSNAME_PREFIX= -> -Dbusname-prefix=
SENSOR_ROOT= -> -Dsensor-root=
System call failure behavior:
--enable-negative-errno-on-failure -> -Dnegative-errno-on-fail
--enable-update-functional-on-fail -> -Dupdate-functional-on-fail

Add -Dtests to match de-facto OpenBMC meson usage conventions.

Drop support for --enable-oe-sdk rpath munging. This is a workaround
for broken oe sdks that don't figure out the correct rpath when running
make check or ninja test.

Upstream meson does not currently have support for custom code coverage
parameters:
https://github.com/mesonbuild/meson/issues/4628

Autotools does support this, so support of our custom code coverage
parameters cannot be maintained using meson, without meson enhancements.

Change-Id: I312f1af4c3fcc20ca8bdf2bbf53b06f18abfbfe2
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...

778f5c3907-Oct-2019 Brad Bishop <bradleyb@fuzziesquirrel.com>

tests: fix warnings

Fix a couple of warnings:

-Werror=unused-parameter

so we can use meson's warning_level=3 and -Werror without build
failures.

Change-Id: I1c3930226b34d6beeb7c5fb5ce135c722d3e87

tests: fix warnings

Fix a couple of warnings:

-Werror=unused-parameter

so we can use meson's warning_level=3 and -Werror without build
failures.

Change-Id: I1c3930226b34d6beeb7c5fb5ce135c722d3e8758
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...

57e18b9407-Oct-2019 Brad Bishop <bradleyb@fuzziesquirrel.com>

test: average: avoid unwanted implicit type deduction

Avoid undesired implicit type deduction of std::make_pair with integer
literal arguments. Ensure the correct type of int64_t is always
deduced;

test: average: avoid unwanted implicit type deduction

Avoid undesired implicit type deduction of std::make_pair with integer
literal arguments. Ensure the correct type of int64_t is always
deduced; long is not 64 bits wide on all platforms.

Change-Id: I48bbb8a9f4f8a9a0fececdd03052a7dbdeefd69c
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...

bd9bc00b21-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 ...

9bbe602601-Aug-2019 Carol Wang <wangkair@cn.ibm.com>

Support averaging power values

Support new env variables 'AVERAGE_power* = "true"' in hwmon config file.
When this env variable is set, power value is the calculated average value.
Otherwise, power

Support averaging power values

Support new env variables 'AVERAGE_power* = "true"' in hwmon config file.
When this env variable is set, power value is the calculated average value.
Otherwise, power value is from power*_input by default.
The new average of power is calculated since the last time the sensor's
values were changed and read.

average =
(cur_average*cur_average_interval - pre_average*pre_average_interval) /
(cur_average_interval - pre_average_interval)

hwmon config example:
AVERAGE_power2 = "true"
AVERAGE_power3 = "true"
AVERAGE_power4 = "true"

Tested: Set AVERAGE_power* in p0 OCC hwmon conf but not in p1 OCC hwmon conf,
then get power sensor info with restapi to check the values.
1. The values of p0*power are all average values.
2. The values of p1*power are all input values.

Note:
Delete $(CODE_COVERAGE_CPPFLAGS) in AM_CPPFLAGS in test/Makefile.am.
This option will define NDEBUG during configuration, then assert in
code doesn't work.

Resolves: openbmc/openbmc#3187
Signed-off-by: Carol Wang <wangkair@cn.ibm.com>
Change-Id: I8d97a7b2905c79cd4f2c276b32e7f5590ffc0483

show more ...

2227bd5219-Jun-2019 William A. Kennington III <wak@google.com>

sensor: Replace GpioLock with stdplus RAII helper

The old RAII helper was not move safe, although it was never moved in
the current code so it didn't have any effect on runtime safety.

Change-Id: I

sensor: Replace GpioLock with stdplus RAII helper

The old RAII helper was not move safe, although it was never moved in
the current code so it didn't have any effect on runtime safety.

Change-Id: Ica19ed7e60d699d86d0166b356cedb82e4a28b61
Signed-off-by: William A. Kennington III <wak@google.com>

show more ...

caaebd1f21-Jun-2019 Patrick Venture <venture@google.com>

hwmonio: Add injection point to test internal behavior

With the complexities of the various behaviors within the read() method
of HwmonIO, introduce an injection point for testing. There is a
defau

hwmonio: Add injection point to test internal behavior

With the complexities of the various behaviors within the read() method
of HwmonIO, introduce an injection point for testing. There is a
default available, and therefore this is a surgical change that only
impacts future tests.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1ead56c7fe1a2f87ebf316488e68f435a41c9d19

show more ...

7e27665813-Mar-2019 Patrick Venture <venture@google.com>

build: enable valgrind

Enable valgrind to check memory usage.

Change-Id: I73ec2ee1a92e797ea9b78d6ea440f9ccdd2f49f3
Signed-off-by: Patrick Venture <venture@google.com>

69a68edd06-Mar-2019 Patrick Venture <venture@google.com>

build: enable code coverage

Enable code coverage for the project. Valgrind not enabled in this
step.

Tested: Verified code coverage step now running.
Change-Id: Ieb3606e5ad741fb0dd181f8da594c18258

build: enable code coverage

Enable code coverage for the project. Valgrind not enabled in this
step.

Tested: Verified code coverage step now running.
Change-Id: Ieb3606e5ad741fb0dd181f8da594c18258efa6bc
Signed-off-by: Patrick Venture <venture@google.com>

show more ...

5d8f570b06-Mar-2019 Patrick Venture <venture@google.com>

test: rework gtest/gmock lookup

Rework the gtest/gmock lookup based on openbmc/gpioplus.

Change-Id: Ic53928e6f8b7a30e801976d62c910fe31bd4cc49
Signed-off-by: Patrick Venture <venture@google.com>

56c876f306-Mar-2019 Patrick Venture <venture@google.com>

test: rework to use Pair-wise comparison

Use Pair-wise comparison instead of straight equality check.

Change-Id: I3aa567015bfbd81578275fc0edf1ef785fde7678
Signed-off-by: Patrick Venture <venture@go

test: rework to use Pair-wise comparison

Use Pair-wise comparison instead of straight equality check.

Change-Id: I3aa567015bfbd81578275fc0edf1ef785fde7678
Signed-off-by: Patrick Venture <venture@google.com>

show more ...

cd40c88124-Jan-2019 Patrick Venture <venture@google.com>

test: add adjustvalue test

Add a test that calls adjust value on a sensor value to verify it's
processed as expected.

Change-Id: Iff299efced680c730d7ba5bdeff71617446db042
Signed-off-by: Patrick Ven

test: add adjustvalue test

Add a test that calls adjust value on a sensor value to verify it's
processed as expected.

Change-Id: Iff299efced680c730d7ba5bdeff71617446db042
Signed-off-by: Patrick Venture <venture@google.com>

show more ...

99b9581519-Dec-2018 Patrick Venture <venture@google.com>

sensor: add gpio handle test variation

Add a sensor constructor test where the gpio handle is required.

Change-Id: I05050fb71a6287183ca94f974e965e3f58de9499
Signed-off-by: Patrick Venture <venture@

sensor: add gpio handle test variation

Add a sensor constructor test where the gpio handle is required.

Change-Id: I05050fb71a6287183ca94f974e965e3f58de9499
Signed-off-by: Patrick Venture <venture@google.com>

show more ...

e3e0f97d19-Dec-2018 Patrick Venture <venture@google.com>

test: add gpiohandle mock impl

Add gpio handle mock implementation for use in testing.

Change-Id: I0fb2d1af4739ad700f62a4e7cbbe62db528bb93e
Signed-off-by: Patrick Venture <venture@google.com>

12