File: dump_functions.exp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (75 lines) | stat: -rw-r--r-- 2,355 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
set test "dump_functions"

# This test verifies that --dump-functions works properly. We also check more
# specific behaviour, such as:
# 1. --dump-functions should list normal tapset functions such as user_string
#    but not internal functions such as _caller_match
# 2. -v --dump-functions should list internal functions such as _caller_match
# 3. --dump-functions should list embedded C tags including guru, unprivileged,
#    and myproc-unprivileged but not pure, and unmangled tags
# 4. -v --dump-functions should list pure, unmangled tags

proc has_function { output wanted func } {
   global test subtest

   set inlist [lsearch $output $func]
   if {[expr  $wanted && $inlist > 0] \
    || [expr !$wanted && $inlist < 0]} {
      pass "$test ($subtest)"
   } else {
      fail "$test ($subtest)"
   }
}

# Get output for --dump-functions
if {[catch {exec stap --dump-functions 2>/dev/null} output]} {
   fail "$test (can't get output of stap --dump-functions)"
   return
} else {
   pass "$test (got output of stap --dump-functions)"
}

# Get output for -v --dump-functions
if {[catch {exec stap -v --dump-functions 2>/dev/null} outputv]} {
   fail "$test (can't get output of stap -v --dump-functions)"
   return
} else {
   pass "$test (got output of stap -v --dump-functions)"
}

# Split outputs into lines
set output  [split $output  "\n"]
set outputv [split $outputv "\n"]

verbose -log "output: $output"

set subtest "user_string in output"
has_function $output 1 "user_string:string *"

set subtest "ubacktrace in output"
has_function $output 1 "ubacktrace:string *"

set subtest "callers in output"
has_function $output 1 "callers:string *"

set subtest "_caller_match not in output"
has_function $output 0 "_caller_match:long *"

set subtest "user_string in -v output"
has_function $outputv 1 "user_string:string *"

set subtest "_caller_match in -v output"
has_function $outputv 1 "_caller_match:long *"

set subtest "mdelay has guru in output"
has_function $output 1 "mdelay:unknown * /\* guru \*/"

set subtest "mdelay has guru in -v output"
has_function $outputv 1 "mdelay:unknown * /\* guru \*/"

set subtest "uid has unpriv but not pure in output"
has_function $output 1 "uid:long () /\* unprivileged \*/"

set subtest "uid has unpriv and pure in -v output"
has_function $outputv 1 "uid:long () /\* pure \*/ /\* unprivileged \*/"