Debian Codegraph @

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

raw
1 set test "at_var_cu"
2 set testpath "$srcdir/$subdir"
3 set exefile "[pwd]/$test"
4 set stap_path $env(SYSTEMTAP_PATH)/stap
5 set staprun_path $env(SYSTEMTAP_PATH)/staprun
6
7 # Test that @var("var@cu", "module") and @var("var@cu") search
8 # in all the CUs that look like a match for the pattern "cu".
9
10 set ::result_string {foo: @var("counter", @1): 0
11 foo: @var("counter@at_var_cu_2.c", @1): 0
12 foo: @var("counter@at_var_cu_3.c", @1): 0
13 foo: @var("counter@at_var_cu*.c", @1): 0
14 bar: @var("counter", @1): 7
15 bar: @var("counter@at_var_cu_2.c", @1): 7
16 bar: @var("counter@at_var_cu_3.c", @1): 0
17 bar: @var("counter@at_var_cu*.c", @1): 7
18 baz: @var("counter", @1): 0
19 baz: @var("counter@at_var_cu_2.c", @1): 8
20 baz: @var("counter@at_var_cu_3.c", @1): 0
21 baz: @var("counter@at_var_cu*.c", @1): 8
22 bah: @var("counter", @1): 3
23 bah: @var("counter@at_var_cu_2.c", @1): 8
24 bah: @var("counter@at_var_cu_3.c", @1): 3
25 bah: @var("counter@at_var_cu*.c", @1): 8
26 bah': @var("counter@at_var_cu*.c"): 8
27 bah': @var("main_global"): 5}
28
29 # Only run on make installcheck and uprobes present.
30 if {! [installtest_p]} { untested "$test"; return }
31
32 set sources \
33 "$testpath/${test}_1.c $testpath/${test}_2.c $testpath/${test}_3.c"
34
35 set res [target_compile "$sources" $exefile executable \
36 "additional_flags=-O2 additional_flags=-g"]
37
38 if { $res != "" } {
39 verbose "target_compile failed: $res" 2
40 fail "unable to compile ${test}.c"
41 }
42
43 foreach runtime [get_runtime_list] {
44 if {$runtime != ""} {
45 stap_run3 "$test ($runtime)" $srcdir/$subdir/$test.stp -c ./$test \
46 $exefile --runtime=$runtime
47
48 } elseif {[uprobes_p]} {
49 stap_run3 $test $srcdir/$subdir/$test.stp -c ./$test $exefile
50
51 } else {
52 untested "$test"
53 }
54 }
55
56 # Cleanup
57 if { $verbose == 0 } { catch { exec rm -f $test } }