| 1 |
set test "at_var_timer_profile" |
| 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") work in the context of |
| 8 |
# timer.profile. |
| 9 |
# Also ensure that the module argument can be multiple module names |
| 10 |
# separated by colon, e.g., "module1:module2:module3". |
| 11 |
# Also test that unresolved @var() can be properly caught by @defined(). |
| 12 |
|
| 13 |
set ::result_string {@var("foo", @1)->bar: 42 |
| 14 |
@var("foo@at_var_timer_profile.c", @1)->bar: 42 |
| 15 |
@var("foo@at_var_timer_profile.c", @2)->bar: 42 |
| 16 |
@var("foo", @1)$: {.bar=42} |
| 17 |
@var("foo", @1)$$: {.bar=42} |
| 18 |
@defined(@var("foo", "badmodle")): NO |
| 19 |
@defined(@var("foo", @3)): NO} |
| 20 |
|
| 21 |
# Only run on make installcheck and uprobes present. |
| 22 |
if {! [installtest_p]} { untested "$test"; return } |
| 23 |
|
| 24 |
# no -O2; it can elide the 'foo' global |
| 25 |
set res [target_compile ${testpath}/$test.c $exefile executable "additional_flags=-g"] |
| 26 |
if { $res != "" } { |
| 27 |
verbose "target_compile failed: $res" 2 |
| 28 |
fail "unable to compile ${test}.c" |
| 29 |
} |
| 30 |
|
| 31 |
foreach runtime [get_runtime_list] { |
| 32 |
if {$runtime != ""} { |
| 33 |
if {$runtime == "dyninst"} { |
| 34 |
# dyninst lacks support for probe timer.profile |
| 35 |
setup_kfail 15540 "*-*-*" |
| 36 |
} |
| 37 |
|
| 38 |
stap_run3 "$test ($runtime)" $srcdir/$subdir/$test.stp -c ./$test $exefile \ |
| 39 |
"$stap_path:$exefile:$staprun_path" "$stap_path:$staprun_path" \ |
| 40 |
--runtime=$runtime |
| 41 |
|
| 42 |
} elseif {[uprobes_p]} { |
| 43 |
stap_run3 $test $srcdir/$subdir/$test.stp -c ./$test $exefile \ |
| 44 |
"$stap_path:$exefile:$staprun_path" "$stap_path:$staprun_path" |
| 45 |
|
| 46 |
} else { |
| 47 |
untested "$test" |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
# Cleanup |
| 52 |
if { $verbose == 0 } { catch { exec rm -f $test } } |