| 1 |
set test "process_by_cmd" |
| 2 |
|
| 3 |
# Only run on make installcheck and uprobes present. |
| 4 |
if {! [installtest_p]} { untested "$test"; return } |
| 5 |
|
| 6 |
# Test for PR12427 [implied process("...") target for stap -c CMD |
| 7 |
# invocation]. |
| 8 |
|
| 9 |
# We've got a problem in testing all the 'process.*' probe |
| 10 |
# variants. Depending on the compiler, debuginfo generation, |
| 11 |
# optimization level, etc., the probes can get hit in different |
| 12 |
# orders. For instance, a 'process.function("main")' probe might get |
| 13 |
# hit before or after the first |
| 14 |
# 'process.statement("*@process_by_cmd.c")' probe (they sometimes get |
| 15 |
# inserted at the same address, but might get installed in different |
| 16 |
# orders). |
| 17 |
# |
| 18 |
# To ensure we're testing the right thing, this test has been split |
| 19 |
# into two subtests, so we can hopefully depend on the order output. |
| 20 |
|
| 21 |
set ::result_string {func end |
| 22 |
mark end |
| 23 |
func return end |
| 24 |
func return end |
| 25 |
func return end |
| 26 |
mark end |
| 27 |
func return end} |
| 28 |
|
| 29 |
set test_flags "additional_flags=-g" |
| 30 |
set test_flags "$test_flags [sdt_includes]" |
| 31 |
|
| 32 |
set res [target_compile $srcdir/$subdir/$test.c $test executable "$test_flags"] |
| 33 |
if {$res != ""} { |
| 34 |
verbose -log "target_compile failed: $res" 2 |
| 35 |
fail "$test.c compile" |
| 36 |
untested "$test" |
| 37 |
return |
| 38 |
} else { |
| 39 |
pass "$test.c compile" |
| 40 |
} |
| 41 |
|
| 42 |
foreach runtime [get_runtime_list] { |
| 43 |
if {$runtime != ""} { |
| 44 |
stap_run3 "${test}.stp ($runtime)" \ |
| 45 |
$srcdir/$subdir/${test}.stp -c ./$test --runtime=$runtime |
| 46 |
} elseif {[uretprobes_p]} { |
| 47 |
stap_run3 ${test}.stp $srcdir/$subdir/${test}.stp -c ./$test |
| 48 |
} else { |
| 49 |
untested ${test}.stp |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
set ::result_string {state end |
| 54 |
func label end |
| 55 |
state end |
| 56 |
state end |
| 57 |
state end} |
| 58 |
|
| 59 |
foreach runtime [get_runtime_list] { |
| 60 |
if {$runtime != ""} { |
| 61 |
stap_run3 "${test}2.stp ($runtime)" \ |
| 62 |
$srcdir/$subdir/${test}2.stp -c ./$test --runtime=$runtime |
| 63 |
} elseif {[uprobes_p]} { |
| 64 |
stap_run3 ${test}2.stp $srcdir/$subdir/${test}2.stp -c ./$test |
| 65 |
} else { |
| 66 |
untested ${test}2.stp |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
if { $verbose == 0 } { catch {exec rm -f $test} } |