Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/dump_probe_aliases.exp

raw
1 set test "dump_probe_aliases"
2
3 # This test verifies that stap --dump-probe-aliases works properly.
4 # Namely, we look for specific aliases in the stap output. We also check
5 # that only the -v version includes aliases starting with '_'.
6
7 proc has_alias { output wanted alias } {
8 global test subtest
9
10 set inlist [lsearch $output $alias]
11 if {[expr $wanted && $inlist > 0] \
12 || [expr !$wanted && $inlist < 0]} {
13 pass "$test ($subtest)"
14 } else {
15 fail "$test ($subtest)"
16 }
17 }
18
19 # Get output for --dump-probe-aliases
20 if {[catch {exec stap --dump-probe-aliases 2>/dev/null} output]} {
21 fail "$test (can't get output of stap --dump-probe-aliases)"
22 return
23 } else {
24 pass "$test (got output of stap --dump-probe-aliases)"
25 }
26
27 # Get output for -v --dump-probe-aliases
28 if {[catch {exec stap -v --dump-probe-aliases 2>/dev/null} outputv]} {
29 fail "$test (can't get output of stap -v --dump-probe-aliases)"
30 return
31 } else {
32 pass "$test (got output of stap -v --dump-probe-aliases)"
33 }
34
35 # Split outputs into lines
36 set output [split $output "\n"]
37 set outputv [split $outputv "\n"]
38
39 set subtest "oneshot in output"
40 has_alias $output 1 "oneshot += begin"
41
42 set subtest "vfs.read in output"
43 has_alias $output 1 "vfs.read = kernel.function(\"vfs_read\")"
44
45 set subtest "__syscall.accept not in output"
46 has_alias $output 0 "__syscall.accept = kernel.function(\"sys_accept\").call"
47
48 set subtest "oneshot in -v output"
49 has_alias $outputv 1 "oneshot += begin"
50
51 set subtest "vfs.read in -v output"
52 has_alias $outputv 1 "vfs.read = kernel.function(\"vfs_read\")"
53
54 set subtest "__syscall.accept in -v output"
55 has_alias $outputv 1 "__syscall.accept = kernel.function(\"sys_accept\").call"
56