Debian Codegraph @

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

raw
1 set test "dump_functions"
2
3 # This test verifies that --dump-functions works properly. We also check more
4 # specific behaviour, such as:
5 # 1. --dump-functions should list normal tapset functions such as user_string
6 # but not internal functions such as _caller_match
7 # 2. -v --dump-functions should list internal functions such as _caller_match
8 # 3. --dump-functions should list embedded C tags including guru, unprivileged,
9 # and myproc-unprivileged but not pure, and unmangled tags
10 # 4. -v --dump-functions should list pure, unmangled tags
11
12 proc has_function { output wanted func } {
13 global test subtest
14
15 set inlist [lsearch $output $func]
16 if {[expr $wanted && $inlist > 0] \
17 || [expr !$wanted && $inlist < 0]} {
18 pass "$test ($subtest)"
19 } else {
20 fail "$test ($subtest)"
21 }
22 }
23
24 # Get output for --dump-functions
25 if {[catch {exec stap --dump-functions 2>/dev/null} output]} {
26 fail "$test (can't get output of stap --dump-functions)"
27 return
28 } else {
29 pass "$test (got output of stap --dump-functions)"
30 }
31
32 # Get output for -v --dump-functions
33 if {[catch {exec stap -v --dump-functions 2>/dev/null} outputv]} {
34 fail "$test (can't get output of stap -v --dump-functions)"
35 return
36 } else {
37 pass "$test (got output of stap -v --dump-functions)"
38 }
39
40 # Split outputs into lines
41 set output [split $output "\n"]
42 set outputv [split $outputv "\n"]
43
44 verbose -log "output: $output"
45
46 set subtest "user_string in output"
47 has_function $output 1 "user_string:string *"
48
49 set subtest "ubacktrace in output"
50 has_function $output 1 "ubacktrace:string *"
51
52 set subtest "callers in output"
53 has_function $output 1 "callers:string *"
54
55 set subtest "_caller_match not in output"
56 has_function $output 0 "_caller_match:long *"
57
58 set subtest "user_string in -v output"
59 has_function $outputv 1 "user_string:string *"
60
61 set subtest "_caller_match in -v output"
62 has_function $outputv 1 "_caller_match:long *"
63
64 set subtest "mdelay has guru in output"
65 has_function $output 1 "mdelay:unknown * /\* guru \*/"
66
67 set subtest "mdelay has guru in -v output"
68 has_function $outputv 1 "mdelay:unknown * /\* guru \*/"
69
70 set subtest "uid has unpriv but not pure in output"
71 has_function $output 1 "uid:long () /\* unprivileged \*/"
72
73 set subtest "uid has unpriv and pure in -v output"
74 has_function $outputv 1 "uid:long () /\* pure \*/ /\* unprivileged \*/"
75