Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/task_dentry_path.exp

raw
1 # This testcase tests the fix for PR16991 - infinite loop in
2 # task_dentry_path. When task_dentry_path hit a dentry from an
3 # unmounted synthentic filesystem, it would go into an infinite loop
4 # (until killed by MAXACTION).
5
6 set test_base "task_dentry_path"
7 set test "${test_base}"
8 set test_name "$test_base (infinite loop)"
9 set am_root [expr 0 == [exec id -u]]
10
11 # Only run on make installcheck
12 if {! [installtest_p]} { untested "$test"; return }
13
14 spawn stap $srcdir/$subdir/$test.stp -c "sh $srcdir/$subdir/$test.sh"
15 set ok 0
16 expect {
17 -timeout 150
18 -re {ERROR.*MAXACTION} { incr ok; exp_continue }
19 timeout { fail "$test_name (timeout)" }
20 eof { }
21 }
22 catch {close}; catch {wait}
23 if {$ok == 1} { fail "$test_name ($ok)" } { pass "$test_name" }
24
25 # Test the fix for PR19021 - the tapset function task_dentry_path()
26 # should handle more than just files.
27 set test "${test_base}2"
28 set test_name "$test_base (synthetic files)"
29 spawn stap $srcdir/$subdir/$test.stp -c "echo hi | cat > /dev/null"
30 set ok 0
31 expect {
32 -timeout 150
33 -re {^pipe:\[[0-9]+\]\r\n} { incr ok; exp_continue }
34 timeout { fail "$test_name (timeout)" }
35 eof { }
36 }
37 catch {close}; catch {wait}
38 if {$ok == 1} { pass "$test_name" } { fail "$test_name ($ok)" }
39
40 # Test the fix for BZ1425568 - systemtap task_dentry_path crashes
41 # under chroot.
42 set test "${test_base}3"
43 set test_name "$test_base (chroot)"
44
45 # We've got to be root to successfully do a 'chroot'.
46 if {!$am_root} {
47 untested "$test_name"
48 } else {
49 set curdir [pwd]
50 spawn stap $srcdir/$subdir/$test.stp -c "perl -e 'chroot(qw(/tmp))'"
51 set ok 0
52 expect {
53 -timeout 150
54 -re "^${curdir}\r\n" { incr ok; exp_continue }
55 timeout { fail "$test_name (timeout)" }
56 eof { }
57 }
58 catch {close}; catch {wait}
59 if {$ok == 1} { pass "$test_name" } { fail "$test_name ($ok)" }
60 }