blob: 2404772e863cd2ffe2ccccbd472e2bfd9e343d00 [file] [log] [blame]
Daniel Wagner72624fd2019-07-23 09:38:10 +02001#!/bin/sh -e
2# cyclicdeadline is a test that is similar to cyclictest but instead
3# of using SCHED_FIFO and nanosleep() to measure jitter, it uses
4# SCHED_DEADLINE and has the deadline be the wakeup interval."
5
6# shellcheck disable=SC1091
7. ../../lib/sh-test-lib
8
9OUTPUT="$(pwd)/output"
10LOGFILE="${OUTPUT}/cyclicdeadline.txt"
11RESULT_FILE="${OUTPUT}/result.txt"
12
13INTERVAL="1000"
14STEP="500"
15THREADS="1"
16DURATION="1m"
17MAX_LATENCY="50"
18
19usage() {
20 echo "Usage: $0 [-i interval] [-s step] [-t threads] [-D duration ] [-m latency]" 1>&2
21 exit 1
22}
23
24while getopts ":i:s:t:D:m:" opt; do
25 case "${opt}" in
26 i) INTERVAL="${OPTARG}" ;;
27 s) STEP="${STEP}" ;;
28 t) THREADS="${OPTARG}" ;;
29 D) DURATION="${OPTARG}" ;;
30 m) MAX_LATENCY="${OPTARG}" ;;
31 *) usage ;;
32 esac
33done
34
35! check_root && error_msg "Please run this script as root."
36create_out_dir "${OUTPUT}"
37
38# Run cyclicdeadline.
39if ! binary=$(command -v cyclicdeadline); then
40 detect_abi
41 # shellcheck disable=SC2154
42 binary="./bin/${abi}/cyclicdeadline"
43fi
44"${binary}" -i "${INTERVAL}" -s "${STEP}" -t "${THREADS}" \
45 -D "${DURATION}" | tee "${LOGFILE}"
46
47# Parse test log.
48../../lib/parse_rt_tests_results.py cyclicdeadline "${LOGFILE}" "${MAX_LATENCY}" \
49 | tee -a "${RESULT_FILE}"