]>
Commit | Line | Data |
---|---|---|
2556c387 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="all_processes" | |
17 | ||
18 | . "$TS_TOPDIR/functions.sh" | |
19 | ts_init "$*" | |
20 | ||
21 | ts_skip_nonroot | |
22 | ||
2fadcded KZ |
23 | # make sure we do not use shell built-in command |
24 | if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then | |
25 | TS_CMD_KILL="/bin/kill" | |
26 | fi | |
27 | ||
2556c387 SK |
28 | ts_check_test_command "$TS_CMD_KILL" |
29 | ts_check_test_command "$TS_HELPER_SIGRECEIVE" | |
30 | ||
7a1c980c KZ |
31 | . "$TS_SELF/kill_functions.sh" |
32 | ||
48f9e0b2 RM |
33 | HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/alXXXXXXXXXXXXX")" |
34 | ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK" | |
2556c387 SK |
35 | |
36 | "$HELPER_SYMLINK" -s "$TS_TESTUSER" >> "$TS_OUTPUT" 2>&1 & | |
37 | TEST_PID=$! | |
38 | ||
7a1c980c KZ |
39 | check_test_sigreceive $TEST_PID |
40 | [ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT" | |
41 | ||
2556c387 SK |
42 | echo "test 1" >> "$TS_OUTPUT" |
43 | "$TS_CMD_KILL" ${HELPER_SYMLINK##*/} >> "$TS_OUTPUT" 2>&1 | |
44 | if [ $? -ne 1 ]; then | |
45 | echo "kill did not return 1" >> "$TS_OUTPUT" | |
46 | fi | |
be8d50fe | 47 | |
2556c387 SK |
48 | echo "test 2" >> "$TS_OUTPUT" |
49 | "$TS_CMD_KILL" -a ${HELPER_SYMLINK##*/} >> "$TS_OUTPUT" 2>&1 | |
50 | if [ $? -ne 0 ]; then | |
51 | echo "kill did not return 0" >> "$TS_OUTPUT" | |
52 | fi | |
be8d50fe RM |
53 | wait $TEST_PID |
54 | ||
2556c387 SK |
55 | echo "test 3" >> "$TS_OUTPUT" |
56 | "$TS_CMD_KILL" -a -p ${HELPER_SYMLINK##*/} >> "$TS_OUTPUT" 2>&1 | |
57 | if [ $? -ne 1 ]; then | |
58 | echo "kill -a -p did not return 1" >> "$TS_OUTPUT" | |
59 | fi | |
60 | ||
61 | sed -i "s/${HELPER_SYMLINK##*/}/${TS_HELPER_SIGRECEIVE##*/}/" "$TS_OUTPUT" | |
62 | ||
48f9e0b2 RM |
63 | rm -f "$HELPER_SYMLINK" |
64 | ||
2556c387 | 65 | ts_finalize |