]>
Commit | Line | Data |
---|---|---|
d39182c1 SK |
1 | #!/bin/bash |
2 | ||
3 | # This file is part of util-linux. | |
4 | # | |
5 | # This file is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 2 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This file is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | ||
15 | TS_TOPDIR="${0%/*}/../.." | |
16 | TS_DESC="name_to_number" | |
17 | ||
18 | . "$TS_TOPDIR/functions.sh" | |
19 | ts_init "$*" | |
20 | ||
2fadcded KZ |
21 | # make sure we do not use shell built-in command |
22 | if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then | |
23 | TS_CMD_KILL="/bin/kill" | |
24 | fi | |
25 | ||
d39182c1 SK |
26 | ts_check_test_command "$TS_CMD_KILL" |
27 | ts_check_test_command "$TS_HELPER_SIGRECEIVE" | |
28 | ||
7a1c980c KZ |
29 | . "$TS_SELF/kill_functions.sh" |
30 | ||
d39182c1 | 31 | all_ok=true |
48f9e0b2 RM |
32 | |
33 | HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/naXXXXXXXXXXXXX")" | |
34 | ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK" | |
d39182c1 SK |
35 | |
36 | for SIG in $($TS_CMD_KILL -L); do | |
37 | if [ "x${SIG//[0-9]/}" = "x" ]; then | |
38 | EXPECTED=$SIG | |
39 | continue | |
40 | fi | |
883b8def SK |
41 | if [ -f "$ASAN_SYMBOLIZER_PATH" ] && [ "x$SIG" = "xSEGV" ]; then |
42 | continue | |
43 | fi | |
d39182c1 SK |
44 | if [ "x$SIG" = "xSTOP" ] || [ "x$SIG" = "xKILL" ]; then |
45 | continue | |
46 | fi | |
47 | if [ "x$SIG" = "xRTMIN" ]; then | |
48 | SIG="$SIG+0" | |
49 | fi | |
50 | if [ "x$SIG" = "xRTMAX" ]; then | |
51 | SIG="$SIG-0" | |
52 | fi | |
7a1c980c | 53 | |
d39182c1 SK |
54 | "$HELPER_SYMLINK" >> "$TS_OUTPUT" 2>&1 & |
55 | TEST_PID=$! | |
7a1c980c KZ |
56 | check_test_sigreceive $TEST_PID |
57 | [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT" | |
58 | ||
d39182c1 SK |
59 | "$TS_CMD_KILL" -$SIG ${HELPER_SYMLINK##*/} >> "$TS_OUTPUT" 2>&1 |
60 | wait $TEST_PID | |
61 | if [ $? -ne $EXPECTED ]; then | |
62 | echo "$SIG returned $? while $EXPECTED was expected" >> "$TS_OUTPUT" | |
63 | all_ok=false | |
64 | fi | |
65 | done | |
66 | ||
67 | if $all_ok; then | |
48f9e0b2 | 68 | echo 'all ok' >> "$TS_OUTPUT" |
d39182c1 SK |
69 | fi |
70 | rm -f "$HELPER_SYMLINK" | |
71 | ||
72 | ts_finalize |