Skip to content

Commit

Permalink
[Mellanox] Enhance check_sysfs to ignore expected broken symbol links (
Browse files Browse the repository at this point in the history
…#4279)

With the Mellanox new hw-managenet package release V.7.0010.3134, some symbol links are expected to be broken after boot up, they should be excluded from the broken symbol link check. Add a function to match these expected broken symbol links and remove them from the check list.
  • Loading branch information
keboliu authored Sep 19, 2021
1 parent 3f21076 commit bea84e1
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions tests/platform_tests/mellanox/check_sysfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,38 @@
This script contains re-usable functions for checking status of hw-management related sysfs.
"""
import logging
import re
from tests.common.mellanox_data import get_platform_data
from tests.common.utilities import wait_until

MAX_FAN_SPEED_THRESHOLD = 0.15


def skip_ignored_broken_symbolinks(broken_symbolinks):
"""
@summary: Check all the broken symbol links found, remove the expected ones
examples for the expected broken symbol links:
/var/run/hw-management/led/led_psu2_green_delay_off
/var/run/hw-management/led/led_uid_blue_delay_on
/var/run/hw-management/led/led_fan_green_delay_on
/var/run/hw-management/led/led_status_red_delay_on
"""
# Currently some led blinking related sysfs are expected to be broken after system boot up,
# so skip and remove them from the check list.
broken_symbolinks_updated = []
pattern = re.compile(".*led_.*_delay_(off|on)")

logging.info("broken_symbolinks: {}".format(broken_symbolinks))

for symbolink in broken_symbolinks.splitlines():
if not pattern.match(symbolink):
broken_symbolinks_updated.append(symbolink)
else:
logging.info("ignore expected broken link: {}".format(symbolink))

return broken_symbolinks_updated


def check_sysfs(dut):
"""
@summary: Check various hw-management related sysfs under /var/run/hw-management
Expand All @@ -21,8 +47,9 @@ def check_sysfs(dut):

logging.info("Check broken symbolinks")
broken_symbolinks = sysfs_facts['symbolink_info']['broken_links']
assert len(broken_symbolinks) == 0, \
"Found some broken symbolinks: {}".format(str(broken_symbolinks))
broken_symbolinks_updated = skip_ignored_broken_symbolinks(broken_symbolinks)
assert len(broken_symbolinks_updated) == 0, \
"Found some broken symbolinks: {}".format(str(broken_symbolinks_updated))

logging.info("Check ASIC related sysfs")
try:
Expand Down

0 comments on commit bea84e1

Please sign in to comment.