3 # Check how strace -e signal=set works.
5 # Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
6 # Copyright (c) 2016-2018 The strace developers.
9 # SPDX-License-Identifier: GPL-2.0-or-later
11 . "${srcdir=.}/init.sh"
18 run_prog "../$NAME" "$@" > /dev/null
19 run_strace -e trace=none -e signal="$sigs" "../$NAME" "$@" > "$EXP"
20 match_diff "$LOG" "$EXP"
25 local first second sigs
30 test_one_sig "$sigs" 2 "$first" 15 "$second"
36 CHLD SIGCHLD ALRM SIGALRM \
37 chld sigchld alrm sigalrm \
38 CHLD,SIGALRM ALRM,SIGCHLD \
39 chld,sigalrm alrm,sigchld \
42 '!2,15' '!INT,TERM' '!SIGINT,TERM' '!INT,SIGTERM' '!SIGTERM,SIGINT' \
43 '!2,INT,TERM' '!2,SIGTERM' '!SIGINT,15' '!INT,SIGTERM,15' \
44 '!2,4,15' '!15,9,2,11,4'
48 CHLD,SIGINT SIGINT,SIGALRM \
49 chld,sigint sigint,sigalrm \
51 '!15' '!TERM' '!SIGTERM' \
52 '!15,TERM' '!SIGTERM,15,TERM' \
53 '!SIGALRM,TERM' '!CHLD,SIGTERM' \
54 '!ALRM,15' '!SIGCHLD,ALRM,SIGTERM,KILL' \
57 test_sigs '' SIGTERM \
59 CHLD,SIGTERM SIGTERM,SIGALRM \
60 chld,sigterm sigterm,sigalrm \
62 '!2' '!INT' '!SIGINT' \
63 '!2,INT' '!SIGINT,2,INT' \
64 '!SIGALRM,INT' '!CHLD,SIGINT' \
65 '!ALRM,2' '!SIGCHLD,ALRM,SIGINT,KILL' \
68 test_sigs SIGINT SIGTERM \
70 INT,TERM SIGINT,TERM SIGTERM,INT SIGINT,SIGTERM \
71 int,term sigint,term sigterm,int sigint,sigterm \
72 2,15 2,TERM SIGTERM,2 TERM,15,SIGINT,2 \
73 '!CHLD' '!SIGCHLD' '!ALRM' '!SIGALRM' \
74 '!CHLD,SIGALRM' '!ALRM,SIGCHLD' \
75 '!9' '!9,4' '!9,4,11' '!4,CHLD,11,ALRM,9'
79 dump_log_and_fail_with \
80 "strace -e signal=$* failed to handle an argument error properly"
83 for arg in ' ' invalid_signal_name SIG -1 256 1-1 \
84 1,2,4,8,16,32,64,128,256,512,1024 9,chdir; do
85 $STRACE -e signal="$arg" true 2> "$LOG" &&
87 LC_ALL=C grep -F 'invalid signal' < "$LOG" > /dev/null ||