Skip to content

Commit

Permalink
Merge pull request #507 from roxell/add-systemd-analyze
Browse files Browse the repository at this point in the history
automated: linux: add systemd-analyze
  • Loading branch information
ivoire authored May 21, 2024
2 parents 29fbcbe + e4f3838 commit a8acf0b
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
43 changes: 43 additions & 0 deletions automated/linux/systemd-analyze/systemd-analyze.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2024 Linaro Ltd.

# shellcheck disable=SC1091
. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
OUTPUT_FILE="${OUTPUT}/output.txt"
RESULT_FILE="${OUTPUT}/result.txt"
SKIP_INSTALL="true"

usage() {
echo "\
Usage: ${0} [-s True|False]
"
}

while getopts "hs:" opt; do
case $opt in
s)
SKIP_INSTALL="${OPTARG}"
;;
h|*)
usage
exit 1
;;
esac
done

create_out_dir "${OUTPUT}"

pkgs="systemd"
install_deps "${pkgs}" "${SKIP_INSTALL}"

command -v systemd-analyze
exit_on_fail "systemd-analyze not in ${PATH} or not installed"
systemd-analyze | tee "${OUTPUT_FILE}"

head -1 "${OUTPUT_FILE}" | grep -oP '\d+\.\d+s \(\w+\)' | while read -r row; do
seconds=$(echo "${row}"| awk -F ' ' '{print $1}'|sed -e 's|s$||g')
what=$(echo "${row}"| awk -F ' ' '{print $2}'|sed -e 's|^(||g'|sed -e 's|)$||g')
echo "systemd-analyze-${what} pass ${seconds} seconds" | tee -a "${RESULT_FILE}"
done
29 changes: 29 additions & 0 deletions automated/linux/systemd-analyze/systemd-analyze.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2024 Linaro Ltd.
metadata:
format: Lava-Test Test Definition 1.0
name: systemd-analyze
description: |
The systemd-analyze analyzes the boot times. It's boot times
for firmware, bootloader, kernel and userspace.
maintainer:
- [email protected]
os:
- debian
- ubuntu
- fedora
- centos
- openembedded
scope:
- boot performance
devices:
- all

params:
SKIP_INSTALL: true

run:
steps:
- cd ./automated/linux/systemd-analyze/
- ./systemd-analyze.sh -s "${SKIP_INSTALL}"
- ../../utils/send-to-lava.sh ./output/result.txt

0 comments on commit a8acf0b

Please sign in to comment.