Debian Codegraph @

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

raw
1 set test "minidebuginfo"
2
3 if {![installtest_p]} { untested $test; return }
4 if {![uprobes_p]} { untested $test; return }
5
6 catch { exec gcc -o binary -g $srcdir/$subdir/minidebug.c } err
7
8 if {$err == ""} then { pass "$test compile" } else { fail "$test compile $err" }
9
10 catch { exec $srcdir/$subdir/create-minidebug.sh } err
11 if {$err == ""} then { pass "$test create minidebug" } else { fail "$test create-minidebug.sh $err" }
12 spawn stap $srcdir/$subdir/minidebuginfo.stp -c "./binary.test"
13 set ok 0
14 expect {
15 -timeout 30
16 -re {[^\r\n]*main\r\n} { incr ok; exp_continue }
17 -re {[^\r\n]*bar\r\n} { incr ok; exp_continue }
18 -re {[^\r\n]*foo\r\n} { incr ok; exp_continue }
19 -re {[^\r\n]*return\r\n} { incr ok; exp_continue }
20 eof { }
21 timeout { fail "$test (timeout)" }
22 }
23 catch { close }; wait
24 if {$ok == 4} then { pass "$test ($ok)" } else { fail "$test ($ok)" }
25 catch { exec rm binary binary.dynsyms binary.funcsyms binary.keep_symbols binary.mini_debuginfo binary.strip binary.debug binary.mini_debuginfo.xz binary.test } err
26
27 set test "symtab-strip"
28
29 catch { exec gcc -o binary1 -g $srcdir/$subdir/minidebug.c } err
30 if {$err == ""} then { pass "$test compile" } else { fail "$test compile $err" }
31 catch { exec strip -g binary1 } err
32 if {$err == ""} then { pass "$test strip" } else { fail "$test strip $err" }
33
34 spawn stap $srcdir/$subdir/minidebuginfo.stp -c "./binary1"
35 set ok1 0
36 expect {
37 -timeout 30
38 -re {[^\r\n]*main\r\n} { incr ok1; exp_continue }
39 -re {[^\r\n]*bar\r\n} { incr ok1; exp_continue }
40 -re {[^\r\n]*foo\r\n} { incr ok1; exp_continue }
41 -re {[^\r\n]*return\r\n} { incr ok1; exp_continue }
42 eof { }
43 timeout { fail "$test (timeout)" }
44 }
45 catch { close }; wait
46 if {$ok1 == 4} then { pass "$test ($ok1)" } else { fail "$test ($ok1)" }
47 catch { exec rm binary1 } err