diff options
author | Daniel Wagner <wagi@monom.org> | 2019-07-23 09:38:10 +0200 |
---|---|---|
committer | Daniel Wagner <wagi@monom.org> | 2019-07-31 08:56:32 +0200 |
commit | 72624fda8fc0deb781245bcd86a8f2177d224415 (patch) | |
tree | 279deb00c41619c6528b0740116a4dbce94b4c79 | |
parent | 6c7fd5a1714be23e1bfbb7909b2ccd9ef90f20de (diff) |
cyclicdeadline: Add cyclicdeadline test
Add cyclicdeadline from the rt-tests suite (>= v1.4).
Unfortunatly, cyclicdeadline produces an empty text block as last
entry. So we need to start iterating backwards through the log file
until we find an block which contains log output.
The x86_64 and armeabi architecture binaries are build using a Debian
stretch root filesystem.
arm64 binaries were build using a Debian buster root filesystem.
The command to build the binaries is: "CLFAGS=-static make"
Signed-off-by: Daniel Wagner <wagi@monom.org>
-rwxr-xr-x | automated/lib/parse_rt_tests_results.py | 41 | ||||
-rw-r--r-- | automated/linux/cyclicdeadline/bin/README | 6 | ||||
-rwxr-xr-x | automated/linux/cyclicdeadline/bin/arm64/cyclicdeadline | bin | 0 -> 627312 bytes | |||
-rwxr-xr-x | automated/linux/cyclicdeadline/bin/armeabi/cyclicdeadline | bin | 0 -> 419240 bytes | |||
-rwxr-xr-x | automated/linux/cyclicdeadline/bin/x86_64/cyclicdeadline | bin | 0 -> 840920 bytes | |||
-rwxr-xr-x | automated/linux/cyclicdeadline/cyclicdeadline.sh | 49 | ||||
-rw-r--r-- | automated/linux/cyclicdeadline/cyclicdeadline.yaml | 47 |
7 files changed, 134 insertions, 9 deletions
diff --git a/automated/lib/parse_rt_tests_results.py b/automated/lib/parse_rt_tests_results.py index 16eab3d..c846f2d 100755 --- a/automated/lib/parse_rt_tests_results.py +++ b/automated/lib/parse_rt_tests_results.py @@ -38,19 +38,42 @@ def print_res(res, key, thr): print('t{}-{}-latency {} {} us'.format(res['t'], key, label, val)) -def get_lastlines(filename): - # Start reading from the end of the file until ESC is found +def get_block(filename): + # Fetch a text block from the file iterating backwards. Each block + # starts with an escape sequence which starts with '\x1b'. with open(filename, 'rb') as f: try: - f.seek(-2, os.SEEK_END) - while f.read(1) != b'\x1b': + f.seek(0, os.SEEK_END) + while True: + pe = f.tell() + f.seek(-2, os.SEEK_CUR) - return f.readlines() + while f.read(1) != b'\x1b': + f.seek(-2, os.SEEK_CUR) + pa = f.tell() + + blk = f.read(pe - pa) + + # Remove escape sequence at the start of the block + # The control sequence ends in 'A' + i = blk.find('A') + 1 + yield blk[i:] + + # Jump back to next block + f.seek(pa - 1, os.SEEK_SET) except IOError: - # No ESC found + # No escape sequence found f.seek(0, os.SEEK_SET) - return f.readlines() - return [] + yield f.read() + + +def get_lastlines(filename): + for b in get_block(filename): + # Ignore empty blocks + if len(b.strip('\n')) == 0: + continue + + return b.split('\n') def parse_cyclictest(filename, thr): @@ -101,7 +124,7 @@ def parse_pmqtest(filename, thr): def main(): tool = sys.argv[1] - if tool in ['cyclictest', 'signaltest']: + if tool in ['cyclictest', 'signaltest', 'cyclicdeadline']: parse_cyclictest(sys.argv[2], int(sys.argv[3])) elif tool in ['pmqtest', 'ptsematest', 'sigwaittest', 'svsematest']: parse_pmqtest(sys.argv[2], int(sys.argv[3])) diff --git a/automated/linux/cyclicdeadline/bin/README b/automated/linux/cyclicdeadline/bin/README new file mode 100644 index 0000000..faa30d3 --- /dev/null +++ b/automated/linux/cyclicdeadline/bin/README @@ -0,0 +1,6 @@ +The binaries are provided under the terms of the GNU General Public License, +Version 2. The source can be viewed here: + +https://git.kernel.org/cgit/utils/rt-tests/rt-tests.git/ + +The binaries were built from the v1.4 tag diff --git a/automated/linux/cyclicdeadline/bin/arm64/cyclicdeadline b/automated/linux/cyclicdeadline/bin/arm64/cyclicdeadline Binary files differnew file mode 100755 index 0000000..8e78759 --- /dev/null +++ b/automated/linux/cyclicdeadline/bin/arm64/cyclicdeadline diff --git a/automated/linux/cyclicdeadline/bin/armeabi/cyclicdeadline b/automated/linux/cyclicdeadline/bin/armeabi/cyclicdeadline Binary files differnew file mode 100755 index 0000000..1ebaeec --- /dev/null +++ b/automated/linux/cyclicdeadline/bin/armeabi/cyclicdeadline diff --git a/automated/linux/cyclicdeadline/bin/x86_64/cyclicdeadline b/automated/linux/cyclicdeadline/bin/x86_64/cyclicdeadline Binary files differnew file mode 100755 index 0000000..8e4edb9 --- /dev/null +++ b/automated/linux/cyclicdeadline/bin/x86_64/cyclicdeadline diff --git a/automated/linux/cyclicdeadline/cyclicdeadline.sh b/automated/linux/cyclicdeadline/cyclicdeadline.sh new file mode 100755 index 0000000..2404772 --- /dev/null +++ b/automated/linux/cyclicdeadline/cyclicdeadline.sh @@ -0,0 +1,49 @@ +#!/bin/sh -e +# cyclicdeadline is a test that is similar to cyclictest but instead +# of using SCHED_FIFO and nanosleep() to measure jitter, it uses +# SCHED_DEADLINE and has the deadline be the wakeup interval." + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib + +OUTPUT="$(pwd)/output" +LOGFILE="${OUTPUT}/cyclicdeadline.txt" +RESULT_FILE="${OUTPUT}/result.txt" + +INTERVAL="1000" +STEP="500" +THREADS="1" +DURATION="1m" +MAX_LATENCY="50" + +usage() { + echo "Usage: $0 [-i interval] [-s step] [-t threads] [-D duration ] [-m latency]" 1>&2 + exit 1 +} + +while getopts ":i:s:t:D:m:" opt; do + case "${opt}" in + i) INTERVAL="${OPTARG}" ;; + s) STEP="${STEP}" ;; + t) THREADS="${OPTARG}" ;; + D) DURATION="${OPTARG}" ;; + m) MAX_LATENCY="${OPTARG}" ;; + *) usage ;; + esac +done + +! check_root && error_msg "Please run this script as root." +create_out_dir "${OUTPUT}" + +# Run cyclicdeadline. +if ! binary=$(command -v cyclicdeadline); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/cyclicdeadline" +fi +"${binary}" -i "${INTERVAL}" -s "${STEP}" -t "${THREADS}" \ + -D "${DURATION}" | tee "${LOGFILE}" + +# Parse test log. +../../lib/parse_rt_tests_results.py cyclicdeadline "${LOGFILE}" "${MAX_LATENCY}" \ + | tee -a "${RESULT_FILE}" diff --git a/automated/linux/cyclicdeadline/cyclicdeadline.yaml b/automated/linux/cyclicdeadline/cyclicdeadline.yaml new file mode 100644 index 0000000..9f3c16b --- /dev/null +++ b/automated/linux/cyclicdeadline/cyclicdeadline.yaml @@ -0,0 +1,47 @@ +metadata: + name: cyclicdeadline + format: "Lava-Test-Shell Test Definition 1.0" + description: "cyclicdeadline is a test that is similar to cyclictest + but instead of using SCHED_FIFO and nanosleep() to + measure jitter, it uses SCHED_DEADLINE and has the + deadline be the wakeup interval." + maintainer: + - Daniel Wagner <wagi@monom.org> + os: + - debian + - ubuntu + - fedora + - centos + - openembedded + scope: + - performance + - preempt-rt + environment: + - lava-test-shell + devices: + - hi6220-hikey + - apq8016-sbc + - mustang + - moonshot + - thunderX + - d03 + - d05 + +params: + # Base interval of thread in us. + INTERVAL: "1000" + # Step size in us. + STEP: "500" + # Number of threads to test + THREADS: "1" + # Execute cyclicdeadline for given time + DURATION: "5m" + # Maximal accepted latency in us + # This value is device/kernel specific and needs to be set in the job! + MAX_LATENCY: "50" + +run: + steps: + - cd ./automated/linux/cyclicdeadline/ + - ./cyclicdeadline.sh -i "${INTERVAL}" -s "${STEP}" -t "${THREADS}" -D "${DURATION}" -m "${MAX_LATENCY}" + - ../../utils/send-to-lava.sh ./output/result.txt |