| 1 |
set TEST_NAME "dtrace_vfork_exec" |
| 2 |
set build_dir "" |
| 3 |
set test_progs {"dtrace_vfork_parent" "dtrace_child"} |
| 4 |
|
| 5 |
if {![installtest_p]} { untested $TEST_NAME; return } |
| 6 |
if {![uprobes_p]} { untested $TEST_NAME; return } |
| 7 |
|
| 8 |
source $srcdir/$subdir/test_progs.tcl |
| 9 |
|
| 10 |
proc run_test_prog {} { |
| 11 |
global build_dir |
| 12 |
catch { exec $build_dir/dtrace_vfork_parent $build_dir/dtrace_child } |
| 13 |
return 0 |
| 14 |
} |
| 15 |
|
| 16 |
set output_string "parent - pid: \[0-9\]+\r\nparent - child pid: \[0-9\]+\r\nchild - pid: \[0-9\]+\r\nparent - finished\r\n" |
| 17 |
|
| 18 |
# Build everything (without semaphores) |
| 19 |
set TEST_NAME "dtrace_vfork_exec1" |
| 20 |
if {[build_test_progs "Makefile.vfork_exec" $test_progs] == 0} { |
| 21 |
fail "$TEST_NAME - build failure" |
| 22 |
cleanup_test_progs |
| 23 |
return |
| 24 |
} else { |
| 25 |
pass "$TEST_NAME - build success" |
| 26 |
} |
| 27 |
|
| 28 |
# Run the test (without semaphores) |
| 29 |
set TEST_NAME "dtrace_vfork_exec2" |
| 30 |
stap_run $TEST_NAME run_test_prog $output_string \ |
| 31 |
$srcdir/$subdir/dtrace_vfork_exec.stp $build_dir/dtrace_vfork_parent \ |
| 32 |
$build_dir/dtrace_child |
| 33 |
|
| 34 |
# Build everything (with semaphores) |
| 35 |
set TEST_NAME "dtrace_vfork_exec3" |
| 36 |
if {[build_test_progs "Makefile.vfork_exec" $test_progs "-DUSE_SEMAPHORES"] == 0} { |
| 37 |
fail "$TEST_NAME - build failure" |
| 38 |
cleanup_test_progs |
| 39 |
return |
| 40 |
} else { |
| 41 |
pass "$TEST_NAME - build success" |
| 42 |
} |
| 43 |
|
| 44 |
# Run the test (with semaphores) |
| 45 |
set TEST_NAME "dtrace_vfork_exec4" |
| 46 |
stap_run $TEST_NAME run_test_prog $output_string \ |
| 47 |
$srcdir/$subdir/dtrace_vfork_exec.stp $build_dir/dtrace_vfork_parent \ |
| 48 |
$build_dir/dtrace_child |
| 49 |
|
| 50 |
# Cleanup |
| 51 |
cleanup_test_progs |