Debian Codegraph @

testsuite/systemtap.context/symfileline.tcl

raw
1 set correct_fileline 0
2 set correct_file 0
3 set correct_line 0
4 set pp_matched 0
5 set testname symfileline
6
7 # tests functions symfileline, symfile and symline
8
9 set cmd "stap -d kernel -d systemtap_test_module2 $srcdir/$subdir/$testname.stp"
10 send_log "executing: $cmd\n"
11 eval spawn $cmd
12 expect {
13 -timeout 120
14 "READY" {
15 # KLUDGE WARNING: Why is this sleep needed? Good question. This
16 # test kept failing, but worked fine when run by hand. The only
17 # real difference when run by the testsuite vs. running it by hand
18 # was the timing. When this sleep was added, the test started
19 # passing again.
20 catch { exec sleep 1 }
21 send_log "executing: echo 0 > /proc/stap_test_cmd\n"
22 exec echo 0 > /proc/stap_test_cmd
23 expect {
24 -re {fileline .*systemtap_test_module2.c:[1-9][0-9]*} {
25 incr correct_fileline; exp_continue }
26 -re {file .*systemtap_test_module2.c} { incr correct_file; exp_continue }
27 -re {line [1-9][0-9]*} { incr correct_line; exp_continue }
28 -re {matched} { incr pp_matched; exp_continue }
29 }
30 }
31 timeout {fail "$testname (timeout)"}
32 }
33
34 if { $correct_fileline } { pass "symfileline ()" } { fail "symfileline ()" }
35 if { $correct_file } { pass "symfile ()" } { fail "symfile ()" }
36 if { $correct_line } { pass "symline ()" } { fail "symline ()" }
37 if { $pp_matched } { pass "symfileline in pp ()" } { fail "symfileline in pp ()" }
38
39 catch { close }
40 catch { wait }