Commit | Line | Data |
---|---|---|
a0b1f42c JD |
1 | #!/bin/bash |
2 | # | |
9d16b343 | 3 | # Copyright (C) 2016 Julien Desfossez <jdesfossez@efficios.com> |
a0b1f42c | 4 | # |
9d16b343 | 5 | # SPDX-License-Identifier: GPL-2.0-only |
a0b1f42c | 6 | # |
a0b1f42c JD |
7 | |
8 | TEST_DESC="Kernel tracer - select, poll and epoll payload extraction" | |
9 | ||
d40c2620 | 10 | CURDIR=$(dirname "$0")/ |
a0b1f42c JD |
11 | TESTDIR=$CURDIR/../.. |
12 | VALIDATE_SCRIPT="$CURDIR/validate_select_poll_epoll.py" | |
13 | NUM_TESTS=102 | |
14 | ||
15 | # Only run this test on x86 and arm | |
16 | uname -m | grep -E "x86|i686|arm|aarch64" >/dev/null 2>&1 | |
17 | if test $? != 0; then | |
23bbd912 JR |
18 | plan_tests $NUM_TESTS |
19 | skip 0 "Run only on x86 and arm. Skipping all tests." $NUM_TESTS | |
a0b1f42c JD |
20 | exit 0 |
21 | fi | |
22 | ||
23 | DISABLE_VALIDATE=0 | |
24 | # Babeltrace python bindings are required for the validation, but | |
25 | # it is not a mandatory dependancy of the project, so fail run the | |
26 | # without the content validation, at least we test that we are not | |
27 | # crashing the kernel. | |
28 | $VALIDATE_SCRIPT --help >/dev/null 2>&1 | |
29 | if test $? != 0; then | |
30 | echo "# Failed to run the validation script, Babeltrace Python bindings might be missing" | |
31 | DISABLE_VALIDATE=1 | |
32 | fi | |
33 | ||
34 | LAST_WARNING=$(dmesg | grep " WARNING:" | cut -d' ' -f1 | tail -1) | |
35 | LAST_OOPS=$(dmesg | grep " OOPS:" | cut -d' ' -f1 | tail -1) | |
36 | LAST_BUG=$(dmesg | grep " BUG:" | cut -d' ' -f1 | tail -1) | |
37 | ||
d40c2620 | 38 | # shellcheck source=../../utils/utils.sh |
a0b1f42c JD |
39 | source $TESTDIR/utils/utils.sh |
40 | ||
41 | function check_trace_content() | |
42 | { | |
43 | if test $DISABLE_VALIDATE == 1; then | |
44 | ok 0 "Validation skipped" | |
45 | return | |
46 | fi | |
47 | ||
48 | $VALIDATE_SCRIPT $@ | |
49 | if test $? = 0; then | |
50 | ok 0 "Validation success" | |
51 | else | |
52 | fail "Validation" | |
53 | fi | |
54 | } | |
55 | ||
56 | function test_working_cases() | |
57 | { | |
a0b1f42c | 58 | SESSION_NAME="syscall_payload" |
d40c2620 JG |
59 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
60 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
61 | |
62 | # arm64 does not have epoll_wait | |
63 | uname -m | grep -E "aarch64" >/dev/null 2>&1 | |
64 | if test $? = 0; then | |
65 | SYSCALL_LIST="select,pselect6,poll,ppoll,epoll_ctl,epoll_pwait" | |
66 | else | |
67 | SYSCALL_LIST="select,pselect6,poll,ppoll,epoll_ctl,epoll_wait,epoll_pwait" | |
68 | fi | |
69 | ||
70 | diag "Working cases for select, pselect6, poll, ppoll and epoll, waiting for input" | |
71 | ||
d40c2620 | 72 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
73 | |
74 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
75 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
76 | ||
77 | start_lttng_tracing_ok | |
d40c2620 | 78 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 1 |
a0b1f42c | 79 | stop_lttng_tracing_ok |
a0b1f42c | 80 | |
d40c2620 JG |
81 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
82 | check_trace_content -t 1 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" | |
a0b1f42c JD |
83 | |
84 | destroy_lttng_session_ok $SESSION_NAME | |
85 | ||
d40c2620 JG |
86 | rm -rf "$TRACE_PATH" |
87 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
88 | } |
89 | ||
90 | function test_timeout_cases() | |
91 | { | |
a0b1f42c | 92 | SESSION_NAME="syscall_payload" |
d40c2620 JG |
93 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
94 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
95 | |
96 | # arm64 does not have epoll_wait | |
97 | uname -m | grep -E "aarch64" >/dev/null 2>&1 | |
98 | if test $? = 0; then | |
99 | SYSCALL_LIST="select,pselect6,poll,ppoll,epoll_ctl,epoll_pwait" | |
100 | else | |
101 | SYSCALL_LIST="select,pselect6,poll,ppoll,epoll_ctl,epoll_wait,epoll_pwait" | |
102 | fi | |
103 | ||
104 | diag "Timeout cases (1ms) for select, pselect6, poll, ppoll and epoll" | |
105 | ||
d40c2620 | 106 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
107 | |
108 | lttng_enable_kernel_syscall_ok $SESSION_NAME "$SYSCALL_LIST" | |
109 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
110 | ||
111 | start_lttng_tracing_ok | |
d40c2620 | 112 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 2 |
a0b1f42c | 113 | stop_lttng_tracing_ok |
a0b1f42c | 114 | |
d40c2620 JG |
115 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
116 | check_trace_content -t 2 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
117 | |
118 | destroy_lttng_session_ok $SESSION_NAME | |
119 | ||
d40c2620 JG |
120 | rm -rf "$TRACE_PATH" |
121 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
122 | } |
123 | ||
8b3b99e2 | 124 | function test_pselect_invalid_fd() |
a0b1f42c | 125 | { |
a0b1f42c JD |
126 | SESSION_NAME="syscall_payload" |
127 | SYSCALL_LIST="pselect6" | |
d40c2620 JG |
128 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
129 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c | 130 | |
8b3b99e2 | 131 | diag "pselect with invalid FD" |
a0b1f42c | 132 | |
d40c2620 | 133 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
134 | |
135 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
136 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
137 | ||
138 | start_lttng_tracing_ok | |
d40c2620 | 139 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 3 |
a0b1f42c | 140 | stop_lttng_tracing_ok |
a0b1f42c | 141 | |
d40c2620 JG |
142 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
143 | check_trace_content -t 3 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
144 | |
145 | destroy_lttng_session_ok $SESSION_NAME | |
146 | ||
d40c2620 JG |
147 | rm -rf "$TRACE_PATH" |
148 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
149 | } |
150 | ||
151 | function test_big_ppoll() | |
152 | { | |
a0b1f42c JD |
153 | SESSION_NAME="syscall_payload" |
154 | SYSCALL_LIST="ppoll" | |
d40c2620 JG |
155 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
156 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
157 | |
158 | diag "ppoll with 2047 FDs" | |
159 | ||
d40c2620 | 160 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
161 | |
162 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
163 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
164 | ||
165 | start_lttng_tracing_ok | |
d40c2620 | 166 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 4 |
a0b1f42c | 167 | stop_lttng_tracing_ok |
a0b1f42c | 168 | |
d40c2620 JG |
169 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
170 | check_trace_content -t 4 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
171 | |
172 | destroy_lttng_session_ok $SESSION_NAME | |
173 | ||
d40c2620 JG |
174 | rm -rf "$TRACE_PATH" |
175 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
176 | } |
177 | ||
178 | function test_ppoll_overflow() | |
179 | { | |
a0b1f42c JD |
180 | SESSION_NAME="syscall_payload" |
181 | SYSCALL_LIST="ppoll" | |
d40c2620 JG |
182 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
183 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
184 | |
185 | diag "ppoll buffer overflow, should segfault, waits for input" | |
186 | ||
d40c2620 | 187 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
188 | |
189 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
190 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
191 | ||
192 | start_lttng_tracing_ok | |
193 | diag "Expect segfaults" | |
d40c2620 | 194 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 5 |
a0b1f42c | 195 | stop_lttng_tracing_ok |
a0b1f42c | 196 | |
d40c2620 | 197 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
a0b1f42c | 198 | |
d40c2620 | 199 | check_trace_content -t 5 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null |
a0b1f42c JD |
200 | |
201 | destroy_lttng_session_ok $SESSION_NAME | |
202 | ||
d40c2620 JG |
203 | rm -rf "$TRACE_PATH" |
204 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
205 | } |
206 | ||
207 | function test_pselect_invalid_ptr() | |
208 | { | |
a0b1f42c JD |
209 | SESSION_NAME="syscall_payload" |
210 | SYSCALL_LIST="pselect6" | |
d40c2620 JG |
211 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
212 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
213 | |
214 | diag "pselect with invalid pointer, waits for input" | |
215 | ||
d40c2620 | 216 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
217 | |
218 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
219 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
220 | ||
221 | start_lttng_tracing_ok | |
d40c2620 | 222 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 6 |
a0b1f42c | 223 | stop_lttng_tracing_ok |
a0b1f42c | 224 | |
d40c2620 JG |
225 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
226 | check_trace_content -t 6 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
227 | |
228 | destroy_lttng_session_ok $SESSION_NAME | |
229 | ||
d40c2620 JG |
230 | rm -rf "$TRACE_PATH" |
231 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
232 | } |
233 | ||
234 | function test_ppoll_ulong_max() | |
235 | { | |
a0b1f42c JD |
236 | SESSION_NAME="syscall_payload" |
237 | SYSCALL_LIST="ppoll" | |
d40c2620 JG |
238 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
239 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
240 | |
241 | diag "ppoll with ulong_max fds, waits for input" | |
242 | ||
d40c2620 | 243 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
244 | |
245 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
246 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
247 | ||
248 | start_lttng_tracing_ok | |
d40c2620 | 249 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 7 |
a0b1f42c | 250 | stop_lttng_tracing_ok |
a0b1f42c | 251 | |
d40c2620 JG |
252 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
253 | check_trace_content -t 7 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
254 | |
255 | destroy_lttng_session_ok $SESSION_NAME | |
256 | ||
d40c2620 JG |
257 | rm -rf "$TRACE_PATH" |
258 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
259 | } |
260 | ||
261 | function test_epoll_pwait_invalid_ptr() | |
262 | { | |
a0b1f42c JD |
263 | SESSION_NAME="syscall_payload" |
264 | SYSCALL_LIST="epoll_pwait" | |
d40c2620 JG |
265 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
266 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
267 | |
268 | diag "epoll_pwait with invalid pointer, waits for input" | |
269 | ||
d40c2620 | 270 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
271 | |
272 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
273 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
274 | ||
275 | start_lttng_tracing_ok | |
d40c2620 | 276 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 8 |
a0b1f42c | 277 | stop_lttng_tracing_ok |
a0b1f42c | 278 | |
d40c2620 JG |
279 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
280 | check_trace_content -t 8 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
281 | |
282 | destroy_lttng_session_ok $SESSION_NAME | |
283 | ||
d40c2620 JG |
284 | rm -rf "$TRACE_PATH" |
285 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
286 | } |
287 | ||
288 | function test_epoll_pwait_int_max() | |
289 | { | |
a0b1f42c JD |
290 | SESSION_NAME="syscall_payload" |
291 | SYSCALL_LIST="epoll_pwait" | |
d40c2620 JG |
292 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
293 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
294 | |
295 | diag "epoll_pwait with maxevents set to INT_MAX, waits for input" | |
296 | ||
d40c2620 | 297 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
298 | |
299 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
300 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
301 | ||
302 | start_lttng_tracing_ok | |
d40c2620 | 303 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 9 |
a0b1f42c | 304 | stop_lttng_tracing_ok |
a0b1f42c | 305 | |
d40c2620 JG |
306 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
307 | check_trace_content -t 9 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
308 | |
309 | destroy_lttng_session_ok $SESSION_NAME | |
310 | ||
d40c2620 JG |
311 | rm -rf "$TRACE_PATH" |
312 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
313 | } |
314 | ||
315 | function test_ppoll_concurrent() | |
316 | { | |
a0b1f42c JD |
317 | SESSION_NAME="syscall_payload" |
318 | SYSCALL_LIST="ppoll" | |
d40c2620 JG |
319 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
320 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
321 | |
322 | diag "ppoll with concurrent updates of the structure from user-space, stress test (3000 iterations), waits for input + timeout 1ms" | |
323 | ||
d40c2620 | 324 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
325 | |
326 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
327 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
328 | ||
329 | start_lttng_tracing_ok | |
d40c2620 | 330 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 10 |
a0b1f42c | 331 | stop_lttng_tracing_ok |
a0b1f42c | 332 | |
d40c2620 JG |
333 | validate_trace "$SYSCALL_LIST" "$TRACE_PATH" |
334 | check_trace_content -t 10 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
335 | |
336 | destroy_lttng_session_ok $SESSION_NAME | |
337 | ||
d40c2620 JG |
338 | rm -rf "$TRACE_PATH" |
339 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
340 | } |
341 | ||
342 | function test_epoll_pwait_concurrent() | |
343 | { | |
a0b1f42c JD |
344 | SESSION_NAME="syscall_payload" |
345 | SYSCALL_LIST="epoll_ctl,epoll_pwait" | |
d40c2620 JG |
346 | TRACE_PATH=$(mktemp --tmpdir -d "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_trace_path.XXXXXX") |
347 | TEST_VALIDATION_OUTPUT_PATH=$(mktemp --tmpdir -u "tmp.test_kernel_select_poll_epoll_${FUNCNAME[0]}_validation.XXXXXX") | |
a0b1f42c JD |
348 | |
349 | diag "epoll_pwait with concurrent munmap of the buffer from user-space, should randomly segfault, run multiple times, waits for input + timeout 1ms" | |
350 | ||
d40c2620 | 351 | create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" |
a0b1f42c JD |
352 | |
353 | lttng_enable_kernel_syscall_ok $SESSION_NAME $SYSCALL_LIST | |
354 | add_context_kernel_ok $SESSION_NAME channel0 pid | |
355 | ||
356 | start_lttng_tracing_ok | |
357 | diag "Expect segfaults" | |
358 | for i in $(seq 1 100); do | |
d40c2620 | 359 | yes | "$CURDIR"/select_poll_epoll --validation-file "$TEST_VALIDATION_OUTPUT_PATH" -t 11 |
a0b1f42c | 360 | done |
a0b1f42c JD |
361 | stop_lttng_tracing_ok |
362 | ||
363 | # epoll_wait is not always generated in the trace (stress test) | |
d40c2620 JG |
364 | validate_trace "epoll_ctl" "$TRACE_PATH" |
365 | check_trace_content -t 11 --validation-file "$TEST_VALIDATION_OUTPUT_PATH" "$TRACE_PATH" 2>/dev/null | |
a0b1f42c JD |
366 | |
367 | destroy_lttng_session_ok $SESSION_NAME | |
368 | ||
d40c2620 JG |
369 | rm -rf "$TRACE_PATH" |
370 | rm -f "$TEST_VALIDATION_OUTPUT_PATH" | |
a0b1f42c JD |
371 | } |
372 | ||
373 | # MUST set TESTDIR before calling those functions | |
374 | plan_tests $NUM_TESTS | |
375 | ||
376 | print_test_banner "$TEST_DESC" | |
377 | ||
378 | if [ "$(id -u)" == "0" ]; then | |
379 | isroot=1 | |
380 | else | |
381 | isroot=0 | |
382 | fi | |
383 | ||
384 | skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || | |
385 | { | |
0159fa50 JR |
386 | validate_lttng_modules_present |
387 | ||
a0b1f42c JD |
388 | start_lttng_sessiond |
389 | ||
390 | test_working_cases | |
391 | test_timeout_cases | |
8b3b99e2 | 392 | test_pselect_invalid_fd |
a0b1f42c JD |
393 | test_big_ppoll |
394 | test_ppoll_overflow | |
395 | test_pselect_invalid_ptr | |
396 | test_ppoll_ulong_max | |
397 | test_epoll_pwait_invalid_ptr | |
398 | test_epoll_pwait_int_max | |
399 | test_ppoll_concurrent | |
400 | test_epoll_pwait_concurrent | |
401 | ||
402 | stop_lttng_sessiond | |
403 | ||
404 | NEW_WARNING=$(dmesg | grep " WARNING:" | cut -d' ' -f1 | tail -1) | |
405 | NEW_OOPS=$(dmesg | grep " OOPS:" | cut -d' ' -f1 | tail -1) | |
406 | NEW_BUG=$(dmesg | grep " BUG:" | cut -d' ' -f1 | tail -1) | |
407 | ||
408 | if test "$LAST_WARNING" != "$NEW_WARNING"; then | |
409 | fail "New WARNING generated" | |
410 | fi | |
411 | if test "$LAST_OOPS" != "$NEW_OOPS"; then | |
412 | fail "New OOPS generated" | |
413 | fi | |
414 | if test "$LAST_BUG" != "$NEW_BUG"; then | |
415 | fail "New BUG generated" | |
416 | fi | |
417 | } |