Debian Codegraph @

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

raw
1 set TEST_NAME "dtrace_clone"
2 set build_dir ""
3 set test_progs {"dtrace_clone"}
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 # We have to be root to use CLONE_NEWPID.
11 proc run_test_prog {} {
12 global build_dir
13 as_root $build_dir/dtrace_clone
14 return 0
15 }
16
17 # Here's an explanation of the output. On kernels that support
18 # CLONE_NEWPID (new pid namespace), we'll see the following output:
19 # main - pid: XXX
20 # main - child pid: YYY
21 # child1 - pid: 1
22 # child1 - child2 pid: 2
23 # child2 - pid: 1
24 # main - finished
25 # On kernels with CLONE_NEWPID, the pids assigned to the children are
26 # fixed since they exist in their own pid namespace. Because not all
27 # kernels support CLONE_NEWPID, we have to accept all pids.
28 set output_string "main - pid: \[0-9\]+\r\nmain - child pid: \[0-9\]+\r\nchild1 - pid: \[0-9\]+\r\nchild1 - child2 pid: \[0-9\]+\r\nchild2 - pid: \[0-9\]+\r\nmain - finished\r\n"
29
30 # Build everything (without semaphores)
31 set TEST_NAME "dtrace_clone1"
32 if {[build_test_progs "Makefile.clone" $test_progs] == 0} {
33 fail "$TEST_NAME - build failure"
34 cleanup_test_progs
35 return
36 } else {
37 pass "$TEST_NAME - build success"
38 }
39
40 # Run the test (without semaphores)
41 set TEST_NAME "dtrace_clone2"
42 stap_run $TEST_NAME run_test_prog $output_string \
43 $srcdir/$subdir/dtrace_clone.stp $build_dir/dtrace_clone
44
45 # Build everything (with semaphores)
46 set TEST_NAME "dtrace_clone3"
47 if {[build_test_progs "Makefile.clone" $test_progs "-DUSE_SEMAPHORES"] == 0} {
48 fail "$TEST_NAME - build failure"
49 cleanup_test_progs
50 return
51 } else {
52 pass "$TEST_NAME - build success"
53 }
54
55 # Run the test (with semaphores)
56 set TEST_NAME "dtrace_clone4"
57 stap_run $TEST_NAME run_test_prog $output_string \
58 $srcdir/$subdir/dtrace_clone.stp $build_dir/dtrace_clone
59
60 # Cleanup
61 cleanup_test_progs