blob: aec379e76eb7157ad86a750e178e5ddad55e50a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh -e
# rt-migrate-test verifies the RT threads scheduler balancing.
# shellcheck disable=SC1091
. ../../lib/sh-test-lib
OUTPUT="$(pwd)/output"
LOGFILE="${OUTPUT}/rt-migrate-test.txt"
RESULT_FILE="${OUTPUT}/result.txt"
LOOPS="100"
usage() {
echo "Usage: $0 [-l loops]" 1>&2
exit 1
}
while getopts ":l:" opt; do
case "${opt}" in
l) LOOPS="${OPTARG}" ;;
*) usage ;;
esac
done
! check_root && error_msg "Please run this script as root."
[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
mkdir -p "${OUTPUT}"
# Run rt-migrate-test.
detect_abi
# shellcheck disable=SC2154
./bin/"${abi}"/rt-migrate-test -l "${LOOPS}" | tee "${LOGFILE}"
# Parse test log.
task_num=$(grep "Task" "${LOGFILE}" | tail -1 | awk '{print $2}')
for t in $(seq 0 "${task_num}"); do
# Get the priority of the task.
p=$(grep "Task $t" "${LOGFILE}" | awk '{print substr($4,1,length($4)-1)}')
sed -n "/Task $t/,/Avg/p" "${LOGFILE}" \
| grep -v "Task" \
| awk -v t="$t" -v p="$p" '{printf("t%s-p%s-%s pass %s %s\n",t,p,tolower(substr($1, 1, length($1)-1)),$2,$3)}' \
| tee -a "${RESULT_FILE}"
done
|