Skip to content

Commit

Permalink
Skip sensors checking in old versions (#5013)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
For Mellanox device and the versions of 201911and 202012, skip sensors checking in test of test_check_hw_mgmt_sysfs.

How did you do it?
When version is 201911, 202012, skip sensors checking

How did you verify/test it?
Run test of test_check_hw_mgmt_sysfs
  • Loading branch information
JibinBao authored Jan 25, 2022
1 parent 7cbf722 commit aea0549
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/platform_tests/mellanox/check_sysfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,19 @@ def check_sysfs(dut):
assert "Invalid PSU fan speed value {} for PSU {}, exception: {}".format(psu_info["fan_speed"],
psu_id, e)

# Check consistency between voltage capability and sysfs
all_capabilities = platform_data["psus"].get("capabilities")
if all_capabilities:
for capabilities in all_capabilities:
psu_cmd_prefix = 'cat /var/run/hw-management/power/{}_'.format(capabilities.format(psu_id))
psu_capability = dut.command(psu_cmd_prefix + 'capability')['stdout'].split()
for capability in psu_capability:
# Each capability should exist
output = dut.command(psu_cmd_prefix + capability)['stdout']
assert output, "PSU capability {} doesn't not exist".format(capability)
if "201911" not in dut.os_version and "202012" not in dut.os_version:
# Check consistency between voltage capability and sysfs
all_capabilities = platform_data["psus"].get("capabilities")
if all_capabilities:
for capabilities in all_capabilities:
psu_cmd_prefix = 'cat /var/run/hw-management/power/{}_'.format(capabilities.format(psu_id))
psu_capability = dut.command(psu_cmd_prefix + 'capability')['stdout'].split()
for capability in psu_capability:
# Each capability should exist
output = dut.command(psu_cmd_prefix + capability)['stdout']
assert output, "PSU capability {} doesn't not exist".format(capability)
else:
logging.info("PSU sensors' capability checking ignored")

logging.info("Check SFP related sysfs")
for sfp_id, sfp_info in sysfs_facts['sfp_info'].items():
Expand Down

0 comments on commit aea0549

Please sign in to comment.