]> granicus.if.org Git - strace/blob - tests/qual_fault-syntax.test
Update copyright headers
[strace] / tests / qual_fault-syntax.test
1 #!/bin/sh
2 #
3 # Check -e fault= syntax.
4 #
5 # Copyright (c) 2016-2018 Dmitry V. Levin <ldv@altlinux.org>
6 # All rights reserved.
7 #
8 # SPDX-License-Identifier: GPL-2.0-or-later
9
10 . "${srcdir=.}/init.sh"
11
12 #
13 # F
14 # F+
15 # F+S
16
17 fail_with()
18 {
19         dump_log_and_fail_with \
20                 "strace -e fault=$* failed to handle an argument error properly"
21 }
22
23 for arg in chdir:42 \!chdir:42 \
24            chdir:42:when=7 \
25            chdir:invalid \
26            chdir:invalid:when=8 \
27            chdir:error= \
28            chdir:error=:when=10 \
29            chdir:error=invalid_error_name \
30            chdir:error=invalid_error_name:when=11 \
31            chdir:error=-1 \
32            chdir:error=-1:when=12 \
33            chdir:error=-2 \
34            chdir:error=-2:when=13 \
35            chdir:error=3+ \
36            chdir:error=3+:when=14 \
37            chdir:error=4096 \
38            chdir:error=4096:when=15 \
39            chdir:when=7:error=invalid_error_name \
40            chdir:when= \
41            chdir:when=:error=19 \
42            chdir:when=0 \
43            chdir:when=0:error=20 \
44            chdir:when=-1 \
45            chdir:when=-1:error=21 \
46            chdir:when=-2+ \
47            chdir:when=-2+:error=22 \
48            chdir:when=-3+0 \
49            chdir:when=-3+0:error=23 \
50            chdir:when=4- \
51            chdir:when=4-:error=24 \
52            chdir:when=5+- \
53            chdir:when=5+-:error=25 \
54            chdir:when=6++ \
55            chdir:when=6++:error=26 \
56            chdir:when=7+0 \
57            chdir:when=7+0:error=27 \
58            chdir:when=8+-1 \
59            chdir:when=8+-1:error=28 \
60            chdir:when=9+1+ \
61            chdir:when=9+1+:error=29 \
62            chdir:when=65536 \
63            chdir:when=65536:error=30 \
64            chdir:when=1+65536 \
65            chdir:when=1+65536:error=31 \
66            chdir:retval=0 \
67            chdir:signal=1 \
68            chdir:error=1:error=2 \
69            chdir:syscall=invalid \
70            chdir:syscall=chdir \
71            chdir:syscall=%file \
72            chdir:syscall=-42 \
73            chdir:syscall=42 \
74            chdir:syscall=gettid:syscall=gettid \
75            ; do
76         $STRACE -e fault="$arg" true 2> "$LOG" &&
77                 fail_with "$arg"
78         LC_ALL=C grep -F 'invalid fault argument' < "$LOG" > /dev/null ||
79                 fail_with "$arg"
80 done
81
82 exit 0