History log of /openbmc/phosphor-psu-code-mgmt/test/mocked_utils.hpp (Results 1 – 10 of 10)
Revision Date Author Comments
# 66a54ad4 23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable cppcoreguidelines-special-member-functions

The check finds classes where some but not all of the special member
functions are defined.

By default the compiler defines a copy cons

clang-tidy: Enable cppcoreguidelines-special-member-functions

The check finds classes where some but not all of the special member
functions are defined.

By default the compiler defines a copy constructor, copy assignment
operator, move constructor, move assignment operator and destructor.
The default can be suppressed by explicit user-definitions. The
relationship between which functions will be suppressed by
definitions of other functions is complicated and it is advised that
all five are defaulted or explicitly defined.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Icbfd448b2bf78ebf99ec07b55220871e093cb899

show more ...


# 047d9944 23-Aug-2024 George Liu <liuxiwei@ieisystem.com>

clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions

Adds override (introduced in C++11) to overridden virtual functions
and removes virtual from those functions as it is not required.

v

clang-tidy: Enable cppcoreguidelines-explicit-virtual-functions

Adds override (introduced in C++11) to overridden virtual functions
and removes virtual from those functions as it is not required.

virtual on non base class implementations was used to help indicate
to the user that a function was virtual. C++ compilers did not use
the presence of this to signify an overridden function.

In C++11 override and final keywords were introduced to allow
overridden functions to be marked appropriately. Their presence
allows compilers to verify that an overridden function correctly
overrides a base class implementation.

This can be useful as compilers can generate a compile time error
when:
- The base class implementation function signature changes.
- The user has not created the override with the correct signature.

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I428f69c11b071a1a50e7f93f7bcc29c8300dcddb

show more ...


# 374fae56 22-Jul-2022 Patrick Williams <patrick@stwcx.xyz>

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are

sdbusplus: use shorter type aliases

The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t

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

show more ...


# 4b9ac392 11-Oct-2019 Lei YU <mine260309@gmail.com>

utils: Add function to check if PSU is associated

Add a helper function to check if a PSU is in an association list, which
will be used in future commits to check if a PSU is running a software
imag

utils: Add function to check if PSU is associated

Add a helper function to check if a PSU is in an association list, which
will be used in future commits to check if a PSU is running a software
image.

Tested: added unit test case and verify it passes.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I99b5d3d8d09f8e09a1eb42ba104a4804b7214cf1

show more ...


# 6520748d 11-Oct-2019 Lei YU <mine260309@gmail.com>

utils: Add function to get the latest version

This repo does not know which PSU version is the latest, and it lets the
vendor tool to decide which one is the latest.

This commit defines PSU_VERSION

utils: Add function to get the latest version

This repo does not know which PSU version is the latest, and it lets the
vendor tool to decide which one is the latest.

This commit defines PSU_VERSION_COMPARE_UTIL which is expected to be a
tool that accepts arguments of a list of versions, and returns the
latest version string.

Tested: Put and configure to use the example get_latest_version on
Witherspoon, verify the versionId with a larger version string
is returned.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Ic5a10d3724cf6a98b3979486c72d54f8deac7038

show more ...


# c09155bb 11-Oct-2019 Lei YU <mine260309@gmail.com>

Test: Use unique mocked utils for each test

The mocked utils object was shared between the tests because it's a
static object. This causes problems on expecting the number of
called the mocked funct

Test: Use unique mocked utils for each test

The mocked utils object was shared between the tests because it's a
static object. This causes problems on expecting the number of
called the mocked functions.

Add a freeUtils() in mocked_utils.hpp, and call it in test fixture's
destructor, so that each test case will use a different mocked object.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I2622c678012d30b2bd75dc37a2bc3a663f40d86c

show more ...


# ff83c2a0 12-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Support to update multiple PSUs

Queue the update on multiple PSUs, and do the update one-by-one.

Tested: Write unit test cases and verify the cases pass.
On witherspoon, verify

Activation: Support to update multiple PSUs

Queue the update on multiple PSUs, and do the update one-by-one.

Tested: Write unit test cases and verify the cases pass.
On witherspoon, verify the dummy update services are run on all
PSUs.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icfe0f6e74623e54840df8d731d852d53d6071768

show more ...


# d0bbfa9e 11-Sep-2019 Lei YU <mine260309@gmail.com>

Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This i

Activation: Delete version interface after activation

When activation is finished, the version interface and the related
images created by phosphor-version-software-manager shall be deleted.

This is done by invoking the Delete method of the related service, so we
need to get all the services from the object, and get the correct
service to invoke the Delete method.

Tested: Verify the Version interface created by
xyz.openbmc_project.Software.Version service, and the related
files in /tmp/image/<versionId> are removed after activation is
completed.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: Icb14731bbea35175c2519bd40b9f88a0b54a034a

show more ...


# 5f3584d4 27-Aug-2019 Lei YU <mine260309@gmail.com>

Get PSU version from vendor specific tool

The code was getting the version from PSU inventory object.
This commit changes the behavior to use a vendor-specific tool to get
the version directly, wher

Get PSU version from vendor specific tool

The code was getting the version from PSU inventory object.
This commit changes the behavior to use a vendor-specific tool to get
the version directly, where the tool is expected to be configured during
build time.

Add an example get_version app that shows the expected behavior of the
tool:
* It accepts an argument of PSU inventory object;
* It outputs the version to stdout.

Tested: 1. Put and configure to use the example get_version on witherspoon,
verify that PSU software objects are created with the version
returned by the exmaple tool.
2. With the Witherspoon specific tool in
https://gerrit.openbmc-project.xyz/c/openbmc/witherspoon-pfault-analysis/+/24811,
verify the version is correctly got from the PSU inventory path
and the software objects are created.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I5195cb6fc8998a76b09abcfe0b107364cb180c01

show more ...


# f77189f7 07-Aug-2019 Lei YU <mine260309@gmail.com>

Add unit test for item_udpater

To test item_updater easier, mocking utils is necessary.
So add a UtilsInterface to make the mocking eaiser.

Due to the fact that there is templated member functions

Add unit test for item_udpater

To test item_updater easier, mocking utils is necessary.
So add a UtilsInterface to make the mocking eaiser.

Due to the fact that there is templated member functions that could not
be virtual, adding an extra "Impl" virtual function makes it possible to
simulates the mock of templated functions.
See
https://stackoverflow.com/questions/7968023/c-virtual-template-method
for details.

However, using std::any in with googlemock has an issue on GCC9, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415
for details.

So this commit uses std::experimental::any as a workaround.

With the mocked utils, it's easy to test item_updater in different
cases.

This commit adds the test cases for creating PSU objects, when:
* There is no PSU present
* There is one PSU present
* There are two PSUs present with the same version;
* There are two PSUs present with different versions.

Tested: Verify the unit tests passes.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I5d74ab26b344c5c40bc141f97b8aca42e74ee88e

show more ...