Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 1 | # rt_sigaction on ALPHA has 5 args: sig, act, oact, sigsetsize, restorer. |
| 2 | # rt_sigaction on SPARC has 5 args: sig, act, oact, restorer, sigsetsize. |
| 3 | # rt_sigaction on other architectures has 4 args: sig, act, oact, sigsetsize. |
| 4 | # Some architectures have SA_RESTORER, some don't; |
| 5 | # in particular, SPARC has and ALPHA hasn't. |
| 6 | # |
| 7 | # There are two regexps for each test: |
| 8 | # the 1st is for any architecture with SA_RESTORER, including SPARC; |
Mike Frysinger | 0189ff9 | 2014-08-09 09:32:20 -0400 | [diff] [blame] | 9 | # the 2nd is for any architecture without SA_RESTORER, including ALPHA; |
| 10 | # the 3rd is for any architecture without SA_RESTORER and swapped args. |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 11 | |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 12 | BEGIN { |
| 13 | lines = 5 |
| 14 | fail = 0 |
| 15 | } |
| 16 | |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 17 | # Test 1. |
Dmitry V. Levin | ed7ada2 | 2015-01-13 00:06:09 +0000 | [diff] [blame] | 18 | NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+\}, \{SIG_DFL, \[\], 0\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} |
| 19 | NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, \{SIG_DFL, \[\], 0\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} |
| 20 | NR == 1 && /^rt_sigaction\(SIGUSR2, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, \{SIG_DFL, \[\], 0\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 21 | |
| 22 | # Test 2. |
Dmitry V. Levin | ed7ada2 | 2015-01-13 00:06:09 +0000 | [diff] [blame] | 23 | NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+\}, \{SIG_IGN, \[HUP INT\], SA_RESTORER\|SA_RESTART, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} |
| 24 | NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} |
| 25 | NR == 2 && /^rt_sigaction\(SIGUSR2, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, \{SIG_IGN, \[HUP INT\], SA_RESTART\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 26 | |
| 27 | # Test 3. |
Dmitry V. Levin | ed7ada2 | 2015-01-13 00:06:09 +0000 | [diff] [blame] | 28 | NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_RESTORER\|SA_SIGINFO, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} |
| 29 | NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], 0\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} |
| 30 | NR == 3 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, \[\], 0\}, \{0x[0-9a-f]+, \[QUIT TERM\], SA_SIGINFO\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 31 | |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 32 | # Test 4. |
Dmitry V. Levin | ed7ada2 | 2015-01-13 00:06:09 +0000 | [diff] [blame] | 33 | NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], SA_RESTORER, 0x[0-9a-f]+\}, \{SIG_DFL, \[\], SA_RESTORER, 0x[0-9a-f]+\}, (0x[0-9a-f]+, )?(4|8|16)\) = 0$/ {next} |
| 34 | NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0\}, \{SIG_DFL, \[\], 0\}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} |
| 35 | NR == 4 && /^rt_sigaction\(SIGUSR2, \{SIG_DFL, ~\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\], 0\}, \{SIG_DFL, \[\], 0\}, 0x[0-9a-f]+, (4|8|16)\) = 0$/ {next} |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 36 | |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 37 | # The last line. |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 38 | NR == lines && /^\+\+\+ exited with 0 \+\+\+$/ {next} |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 39 | |
| 40 | { |
Dmitry V. Levin | b0c2a9d | 2014-02-08 00:37:48 +0000 | [diff] [blame] | 41 | print "Line " NR " does not match: " $0 |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 42 | fail=1 |
Dmitry V. Levin | 66a15a5 | 2014-01-07 19:32:32 +0000 | [diff] [blame] | 43 | } |
Dmitry V. Levin | b0c2a9d | 2014-02-08 00:37:48 +0000 | [diff] [blame] | 44 | |
| 45 | END { |
Dmitry V. Levin | 38593e9 | 2014-02-26 16:51:28 +0000 | [diff] [blame] | 46 | if (NR != lines) { |
| 47 | print "Expected " lines " lines, found " NR " line(s)." |
| 48 | print "" |
| 49 | exit 1 |
| 50 | } |
| 51 | if (fail) { |
| 52 | print "" |
Dmitry V. Levin | b0c2a9d | 2014-02-08 00:37:48 +0000 | [diff] [blame] | 53 | exit 1 |
| 54 | } |
| 55 | } |