]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tests/ts/kill/queue
tests: (kill) do not use shell build-in
[thirdparty/util-linux.git] / tests / ts / kill / queue
CommitLineData
558445c9
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
15TS_TOPDIR="${0%/*}/../.."
16TS_DESC="queue"
17
18. "$TS_TOPDIR/functions.sh"
19ts_init "$*"
20
2fadcded
KZ
21# make sure we do not use shell built-in command
22if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
23 TS_CMD_KILL="/bin/kill"
24fi
25
558445c9
SK
26ts_check_test_command "$TS_CMD_KILL"
27ts_check_test_command "$TS_HELPER_SIGRECEIVE"
28
29. "$TS_SELF/kill_functions.sh"
30
31all_ok=true
32
33HELPER_SYMLINK="$(mktemp "${TS_OUTDIR}/quXXXXXXXXXXXXX")"
34ln -sf "$TS_HELPER_SIGRECEIVE" "$HELPER_SYMLINK"
35
36"$HELPER_SYMLINK" >> "$TS_OUTPUT" 2>&1 &
37TEST_PID=$!
38check_test_sigreceive $TEST_PID
39[ $? -eq 1 ] || echo "${HELPER_SYMLINK##*/} helper did not start" >> "$TS_OUTPUT"
40
41"$TS_CMD_KILL" -1 --queue 42 $TEST_PID >> "$TS_OUTPUT" 2>&1
42if [ $? -ne 0 ]; then
43 echo "kill --queue 42 failed" >> "$TS_OUTPUT"
44 all_ok=false
45fi
46wait $TEST_PID
47if [ $? -ne 42 ]; then
48 echo "wait $TEST_PID returned $? instead of 42" >> "$TS_OUTPUT"
49 all_ok=false
50fi
51
52if $all_ok; then
53 echo 'all ok' >> "$TS_OUTPUT"
54fi
55
56rm -f "$HELPER_SYMLINK"
57
58ts_finalize