Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [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; |
| 9 | # the 2nd is for any architecture without SA_RESTORER, including ALPHA. |
| 10 | |
Elliott Hughes | 5a13922 | 2014-02-27 15:09:57 -0800 | [diff] [blame] | 11 | BEGIN { |
| 12 | lines = 5 |
| 13 | fail = 0 |
| 14 | } |
| 15 | |
Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 16 | # Test 1. |
| 17 | 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} |
| 18 | NR == 1 && /^rt_sigaction\(SIGUSR2, {SIG_IGN, \[HUP INT\], SA_RESTART}, {SIG_DFL, \[\], 0}, (4|8|16)(, 0x[0-9a-f]+)?\) = 0$/ {next} |
| 19 | |
| 20 | # Test 2. |
| 21 | 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} |
| 22 | 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} |
| 23 | |
| 24 | # Test 3. |
| 25 | 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} |
| 26 | 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} |
| 27 | |
Elliott Hughes | 5a13922 | 2014-02-27 15:09:57 -0800 | [diff] [blame] | 28 | # Test 4. |
| 29 | 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} |
| 30 | 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} |
| 31 | |
Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 32 | # The last line. |
Elliott Hughes | 5a13922 | 2014-02-27 15:09:57 -0800 | [diff] [blame] | 33 | NR == lines && /^\+\+\+ exited with 0 \+\+\+$/ {next} |
Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 34 | |
| 35 | { |
| 36 | print "Line " NR " does not match: " $0 |
Elliott Hughes | 5a13922 | 2014-02-27 15:09:57 -0800 | [diff] [blame] | 37 | fail=1 |
Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | END { |
Elliott Hughes | 5a13922 | 2014-02-27 15:09:57 -0800 | [diff] [blame] | 41 | if (NR != lines) { |
| 42 | print "Expected " lines " lines, found " NR " line(s)." |
| 43 | print "" |
| 44 | exit 1 |
| 45 | } |
| 46 | if (fail) { |
| 47 | print "" |
Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 48 | exit 1 |
| 49 | } |
| 50 | } |