Debian Codegraph @

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

raw
1 set test "rep_ret"
2
3 # This test is only for i386 and x86_64
4 # Test 32-on-64 when available
5 switch -regexp $::tcl_platform(machine) {
6 {^i\d86$} { set arches [list "-default"] }
7 {^x86_64$} { set arches [list "-m64" "-m32"]}
8 default { unsupported "$test"; return }
9 }
10
11 foreach arch $arches {
12
13 set exe ${test}${arch}
14 verbose "testing $exe"
15
16 set test_flags "additional_flags=-g"
17 set test_flags "$test_flags additional_flags=-fomit-frame-pointer"
18
19 if {$arch != "-default"} {
20 set test_flags "$test_flags additional_flags=$arch"
21 }
22
23 set res [target_compile $srcdir/$subdir/$test.c $exe executable "$test_flags"]
24 if { $res != "" } {
25 verbose "target_compile $exe failed: $res" 2
26 fail "${test}.c compile ${arch}"
27 untested "$exe"
28 return
29 } else {
30 pass "${test}.c compile ${arch}"
31 }
32
33 if {[installtest_p] && [uprobes_p]} {
34 set ok 0
35 set warn 0
36
37 spawn stap -e {probe process(@1).function("*") { println(probefunc()) }} ./$exe -c ./$exe
38 # We have two cases for main below to handle the possibility of main not being the first
39 # line being printed out (but only one of the two will ever fire, so the count is still 3)
40 # The test however does still ensure that main is followed by rep_ret then by repnz_ret.
41 expect {
42 -re {\r\nmain\r\n} { incr ok; exp_continue }
43 -re {^main\r\n} { incr ok; exp_continue }
44 -re {^rep_ret\r\n} { incr ok; exp_continue }
45 -re {^repnz_ret\r\n} { incr ok; exp_continue }
46 -re {^WARNING: Number of errors: 0, skipped probes: [^\r\n]*\r\n} { incr warn; exp_continue }
47 timeout { fail "$exe (timeout)" }
48 eof { }
49 }
50 catch { close }; catch { wait }
51
52 if {$ok == 3 && $warn == 0} {
53 pass "$exe"
54 } else {
55 fail "$exe ($ok, $warn)"
56 }
57 } else {
58 untested "$exe"
59 }
60 catch {exec rm -f $exe}
61
62 }