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
|
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 {println("begin")} probe ap1.process {println(pp()) exit()}}
expect {
-timeout 120
-re "^begin\r\n$" {
exec ${cmd_dir}/a/ap1
expect {
-timeout 10
-re ${cmd_dir}/a/ap1 {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 {println("begin")} probe ap2 {println(pp()) exit()}}
expect {
-timeout 120
-re "^begin\r\n$" {
exec ${cmd_dir}/a/b/ap2
expect {
-timeout 10
-re ${cmd_dir}/a/b/ap2 {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 {println("begin")} probe ap3 {println(pp()) exit()}}
expect {
-timeout 120
-re "^begin\r\n$" {
exec ${cmd_dir}/b/ap3
expect {
-timeout 10
-re ${cmd_dir}/b/ap3 {incr status;}
}
}
}
catch { close }; catch { wait }
if {$status == 1} {pass ${test}3} else {fail ${test}3}
# cleanup
exec /bin/rm -rf $cmd_dir
|