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