Debian Codegraph @

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

raw
1 # rlimit tests
2
3 # many of these tests use as_root or as_non_root
4 if {! [installtest_p]} { return }
5
6 # To make sure "sudo stap" works correctly, use the full path.
7 set installed_stap "$env(SYSTEMTAP_PATH)/stap"
8
9 # We use -w in the stap invocations so that warnings re. blocklisted functions
10 # are not emitted (due to rlimit.stp using a broad wildcard).
11
12 # Unlimited
13 set test "rlimit unlimited"
14 if {[catch { exec $installed_stap -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
15 fail $test
16 } else {
17 pass $test
18 }
19
20 # Increase AS limit (as non root)
21 set test "rlimit AS increase (as non root)"
22 if {[as_non_root "$installed_stap --rlimit-as=1 --rlimit-as=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
23 pass $test
24 } else {
25 fail $test
26 }
27
28 # Increase AS limit (as root)
29 set test "rlimit AS increase (as root)"
30 if {[as_root "$installed_stap --rlimit-as=1 --rlimit-as=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
31 fail $test
32 } else {
33 pass $test
34 }
35
36 # Realistic AS limit
37 set test "rlimit AS realistic"
38 if {[catch { exec $installed_stap --rlimit-as=614400000 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
39 fail $test
40 } else {
41 pass $test
42 }
43
44 # Small AS limit
45 set test "rlimit AS small"
46 if {[catch { exec $installed_stap --rlimit-as=1 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
47 pass $test
48 } else {
49 fail $test
50 }
51
52 # Increase CPU limit (as non root)
53 set test "rlimit CPU increase (as non root)"
54 if {[as_non_root "$installed_stap --rlimit-cpu=1 --rlimit-cpu=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
55 pass $test
56 } else {
57 fail $test
58 }
59
60 # Increase CPU limit (as root)
61 set test "rlimit CPU increase (as root)"
62 if {[as_root "$installed_stap --rlimit-cpu=1 --rlimit-cpu=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
63 fail $test
64 } else {
65 pass $test
66 }
67
68 # Realistic CPU limit
69 set test "rlimit CPU realistic"
70 if {[catch { exec $installed_stap --rlimit-cpu=60 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
71 fail $test
72 } else {
73 pass $test
74 }
75
76 # Small CPU limit
77 set test "rlimit CPU small"
78 if {[catch { exec $installed_stap --disable-cache --rlimit-cpu=1 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
79 pass $test
80 } else {
81 fail $test
82 }
83
84 # Increase NPROC limit (as non root)
85 set test "rlimit NPROC increase (as non root)"
86 if {[as_non_root "$installed_stap --rlimit-nproc=1 --rlimit-nproc=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
87 pass $test
88 } else {
89 fail $test
90 }
91
92 # Increase NPROC limit (as root)
93 set test "rlimit NPROC increase (as root)"
94 if {[as_root "$installed_stap --rlimit-nproc=1 --rlimit-nproc=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
95 fail $test
96 } else {
97 pass $test
98 }
99 # Realistic NPROC limit
100 set test "rlimit NPROC realistic"
101 if {[catch { exec $installed_stap --rlimit-nproc=20 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
102 fail $test
103 } else {
104 pass $test
105 }
106
107 # Small NPROC limit
108 # Did not seem to change functionality
109
110 # Increase STACK limit (as non root)
111 set test "rlimit STACK increase (as non root)"
112 if {[as_non_root "$installed_stap --rlimit-stack=1 --rlimit-stack=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
113 pass $test
114 } else {
115 fail $test
116 }
117
118 # Increase STACK limit (as root)
119 set test "rlimit STACK increase (as root)"
120 if {[as_root "$installed_stap --rlimit-stack=1 --rlimit-stack=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
121 fail $test
122 } else {
123 pass $test
124 }
125
126 # Realistic STACK limit
127 set test "rlimit STACK realistic"
128 if {[catch { exec $installed_stap --rlimit-stack=1024000 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
129 fail $test
130 } else {
131 pass $test
132 }
133
134 # Small STACK limit
135 # PR13977. The setrlimit() call in stap succeeds, but some kernels ignore
136 # the small limit.
137
138 # Increase FSIZE limit (as non root)
139 set test "rlimit FSIZE increase (as non root)"
140 if {[as_non_root "$installed_stap --rlimit-fsize=1 --rlimit-fsize=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
141 pass $test
142 } else {
143 fail $test
144 }
145
146 # Increase FSIZE limit (as root)
147 set test "rlimit FSIZE increase (as root)"
148 if {[as_root "$installed_stap --rlimit-fsize=1 --rlimit-fsize=999999999999 -wp4 $srcdir/$subdir/rlimit.stp" ]} {
149 fail $test
150 } else {
151 pass $test
152 }
153
154 # Realistic FSIZE limit
155 set test "rlimit FSIZE realistic"
156 if {[catch { exec $installed_stap --rlimit-fsize=51200000 -wp4 $srcdir/$subdir/rlimit.stp} res ]} {
157 fail $test
158 } else {
159 pass $test
160 }
161
162 # Small FSIZE limit
163 # Did not seem to change functionality