| 1 |
set test_name "proc_by_pid" |
| 2 |
if {! [installtest_p]} { |
| 3 |
untested $test_name |
| 4 |
return |
| 5 |
} |
| 6 |
|
| 7 |
# Build the test program |
| 8 |
set compile_result [target_compile $srcdir/$subdir/$test_name.c ./$test_name executable "additional_flags=-g [sdt_includes]"] |
| 9 |
|
| 10 |
if {$compile_result != ""} { |
| 11 |
verbose -log "target_compile failed: $compile_result" 2 |
| 12 |
fail "$test_name - unable to compile, $compile_result" |
| 13 |
untested "$test_name" |
| 14 |
return |
| 15 |
} else { |
| 16 |
pass "$test_name - compiled successfully" |
| 17 |
} |
| 18 |
|
| 19 |
# Expected output |
| 20 |
set output_string "Encountered \[0-4\] functions, and \[0-2\] marks\r\n" |
| 21 |
|
| 22 |
# Running the test program and script |
| 23 |
foreach runtime [get_runtime_list] { |
| 24 |
# Run the instance of the test program |
| 25 |
verbose -log "running test program" |
| 26 |
spawn ./$test_name |
| 27 |
set exe_id $spawn_id |
| 28 |
|
| 29 |
if {$runtime != ""} { |
| 30 |
set cur_test_name "$test_name ($runtime)" |
| 31 |
|
| 32 |
# Run stap with -x $PID |
| 33 |
stap_run $cur_test_name no_load $output_string --runtime=$runtime $srcdir/$subdir/$test_name.stp -x [exp_pid -i $exe_id] |
| 34 |
} elseif {[uprobes_p]} { |
| 35 |
# Run stap with -x $PID |
| 36 |
stap_run $test_name no_load $output_string $srcdir/$subdir/$test_name.stp -x [exp_pid -i $exe_id] |
| 37 |
} else { |
| 38 |
untested "$test_name (uprobes)" |
| 39 |
} |
| 40 |
kill -INT -[exp_pid -i $exe_id] 2 |
| 41 |
catch {close -i $exe_id} |
| 42 |
catch {wait -i $exe_id} |
| 43 |
} |
| 44 |
|
| 45 |
exec rm -f ./$test_name |