Debian Codegraph @

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

raw
1 set test "stmt_rel_user"
2
3 proc dyninst_kfails {index} {
4 # The dyninst runtime isn't multi-arch, it only works on the
5 # native architecture. PR14490.
6 if {! [all_compile_flag_native_p $index]} {
7 setup_kfail 14490 "*-*-*"
8 }
9 }
10
11 # Compile with inlining and check we can set a relative statement there
12 for {set i 0} {$i < [all_compile_flags]} {incr i} {
13 set extra_flag [all_compile_flag $i]
14 set extra_name [all_compile_flag_name $i]
15
16 set rel_flags "additional_flags=-Wall additional_flags=-Werror"
17 set rel_flags "$rel_flags additional_flags=-Winline"
18 set rel_flags "$rel_flags additional_flags=-g"
19 set rel_flags "$rel_flags $extra_flag"
20 set res [target_compile $srcdir/$subdir/$test.c [pwd]/$test.x executable $rel_flags]
21 if { $res != "" } {
22 verbose "target_compile failed: $res" 2
23 fail "$test-$extra_name compiling"
24 cleanup_handler $verbose
25 continue
26 } else {
27 pass "$test-$extra_name compiling"
28 }
29
30 if {![installtest_p]} { untested "$test-$extra_name"; return }
31
32 foreach runtime [get_runtime_list] {
33 if {$runtime != ""} {
34 set test_name "$test-$extra_name-$runtime"
35 if { [info procs ${runtime}_kfails] ne "" } {
36 ${runtime}_kfails $i
37 }
38 spawn stap --runtime=$runtime -c ./$test.x -e "probe process(\"./$test.x\").statement(\"Move@$test.c+2\") {printf(\"Move %d\\n\",\$s1)}"
39 } elseif {[uprobes_p]} {
40 set test_name "$test-$extra_name"
41 spawn stap -c ./$test.x -e "probe process(\"./$test.x\").statement(\"Move@$test.c+2\") {printf(\"Move %d\\n\",\$s1)}"
42 } else {
43 untested "$test-$extra_name"
44 continue
45 }
46
47 set ok 0
48 expect {
49 -timeout 180
50 -re {Move [0-9]} { incr ok; exp_continue }
51 timeout { fail "$test_name (timeout)" }
52 eof { }
53 }
54 catch {close}; catch {wait}
55
56 # PR13430 when optimizing we fail to set probes on all inlined lines.
57 if { [string first "O" $extra_name] != -1 } {
58 setup_kfail 13430 "*-*-*"
59 }
60
61 # A hanoi tower needs 2^n - 1 moves (n == 14 in the test program)
62 if { $ok == 16383 } {
63 pass "$test_name"
64 } else {
65 fail "$test_name ($ok)"
66 }
67 }
68 }