History log of /openbmc/dbus-sensors/tests/test_Utils.cpp (Results 1 – 12 of 12)
Revision Date Author Comments
# eacbfdd1 04-Apr-2024 Ed Tanous <ed@tanous.net>

Enable misc-include-cleaner

Change-Id: I22099a0f95b2eb884dec7d95cee0bdd0c159fd1f
Signed-off-by: Ed Tanous <ed@tanous.net>


# 278e177f 11-Dec-2023 Tom Tung <shes050117@gmail.com>

HwmonTempMain: revert the type of bus and address back to uint64_t

In I546e967abae7c0fb9fca645867e3037046037647, the type of bus and
address in HwmonTempMain were updated to size_t.

However, in som

HwmonTempMain: revert the type of bus and address back to uint64_t

In I546e967abae7c0fb9fca645867e3037046037647, the type of bus and
address in HwmonTempMain were updated to size_t.

However, in some systems using i3c, the device name is composed by bus
number and the provisioned ID [1]. The provisioned ID is a 48-bit value
(MIPI I3C Basic, v1.1.1, section 5.1.4.1.1), which is greater than the
range of size_t on e.g. 32-bit ARM platforms. Thus, reverting the type
back to uint64_t.

[1] Linux in-turn uses this Provisioned ID to identify the device, and
exposes the Provisioned ID in the device name:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i3c/master.c?h=v6.6#n1521

Tested:
- added unit test passed.
- can read temperature of the i3c devices from our system.

Change-Id: I6f0e73aaf5f8d28e4bdedbe85646373463f6707f
Signed-off-by: Tom Tung <shes050117@gmail.com>

show more ...


# 03d333e0 23-Aug-2023 Akshit Shah <shahakshit@google.com>

dbus-sensors: utils: Utility to get device bus & addr from dev name.

This is applicable to all the services which rely on "bus-addr" fmt.
1. FanSensor
2. HwmonTempSensor
3. IntelCPUSensor
4. PSUSens

dbus-sensors: utils: Utility to get device bus & addr from dev name.

This is applicable to all the services which rely on "bus-addr" fmt.
1. FanSensor
2. HwmonTempSensor
3. IntelCPUSensor
4. PSUSensor

In addition this would also fix Fansensor Daemon crashes due to
stoi() exceptions weren't caught earlier.

For example: In a FanSensor Daemon -
Device of f0103000.pwm-fan-controller would be classified as i2cfan
based on new way of defining fan type.
Hence when we parse string for bus-addr, bus=f0103000.pwm and
addr=fan-controller for which stoi() would crash.
This would be true for all non I2c devices defaulting to I2cFan type.

Solution is to use 'std::from_chars' which handles under/overflow
properly. Centralizing this now in Utils would also allow us to manage
this appropriatelty across various services.

Tested:
Tested sanity of all daemons in the system and they work as expected.

Change-Id: I546e967abae7c0fb9fca645867e3037046037647
Signed-off-by: Akshit Shah <shahakshit@google.com>

show more ...


# 779c96a2 10-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: I0d10afa582342818b9d90b168f6f39f71ce4e0f4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
[AJ: regenerate using .clang-format from openbmc/docs@f44abd66eca8]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# e73bd0a1 24-Jan-2023 Andrew Jeffery <andrew@aj.id.au>

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an

sensors: Align source structure away from anti-patterns

The anti-patterns document comments on source structure, specifically
on placing internal headers in a parallel subtree[1]. dbus-sensors is an
example of violating this anti-pattern, so fix it.

[1]: https://github.com/openbmc/docs/blob/master/anti-patterns.md#placing-internal-headers-in-a-parallel-subtree

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I50ecaddd53fa9c9b7a0441af9de5e60bd94e47c6

show more ...


# 2049bd26 09-Jul-2022 Ed Tanous <edtanous@google.com>

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtan

Clang-tidy-14 fixes

Do as the robot commands. All changes made automatically by tidy.

Tested: (Thanks Zhikui)
Downloaded and run on system. Sensors scan normally.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I752f37c9e7a95aa3be8e6980ba6e4b2b48b3395a

show more ...


# b429f31d 27-Jun-2022 Ed Tanous <edtanous@google.com>

Fix clang-tidy 14 issues

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Idb76ae375eff9a143497942013d94ca3b3252495


# 99c4409a 14-Jan-2022 Ed Tanous <edtanous@google.com>

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

Signed-off-by: Ed

Enable cppcoreguidelines-pro-type-vararg check

We only had one usage of printf in the code that was in violation of
this rule, so replace it with iostreams, and enable the check.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie62165b599a996f34893aa5a3f8d1f6e6cbaf903

show more ...


# 65291360 14-Jan-2022 Ed Tanous <edtanous@google.com>

Enable cppcoreguidelines-special-member-functions check

We only had one violation of this, which was in a test case, so fix that
test case, and enable this check.

Signed-off-by: Ed Tanous <edtanous

Enable cppcoreguidelines-special-member-functions check

We only had one violation of this, which was in a test case, so fix that
test case, and enable this check.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1288a6d51593bb6d4c3a73dabaa566bf29474b5e

show more ...


# 532c8649 14-Jan-2022 Ed Tanous <edtanous@google.com>

Enable cppcoreguidelines-avoid-c-arrays

We only had one pretty trivial use of a C array in dbus-sensors.
Replace that with std::array, and enable the checks.

Signed-off-by: Ed Tanous <edtanous@goog

Enable cppcoreguidelines-avoid-c-arrays

We only had one pretty trivial use of a C array in dbus-sensors.
Replace that with std::array, and enable the checks.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5ecbfa07a7f46977dc3ccbde3c4b385e95b6a730

show more ...


# 0b207a62 20-Oct-2021 Lei YU <yulei.sh@bytedance.com>

cpusensor: Search in peci-0 directory

The code was searching /sys/bus/peci/devices for PECI sensors.
This results in below directories to be searched on typical 2 socket
x86 systems.

cpusensor: Search in peci-0 directory

The code was searching /sys/bus/peci/devices for PECI sensors.
This results in below directories to be searched on typical 2 socket
x86 systems.
* peci-0
* 0-30
* 0-31
Where 0-30 and 0-31 exist in peci-0 as well.
It is unnecessary, and the files in 0-30 and 0-31 will be searched twice
because they exist in peci-0.

Change the code to search in /sys/bus/peci/devices/peci-0 to make sure
it only search the files within the expected directory.
Note that the current peci driver only create peci-0, this code could be
easily extended to support peci-1/2/3 in the future.

Tested: The time for cpusensor to search the peci sensors reduces from
0.5s to about 0.3s.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I7b0f3ad7bea7a3dced13a985f0ad19ffda33f6d2

show more ...


# d3204145 16-Nov-2021 Lei YU <yulei.sh@bytedance.com>

test: Add test_Utils

Add the unit test to verify the findFiles() in utils, the tests creates
test directory structure like hwmon and peci and verify the result is
expected.

test: Add test_Utils

Add the unit test to verify the findFiles() in utils, the tests creates
test directory structure like hwmon and peci and verify the result is
expected.

Tested: Verify the unit test passes.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I11976399909235de509e09865af0b3421db6b565

show more ...