Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.clone/dtrace_fork_exec.exp

raw
1 set TEST_NAME "dtrace_fork_exec"
2 set build_dir ""
3 set test_progs {"dtrace_fork_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_fork_parent $build_dir/dtrace_child }
13 return 0
14 }
15
16 # Since we can't guarentee the order of parent/child execution, we
17 # have to be flexible on output.
18 set output_string "parent - pid: \[0-9\]+\r\nparent - child pid( before exec)?: \[0-9\]+\r\nparent - child pid( before exec)?: \[0-9\]+\r\nchild - pid: \[0-9\]+\r\nparent - finished\r\n"
19
20 # Build everything (without semaphores)
21 set TEST_NAME "dtrace_fork_exec1"
22 if {[build_test_progs "Makefile.fork_exec" $test_progs] == 0} {
23 fail "$TEST_NAME - build failure"
24 cleanup_test_progs
25 return
26 } else {
27 pass "$TEST_NAME - build success"
28 }
29
30 # Run the test (without semaphores)
31 set TEST_NAME "dtrace_fork_exec2"
32 stap_run $TEST_NAME run_test_prog $output_string \
33 $srcdir/$subdir/dtrace_fork_exec.stp $build_dir/dtrace_fork_parent \
34 $build_dir/dtrace_child
35
36 # Build everything (with semaphores)
37 set TEST_NAME "dtrace_fork_exec3"
38 if {[build_test_progs "Makefile.fork_exec" $test_progs "-DUSE_SEMAPHORES"] == 0} {
39 fail "$TEST_NAME - build failure"
40 cleanup_test_progs
41 return
42 } else {
43 pass "$TEST_NAME - build success"
44 }
45
46 # Run the test (with semaphores)
47 set TEST_NAME "dtrace_fork_exec4"
48 stap_run $TEST_NAME run_test_prog $output_string \
49 $srcdir/$subdir/dtrace_fork_exec.stp $build_dir/dtrace_fork_parent \
50 $build_dir/dtrace_child
51
52 # Cleanup
53 cleanup_test_progs