Skip to content

Commit a8acf0b

Browse files
authored
Merge pull request #507 from roxell/add-systemd-analyze
automated: linux: add systemd-analyze
2 parents 29fbcbe + e4f3838 commit a8acf0b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
# Copyright (C) 2024 Linaro Ltd.
4+
5+
# shellcheck disable=SC1091
6+
. ../../lib/sh-test-lib
7+
OUTPUT="$(pwd)/output"
8+
OUTPUT_FILE="${OUTPUT}/output.txt"
9+
RESULT_FILE="${OUTPUT}/result.txt"
10+
SKIP_INSTALL="true"
11+
12+
usage() {
13+
echo "\
14+
Usage: ${0} [-s True|False]
15+
"
16+
}
17+
18+
while getopts "hs:" opt; do
19+
case $opt in
20+
s)
21+
SKIP_INSTALL="${OPTARG}"
22+
;;
23+
h|*)
24+
usage
25+
exit 1
26+
;;
27+
esac
28+
done
29+
30+
create_out_dir "${OUTPUT}"
31+
32+
pkgs="systemd"
33+
install_deps "${pkgs}" "${SKIP_INSTALL}"
34+
35+
command -v systemd-analyze
36+
exit_on_fail "systemd-analyze not in ${PATH} or not installed"
37+
systemd-analyze | tee "${OUTPUT_FILE}"
38+
39+
head -1 "${OUTPUT_FILE}" | grep -oP '\d+\.\d+s \(\w+\)' | while read -r row; do
40+
seconds=$(echo "${row}"| awk -F ' ' '{print $1}'|sed -e 's|s$||g')
41+
what=$(echo "${row}"| awk -F ' ' '{print $2}'|sed -e 's|^(||g'|sed -e 's|)$||g')
42+
echo "systemd-analyze-${what} pass ${seconds} seconds" | tee -a "${RESULT_FILE}"
43+
done
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
# Copyright (C) 2024 Linaro Ltd.
3+
metadata:
4+
format: Lava-Test Test Definition 1.0
5+
name: systemd-analyze
6+
description: |
7+
The systemd-analyze analyzes the boot times. It's boot times
8+
for firmware, bootloader, kernel and userspace.
9+
maintainer:
10+
- anders.roxell@linaro.org
11+
os:
12+
- debian
13+
- ubuntu
14+
- fedora
15+
- centos
16+
- openembedded
17+
scope:
18+
- boot performance
19+
devices:
20+
- all
21+
22+
params:
23+
SKIP_INSTALL: true
24+
25+
run:
26+
steps:
27+
- cd ./automated/linux/systemd-analyze/
28+
- ./systemd-analyze.sh -s "${SKIP_INSTALL}"
29+
- ../../utils/send-to-lava.sh ./output/result.txt

0 commit comments

Comments
 (0)