summaryrefslogtreecommitdiff
path: root/tests/options-syntax.test
blob: 0f6f49b74ddc7ba0b683a224d7b680aa04dba9d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
#!/bin/sh
#
# Check strace options syntax.
#
# Copyright (c) 2016 Dmitry V. Levin <ldv@strace.io>
# Copyright (c) 2016-2023 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later

. "${srcdir=.}/syntax.sh"

compiled_with_secontext=$(get_config_option ENABLE_SECONTEXT "y")
compiled_with_stacktrace="$(get_config_option ENABLE_STACKTRACE 1)"

check_e "Invalid process id: '0'" -p 0
check_e "Invalid process id: '0'" --attach=0
check_e "Invalid process id: '-42'" -p -42
check_e "Invalid process id: '-42'" --attach=-42
check_e "Invalid process id: '$$.'" -p $$.
check_e "Invalid process id: '$$.'" --attach=$$.
check_e "Invalid process id: 'a'" -p 1,a
check_e "Invalid process id: 'a'" --attach=1,a
check_e "Syscall 'chdir' for -b isn't supported" -b chdir
check_e "Syscall 'chdir' for -b isn't supported" --detach-on=chdir
check_e "Syscall 'chdir' for -b isn't supported" -b execve -b chdir
check_e "Syscall 'chdir' for -b isn't supported" --detach-on=execve --detach-on=chdir

check_e_using_grep 'exec: File *name too long' "$(printf '%4096s' ' ')"

ff_name="$(printf '%4084s' ' ')"
check_e_using_grep "$ff_name: File *name too long" -ff -o "$ff_name" true
check_e_using_grep "$ff_name: File *name too long" -ff --output="$ff_name" true

check_h 'must have PROG [ARGS] or -p PID'
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=,
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=,s
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=s,
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=,,
check_h "must have PROG [ARGS] or -p PID" --absolute-timestamps=s,,none
check_h "must have PROG [ARGS] or -p PID" --timestamps --absolute-timestamps=ns --timestamps=none --absolute-timestamps=format:time,precision:s --timestamps=ns,format:unix --absolute-timestamps=us,precision:ms,unix,precision:ns --timestamps=format:none,time,precision:us
check_h "invalid --absolute-timestamps argument: 'ss'" --absolute-timestamps=ss
check_h "invalid --timestamps argument: 'format:s'" --timestamps=format:s
check_h "invalid --timestamps argument: 's,non'" --timestamps=s,non
check_h "invalid --timestamps argument: 'precision:none'" --timestamps=precision:none
check_e '-t and --absolute-timestamps cannot be provided simultaneously' -t --timestamps -p $$
check_e '-t and --absolute-timestamps cannot be provided simultaneously' --absolute-timestamps -ttt -p $$
check_e '-t and --absolute-timestamps cannot be provided simultaneously' -t --timestamps=ns -t -p $$
check_e '-t and --absolute-timestamps cannot be provided simultaneously' --timestamps=ns -t --absolute-timestamps=unix -p $$
if [ -n "$compiled_with_secontext" ]; then
	for opt in '--secontext' '-e secontext'; do
		check_e "invalid secontext ''" $opt=
		check_e "invalid secontext 'ss'" $opt=ss
		check_e "invalid secontext 'ss'" $opt=ss,full,mismatch
		check_e "invalid secontext 'ss'" $opt=full,ss,mismatch
		check_e "invalid secontext 'ss'" $opt=full,ss
		check_e "invalid secontext 'ss'" $opt=full,mismatch,ss
		check_e "invalid secontext 'ss'" $opt=!full,ss
		check_e "invalid secontext 'ss'" $opt=!full,mismatch,ss
	done
else
	for opt in '--secontext' '--secontext=full' '-e secontext=mismatch'; do
		check_e "SELinux context printing (--secontext option) is not supported by this build of strace" $opt
	done
fi

for opt in 'id' \
	   'id:' \
	   '-1' \
	   '2147483648' \
	   'id:rand' \
	   'id:randomm' \
	   '2,3,radomm,4' \
	   'format' \
	   'format:' \
	   'id:format' \
	   'id:format:full' \
	   'format:id:0'
do
	check_h "invalid --tips argument: '$opt'" --tips="$opt"
done
for opt in '--tips' \
	   '--tips=' \
	   '--tips=0' \
	   '--tips=id:0 --tips' \
	   '--tips=1,id:42' \
	   '--tips=1 --tips=id:42' \
	   '--tips=random' \
	   '--tips --tips=random' \
	   '--tips=id:random,23' \
	   '--tips=id:random,23 --tips=random,2,3,id:4,5' \
	   '--tips=format:none' \
	   '--tips=format:compact --tips' \
	   '--tips --tips=format:full,3,none,id:42,compact'
do
	check_h "invalid -a argument: '-42'" $opt -a -42
done

check_h 'PROG [ARGS] must be specified with -D/--daemonize' -D -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' -DD -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' -DDD -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' -DDDD -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' --daemonize -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' --daemonize=grandchild -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' --daemonize=pgroup -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' --daemonize=Pgrp -p $$
check_h 'PROG [ARGS] must be specified with -D/--daemonize' --daemonize=SESSION -p $$
check_h 'Too many -D'\''s (4), maximum supported -D count is 3' -DDDD /bin/true
check_e '-D and --daemonize cannot be provided simultaneously' -D --daemonize -p $$
check_e '-D and --daemonize cannot be provided simultaneously' --daemonize -D -p $$
check_e '-D and --daemonize cannot be provided simultaneously' --daemonize -v -D /bit/true
check_h "invalid --daemonize argument: 'pgr'" --daemonize=pgr
check_h '-c/--summary-only and -C/--summary are mutually exclusive' -c -C true
check_h '-c/--summary-only and -C/--summary are mutually exclusive' --summary-only --summary true
check_h '-c/--summary-only and -C/--summary are mutually exclusive' -C -c true
check_h '-c/--summary-only and -C/--summary are mutually exclusive' --summary --summary-only true
check_h '(-c/--summary-only or -C/--summary) and -ff/--output-separately are mutually exclusive' -c -ff true
check_h '(-c/--summary-only or -C/--summary) and -ff/--output-separately are mutually exclusive' --summary-only -ff true
check_h '(-c/--summary-only or -C/--summary) and -ff/--output-separately are mutually exclusive' -C -ff true
check_h '(-c/--summary-only or -C/--summary) and -ff/--output-separately are mutually exclusive' --summary -ff true
check_h '-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' -w true
check_h '-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' --summary-wall-clock true
check_h '-U/--summary-columns must be given with (-c/--summary-only or -C/--summary)' -U name,time,count,errors true
check_h '-U/--summary-columns must be given with (-c/--summary-only or -C/--summary)' --summary-columns=name,time,count,errors true
check_h 'piping the output and -ff/--output-separately are mutually exclusive' -o '|' -ff true
check_h 'piping the output and -ff/--output-separately are mutually exclusive' --output='|' -ff true
check_h 'piping the output and -ff/--output-separately are mutually exclusive' -o '!' -ff true
check_h 'piping the output and -ff/--output-separately are mutually exclusive' --output='!' -ff true
check_h "invalid -a argument: '-42'" -a -42
check_h "invalid -O argument: '-42'" -O -42
check_h "invalid -s argument: '-42'" -s -42
check_h "invalid --string-limit argument: '-42'" --string-limit=-42
check_h "invalid -s argument: '1073741824'" -s 1073741824
check_h "invalid --string-limit argument: '1073741824'" --string-limit=1073741824
check_h "must have PROG [ARGS] or -p PID" --follow-forks
check_h "must have PROG [ARGS] or -p PID" --follow-forks --output-separately
check_h "must have PROG [ARGS] or -p PID" -f --output-separately
check_h "must have PROG [ARGS] or -p PID" --output-separately
check_e '-f and --follow-forks cannot be provided simultaneously' -f --follow-forks -p $$
check_e '-ff and --output-separately cannot be provided simultaneously' --output-separately -ff -p $$
check_h "invalid -I argument: '0x1'" -I 0x1
check_h "invalid -I argument: '0'" -I 0
check_h "must have PROG [ARGS] or -p PID" -I1
check_h "must have PROG [ARGS] or -p PID" -I 2
check_h "must have PROG [ARGS] or -p PID" -I3
check_h "must have PROG [ARGS] or -p PID" -I 4
check_h "invalid -I argument: '5'" -I 5
check_h "must have PROG [ARGS] or -p PID" -I always
check_h "must have PROG [ARGS] or -p PID" -I anywhere
check_h "must have PROG [ARGS] or -p PID" -Iwaiting
check_h "must have PROG [ARGS] or -p PID" -I never
check_h "must have PROG [ARGS] or -p PID" -Inever_tstp
check_h "invalid -I argument: '=never'" -I=never
check_h "invalid -I argument: 'nevertheless'" -Inevertheless
check_h "invalid -I argument: 'nev'" -Inev
check_h "invalid --interruptible argument: '0x1'" --interruptible=0x1
check_h "invalid --interruptible argument: '0'" --interruptible=0
check_h "must have PROG [ARGS] or -p PID" --interruptible 1
check_h "must have PROG [ARGS] or -p PID" --interruptible=2
check_h "invalid --interruptible argument: '5'" --interruptible=5
check_h "must have PROG [ARGS] or -p PID" --interruptible=anywhere
check_h "must have PROG [ARGS] or -p PID" --interruptible=waiting
check_h "must have PROG [ARGS] or -p PID" --interruptible=never
check_h "must have PROG [ARGS] or -p PID" --interruptible=never_tstp
check_h "invalid --interruptible argument: 'nevertheless'" --interruptible=nevertheless
check_h "invalid --interruptible argument: 'nev'" --interruptible=nev
check_h "must have PROG [ARGS] or -p PID" --relative-timestamps
check_h "must have PROG [ARGS] or -p PID" --relative-timestamps=s
check_h "must have PROG [ARGS] or -p PID" --relative-timestamps=ms
check_h "must have PROG [ARGS] or -p PID" --relative-timestamps=us
check_h "must have PROG [ARGS] or -p PID" --relative-timestamps=ns
check_h "invalid --relative-timestamps argument: 'n'" --relative-timestamps=n
check_h "invalid --relative-timestamps argument: 'ss'" --relative-timestamps=ss
check_h "must have PROG [ARGS] or -p PID" --syscall-times
check_h "must have PROG [ARGS] or -p PID" --syscall-times=s
check_h "must have PROG [ARGS] or -p PID" --syscall-times=ms
check_h "must have PROG [ARGS] or -p PID" --syscall-times=us
check_h "must have PROG [ARGS] or -p PID" --syscall-times=ns
check_h "invalid --syscall-times argument: 'n'" --syscall-times=n
check_h "invalid --syscall-times argument: 'ss'" --syscall-times=ss
check_h "must have PROG [ARGS] or -p PID" --strings-in-hex
check_h "must have PROG [ARGS] or -p PID" --strings-in-hex=all
check_h "must have PROG [ARGS] or -p PID" --strings-in-hex=non-ascii
check_h "invalid --strings-in-hex argument: 'al'" --strings-in-hex=al
check_h "invalid --strings-in-hex argument: 'alll'" --strings-in-hex=alll
check_h "invalid --strings-in-hex argument: 'ascii'" --strings-in-hex=ascii
check_h "invalid --syscall-limit argument: '-5'" --syscall-limit -5
check_h "invalid --syscall-limit argument: '0'" --syscall-limit=0
check_h "must have PROG [ARGS] or -p PID" --syscall-limit=2
check_h "must have PROG [ARGS] or -p PID" --syscall-limit 5
check_h "must have PROG [ARGS] or -p PID" --quiet=all
check_h "must have PROG [ARGS] or -p PID" --quiet=none
check_h "must have PROG [ARGS] or -p PID" --quiet=\!attach
check_h "must have PROG [ARGS] or -p PID" --quiet=exit,exits,personality
check_e "invalid quiet 'detach'" --quiet=detach -p $$
check_e "invalid quiet 'fds'" -q --quiet=fds -p $$
check_e "invalid quiet 'detach'" --quiet=detach -p $$
check_e '-q and -e quiet/--quiet cannot be provided simultaneously' -q --quiet -p $$
check_e '-q and -e quiet/--quiet cannot be provided simultaneously' -q -e q=none -p $$
check_e '-q and -e quiet/--quiet cannot be provided simultaneously' -q -e silent=attach,personality -p $$

check_h 'must have PROG [ARGS] or -p PID' -P .
check_h 'must have PROG [ARGS] or -p PID' -P . -P..
check_h 'must have PROG [ARGS] or -p PID' --trace-path=.
check_h 'must have PROG [ARGS] or -p PID' --trace-path=. --trace-path ..
check_e "Requested path \"///\" resolved into \"/\"
$STRACE_EXE: Requested path \"/.\" resolved into \"/\"
$STRACE_EXE: -q and -e quiet/--quiet cannot be provided simultaneously" -q --quiet -P /// -P/. .

for i in time time_percent time-percent time_total time-total total_time total-time min_time min-time time_min time-min shortest max_time max-time time_max time-max longest avg_time avg-time time_avg time-avg calls count error errors name syscall syscall_name syscall-name none nothing; do
	check_h "must have PROG [ARGS] or -p PID" -S "$i"
	check_h "must have PROG [ARGS] or -p PID" --summary-sort-by="$i"
	if [ "x$i" != xnone -a "x$i" != xnothing ]; then
		check_h "must have PROG [ARGS] or -p PID" -c -U "$i"
		check_h "must have PROG [ARGS] or -p PID" --summary-only --summary-columns="$i"
	fi
done
for i in time,time_total,avg_time,calls,errors,name time_percent,total_time,time_avg,count,error,syscall_name; do
	check_h "must have PROG [ARGS] or -p PID" -c -U "$i"
	check_h "must have PROG [ARGS] or -p PID" --summary-only --summary-columns="$i"
done
for i in non syscall_names; do
	check_h "invalid sortby: '$i'" -S "$i"
	check_h "invalid sortby: '$i'" --summary-sort-by="$i"
	check_h "unknown column name: '$i'" -U "$i"
	check_h "unknown column name: '$i'" --summary-columns="$i"
done
check_h "unknown column name: ''" -U time,,name
check_h "call summary column has been provided more than once: 'time_percent' (-U option residual: 'time_percent,time_total')" -U time,time_percent,time_total

check_e '-x and --strings-in-hex cannot be provided simultaneously' -x --strings-in-hex -p $$
check_e '-x and --strings-in-hex cannot be provided simultaneously' --strings-in-hex -p $$ -xx
check_h "invalid -X argument: 'test'" -Xtest
check_h "invalid --const-print-style argument: 'test'" --const-print-style=test
check_h "invalid -X argument: 'a'" -Xa
check_h "invalid --const-print-style argument: 'a'" --const-print-style=a
check_h "invalid -X argument: 'abbreviated'" -X abbreviated
check_h "invalid --const-print-style argument: 'abbreviated'" --const-print-style=abbreviated
check_h "must have PROG [ARGS] or -p PID" --decode-fds
check_h "must have PROG [ARGS] or -p PID" --decode-fds=all
check_h "must have PROG [ARGS] or -p PID" --decode-fds=none
check_h "must have PROG [ARGS] or -p PID" --decode-fds=path
check_h "must have PROG [ARGS] or -p PID" --decode-fds=socket,dev
check_h "must have PROG [ARGS] or -p PID" --decode-fds=\!path
check_h "must have PROG [ARGS] or -p PID" --decode-fds=socket,path,dev
check_e "invalid decode-fds 'p'" --decode-fds=p -p $$
check_e "invalid decode-fds 'device'" -y --decode-fds=device -p $$
check_e "invalid decode-fds 'name'" --decode-fds=path,name -p $$
check_e "invalid decode-fds 'sock'" -e decode-fd=sock -y -p $$
check_e '-y and --decode-fds cannot be provided simultaneously' -y --decode-fds -p $$
check_e '-y and --decode-fds cannot be provided simultaneously' -e decode-fd=all -yy -p $$
check_e '-y and --decode-fds cannot be provided simultaneously' --decode-fds=none -y -p $$

check_h "incorrect personality designator '' in qualification 'getcwd@'" -e trace=getcwd@
check_h "incorrect personality designator '42' in qualification 'getcwd@42'" -e trace=getcwd@42
check_h "incorrect personality designator '42' in qualification 'getcwd@42'" -e trace=gettid,getcwd@42
check_h "incorrect personality designator '42' in qualification '23@42'" -e trace=23@42,123
check_h "incorrect personality designator 'ohmy' in qualification '/getcwd@ohmy'" \
	-e trace=/getcwd@ohmy

check_h '--seccomp-bpf cannot be used without -f/--follow-forks, disabling
-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' --seccomp-bpf -w /
check_h '--seccomp-bpf is not enabled for processes attached with -p
-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' --seccomp-bpf -f -p 1 -w

check_h 'option -F is deprecated, please use -f/--follow-forks instead
-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' -F -w /
check_h 'option -F is deprecated, please use -f/--follow-forks instead
-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' -FF -w /
check_h 'deprecated option -F ignored
-w/--summary-wall-clock must be given with (-c/--summary-only or -C/--summary)' -fF -w /

check_e "invalid -e kvm= argument: 'chdir'" -e kvm=chdir
check_e "invalid -e kvm= argument: 'chdir'" --kvm=chdir

check_h "must have PROG [ARGS] or -p PID" -e decode-pid=all
check_h "must have PROG [ARGS] or -p PID" --decode-pid=none
check_h "must have PROG [ARGS] or -p PID" -e decode-pids=comm
check_h "must have PROG [ARGS] or -p PID" --decode-pid=pidns,comm
check_h "must have PROG [ARGS] or -p PID" -e decode-pid=\!pidns
check_h "must have PROG [ARGS] or -p PID" --decode-pids=\!comm,pidns
check_h "must have PROG [ARGS] or -p PID" -Y -e decode-pids=\!comm,pidns
check_h "must have PROG [ARGS] or -p PID" --decode-pids=\!comm,pidns -Y
check_h "must have PROG [ARGS] or -p PID" --pidns-translation -e decode-pids=\!comm,pidns -Y
check_h "must have PROG [ARGS] or -p PID" --decode-pids=\!comm,pidns --pidns-translation
check_e "invalid decode-pids ''" --decode-pids=
check_e "invalid decode-pids ''" -e decode-pids=
check_e "invalid decode-pids 'chdir'" --decode-pids=chdir
check_e "invalid decode-pids 'gettid'" -e decode-pid=comm,gettid

check_h "must have PROG [ARGS] or -p PID" -e trace-fds=0
check_h "must have PROG [ARGS] or -p PID" -e trace-fd=1,2,3
check_h "must have PROG [ARGS] or -p PID" -e fd='!1'
check_h "must have PROG [ARGS] or -p PID" -e fds='!0,2147483647'
check_e "invalid descriptor '-1'" --trace-fds=-1
check_e "invalid descriptor '2147483648'" --trace-fd=2147483648

case "$STRACE_NATIVE_ARCH" in
x86_64)
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@64
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@32
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@x32
	;;
x32)
	check_h "incorrect personality designator '64' in qualification 'getcwd@64'" -e trace=getcwd@64
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@32
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@x32
	;;
aarch64|powerpc64|s390x|sparc64|tile)
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@64
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@32
	check_h "incorrect personality designator 'x32' in qualification 'getcwd@x32'" -e trace=getcwd@x32
	;;
*)
	pers="$((SIZEOF_LONG * 8))"
	inv_pers="$((96 - pers))"
	check_h "must have PROG [ARGS] or -p PID" -e trace=getcwd@"$pers"
	check_h "incorrect personality designator '$inv_pers' in qualification 'getcwd@$inv_pers'" -e trace=getcwd@"$inv_pers"
	check_h "incorrect personality designator 'x32' in qualification 'getcwd@x32'" -e trace=getcwd@x32
esac

../zeroargc "$STRACE_EXE" /bin/true 2> "$LOG" &&
	dump_log_and_fail_with \
		'zeroargc strace failed to handle the error properly'
cat > "$EXP" << __EOF__
$STRACE_EXE: must have PROG [ARGS] or -p PID
Try '$STRACE_EXE -h' for more information.
__EOF__
diff -u -- "$EXP" "$LOG" > /dev/null || {
	cat > "$EXP" <<- '__EOF__'
	strace: must have PROG [ARGS] or -p PID
	Try 'strace -h' for more information.
	__EOF__
	match_diff "$LOG" "$EXP" \
		"zeroargc $STRACE $args output mismatch"
}

uid="${UID:-`id -u`}"
if [ "$uid" -ge 0 ]; then
	if [ "$uid" -eq 0 ]; then
		umsg="Cannot find user ':nosuchuser:'"
	else
		umsg='You must be root to use the -u/--username option'
	fi

	check_e "$umsg" -u :nosuchuser: true

	for c in i/--instruction-pointer n/--syscall-number r/--relative-timestamps t/--absolute-timestamps T/--syscall-times y/--decode-fds; do
		check_e "-$c has no effect with -c/--summary-only
$STRACE_EXE: $umsg" -u :nosuchuser: -c -${c%%/*} true
	done

	check_e "-i/--instruction-pointer has no effect with -c/--summary-only
$STRACE_EXE: -n/--syscall-number has no effect with -c/--summary-only
$STRACE_EXE: -r/--relative-timestamps has no effect with -c/--summary-only
$STRACE_EXE: -t/--absolute-timestamps has no effect with -c/--summary-only
$STRACE_EXE: -T/--syscall-times has no effect with -c/--summary-only
$STRACE_EXE: -y/--decode-fds has no effect with -c/--summary-only
$STRACE_EXE: Only the last of -z/--successful-only/-Z/--failed-only options will take effect. See status qualifier for more complex filters.
$STRACE_EXE: $umsg" -u :nosuchuser: -cinrtTyzZ true

	if [ -n "$compiled_with_secontext" ]; then
		check_e "--secontext has no effect with -c/--summary-only
$STRACE_EXE: $umsg" -u :nosuchuser: -c --secontext true
	else
		check_e "SELinux context printing (--secontext option) is not supported by this build of strace" -c --secontext true
	fi

	if [ -n "$compiled_with_stacktrace" ]; then
		check_e "-k/--stack-traces has no effect with -c/--summary-only
$STRACE_EXE: $umsg" -u :nosuchuser: -c -k true
	fi

	for c in --output-separately -A/--output-append-mode; do
		check_e "$c has no effect without -o/--output
$STRACE_EXE: $umsg" -u :nosuchuser: ${c%%/*} true
	done

	check_e "-S/--summary-sort-by has no effect without (-c/--summary-only or -C/--summary)
$STRACE_EXE: $umsg" -u :nosuchuser: --summary-sort-by errors true

	check_e "--output-separately has no effect without -o/--output
$STRACE_EXE: -A/--output-append-mode has no effect without -o/--output
$STRACE_EXE: $umsg" -u :nosuchuser: --output-separately --output-append-mode true

	check_e "$umsg" -u :nosuchuser: -ff true
	check_e "$umsg" -u :nosuchuser: --output-separately --follow-forks true

	check_e "Only the last of -z/--successful-only/-Z/--failed-only options will take effect. See status qualifier for more complex filters.
$STRACE_EXE: $umsg" -u :nosuchuser: -z --successful-only true
	check_e "Only the last of -z/--successful-only/-Z/--failed-only options will take effect. See status qualifier for more complex filters.
$STRACE_EXE: $umsg" -u :nosuchuser: --successful-only -Z true
	check_e "Only the last of -z/--successful-only/-Z/--failed-only options will take effect. See status qualifier for more complex filters.
$STRACE_EXE: $umsg" -u :nosuchuser: --successful-only --failed-only true

	check_e "-n/--syscall-number has no effect with -c/--summary-only
$STRACE_EXE: $umsg" --user=:nosuchuser: --syscall-number --summary-only true

	check_e "-i/--instruction-pointer has no effect with -c/--summary-only
$STRACE_EXE: $umsg" --user=:nosuchuser: --instruction-pointer --summary-only true
fi

check_e_using_grep 'ptrace_setoptions = 0x[[:xdigit:]]+' -d /
check_e_using_grep 'ptrace_setoptions = 0x[[:xdigit:]]+' --debug /

if [ -z "$compiled_with_stacktrace" ]; then
	check_e "Stack traces (-k/--stack-traces option) are not supported by this build of strace" -k
	check_e "Stack traces (-k/--stack-traces option) are not supported by this build of strace" --stack-traces
fi

args='-p 2147483647'
$STRACE $args 2> "$LOG" &&
	dump_log_and_fail_with \
		"strace $args failed to handle the error properly"

for cmd in PTRACE_SEIZE PTRACE_ATTACH; do
	cat > "$EXP" << __EOF__
$STRACE_EXE: attach: ptrace($cmd, 2147483647): No such process
__EOF__
	diff -- "$EXP" "$LOG" ||
		continue
	args=
	break
done

[ -z "$args" ] ||
	dump_log_and_fail_with \
		"strace $args failed to print expected diagnostics"