Debian Codegraph @

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

raw
1 set test "auto_path"
2 if {![installtest_p]} { untested $test; return }
3 if {![uprobes_p]} { untested "$test"; return }
4
5 # Note that the test diriectory name, '/tmp/stap_auto_path', is fixed
6 # on purpose, since we're testing the auto path feature. This matches
7 # up to the paths in the tapset directory.
8 set cmd_dir "/tmp/stap_auto_path"
9 set test_dir "$srcdir/$subdir"
10 set include_root "$srcdir/$subdir/tapset"
11
12 exec /bin/mkdir -p ${cmd_dir}
13
14 set res [target_compile ${test_dir}/${test}.c ${cmd_dir}/ap executable "additional_flags=-g"]
15 if { $res != "" } {
16 fail "unable to compile ${test}.c"
17 }
18
19 exec /bin/mkdir -p ${cmd_dir}/a
20 exec /bin/mkdir -p ${cmd_dir}/a/b
21 exec /bin/mkdir -p ${cmd_dir}/b
22 exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/ap1
23 exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/a/b/ap2
24 exec /bin/cp ${cmd_dir}/ap ${cmd_dir}/b/ap3
25
26 set status 0
27 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/ap1\")} probe ap1.process {println(pp()) exit()}"
28 expect {
29 -timeout 120
30 -re ${cmd_dir}/a/ap1.*main {incr status;}
31 }
32 catch { close }; catch { wait }
33 if {$status == 1} {pass ${test}1} else {fail ${test}1}
34
35 set status 0
36 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/a/b/ap2\")} probe ap2 {println(pp()) exit()}"
37 expect {
38 -timeout 120
39 -re ${cmd_dir}/a/b/ap2.*main {incr status;}
40 }
41 catch { close }; catch { wait }
42 if {$status == 1} {pass ${test}2} else {fail ${test}2}
43
44 set status 0
45 spawn stap -I $include_root -e "probe begin {system(\"${cmd_dir}/b/ap3\")} probe ap3 {println(pp()); exit()}"
46 expect {
47 -timeout 120
48 -re ${cmd_dir}/b/ap3.*main {incr status;}
49 }
50 catch { close }; catch { wait }
51 if {$status == 1} {pass ${test}3} else {fail ${test}3}
52
53 # cleanup
54 exec /bin/rm -rf $cmd_dir