1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3source tests/engine.sh
4test_begin
5
6set_timeout 2m
7timerlat_sample_event='/sys/kernel/tracing/events/osnoise/timerlat_sample'
8
9if ldd $RTLA | grep libbpf >/dev/null && [ -d "$timerlat_sample_event" ]
10then
11	# rtla build with BPF and system supports BPF mode
12	no_bpf_options='0 1'
13else
14	no_bpf_options='1'
15fi
16
17# Do every test with and without BPF
18for option in $no_bpf_options
19do
20export RTLA_NO_BPF=$option
21check "verify help page" \
22	"timerlat --help"
23check "verify -s/--stack" \
24	"timerlat top -s 3 -T 10 -t"
25check "verify -P/--priority" \
26	"timerlat top -P F:1 -c 0 -d 1M -q"
27check "test in nanoseconds" \
28	"timerlat top -i 2 -c 0 -n -d 30s"
29check "set the automatic trace mode" \
30	"timerlat top -a 5 --dump-tasks"
31check "print the auto-analysis if hits the stop tracing condition" \
32	"timerlat top --aa-only 5"
33check "disable auto-analysis" \
34	"timerlat top -s 3 -T 10 -t --no-aa"
35check "verify -c/--cpus" \
36	"timerlat hist -c 0 -d 30s"
37check "hist test in nanoseconds" \
38	"timerlat hist -i 2 -c 0 -n -d 30s"
39done
40
41test_end
42