blob: 201af33a52ccc01c7f51d2ff479de1a7b9d9a132 (
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
43
44
45
46
47
48
|
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
source ../tests/engine.sh
test_begin
set_timeout 30s
RVDIR=/sys/kernel/tracing/rv/
# Help and basic tests
check "verify help page" \
"$RV --help" 0 "usage: rv command"
check "verify list subcommand help" \
"$RV list --help" 0 "list all available monitors"
all_nested=$(grep : $RVDIR/available_monitors | cut -d: -f2 | paste -s | sed 's/\t/\\|/g')
all_non_nested=$(grep -v : $RVDIR/available_monitors | cut -d: -f2 | paste -s | sed 's/\t/\\|/g')
sched_monitors=$(grep sched: $RVDIR/available_monitors | cut -d: -f2 | paste -s | sed 's/\t/\\|/g')
description_state="[[:space:]]\+[[:print:]]\+\[\(OFF\|ON\)\]"
line_nested=" - \($all_nested\)${description_state}"
line_non_nested="\($all_non_nested\)${description_state}"
# List monitors and containers
check "list all monitors" \
"$RV list" 0 "" "" "^\($line_nested\|$line_non_nested\)$"
check_if_exists "list container" \
"$RV list sched" "$RVDIR/monitors/sched" \
"" "-- No monitor found in container sched --" \
"^\($sched_monitors\)${description_state}$"
check_if_exists "list non-container" \
"$RV list wwnr" "$RVDIR/monitors/wwnr" \
"-- No monitor found in container wwnr --" \
"^\( - \)\?[[:alnum:]]\+${description_state}$"
check "list incomplete container name" \
"$RV list s" 0 "-- No monitor found in container s --"
# Error handling tests
check "no command" \
"$RV" 1 "rv requires a command"
check "invalid command" \
"$RV invalid" 1 "rv does not know the invalid command"
test_end
|