Skip to content

Commit

Permalink
automated: linux: mmtests: results collector fix
Browse files Browse the repository at this point in the history
Fixed issue which prevented results collection due to
missing `systemd-analyze` command. Information provided by this
command is not critical for results analysis yet.

Signed-off-by: Konstantin Belov <[email protected]>
  • Loading branch information
Konstantin Belov committed Dec 2, 2024
1 parent 4c415c5 commit fc9554d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions automated/linux/mmtests/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ def collect_sha256_benchmark(cfg_name):
log.warning("Unable to find file: %s", loc)


def if_cmd_exists(cmd):
if not shutil.which(cmd):
log.warning("%s command is not available", cmd)
return False
return True


def parse_boottime():
"""Parse the system boot time."""
time_patt = re.compile(r"(\d+(?:\.\d+)?)(ms|us|s)")
Expand All @@ -262,6 +269,10 @@ def parse_time(t):
blame_info = {}
time_info = {}

if not if_cmd_exists("systemd-analyze"):
log.warning("System boot time information is not available")
return {"blame": blame_info, "time": time_info}

try:
blame_output = run_command("systemd-analyze blame")
if blame_output:
Expand Down

0 comments on commit fc9554d

Please sign in to comment.