File: auto_path.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 (54 lines) | stat: -rw-r--r-- 1,728 bytes parent folder | download | duplicates (2)
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
set test "auto_path"
if {![installtest_p]} { untested $test; return }
if {![uprobes_p]} { untested "$test"; return }

# Note that the test diriectory name, '/tmp/stap_auto_path', is fixed
# on purpose, since we're testing the auto path feature. This matches
# up to the paths in the tapset directory.
set cmd_dir "/tmp/stap_auto_path"
set test_dir "$srcdir/$subdir"
set include_root "$srcdir/$subdir/tapset"

exec /bin/mkdir -p ${cmd_dir}

set res [target_compile ${test_dir}/${test}.c ${cmd_dir}/ap executable "additional_flags=-g"]
if { $res != "" } {
  fail "unable to compile ${test}.c"
}

exec /bin/mkdir -p ${cmd_dir}/a
exec /bin/mkdir -p ${cmd_dir}/a/b
exec /bin/mkdir -p ${cmd_dir}/b
exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/ap1
exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/b/ap2
exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/b/ap3

set status 0
spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/ap1\")} probe ap1.process {println(pp()) exit()}"
expect {
    -timeout 120
    -re ${cmd_dir}/a/ap1.*main {incr status;}
}
catch { close }; catch { wait }
if {$status == 1} {pass ${test}1} else {fail ${test}1}

set status 0
spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/b/ap2\")} probe ap2 {println(pp()) exit()}"
expect {
    -timeout 120
    -re ${cmd_dir}/a/b/ap2.*main {incr status;}
}
catch { close }; catch { wait }
if {$status == 1} {pass ${test}2} else {fail ${test}2}

set status 0
spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/b/ap3\")} probe ap3 {println(pp()); exit()}"
expect {
    -timeout 120
    -re ${cmd_dir}/b/ap3.*main {incr status;}
}
catch { close }; catch { wait }
if {$status == 1} {pass ${test}3} else {fail ${test}3}

# cleanup
exec /bin/rm -rf $cmd_dir