File: dump_functions.exp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (67 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download | duplicates (5)
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
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"]

set subtest "user_string in output"
has_function $output 1 "user_string: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 \*/"