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