]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/misc/waitpid
Merge branch 'waitpid--suppress-message' of https://github.com/masatake/util-linux
[thirdparty/util-linux.git] / tests / ts / misc / waitpid
1 #!/bin/bash
2
3 # Copyright (C) 2022 Thomas Weißschuh <thomas@t-8ch.de>
4 #
5 # This file is part of util-linux.
6 #
7 # This file is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
11 #
12 # This file is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 TS_TOPDIR="${0%/*}/../.."
18 TS_DESC="waitpid"
19
20 . "$TS_TOPDIR"/functions.sh
21 ts_init "$*"
22
23 ts_check_test_command "$TS_CMD_WAITPID"
24
25 ts_init_subtest normal
26
27 (sleep 0.2; echo 1 >> "$TS_OUTPUT") &
28 BG1="$!"
29
30 (sleep 0.1; echo 2 >> "$TS_OUTPUT") &
31 BG2="$!"
32
33 echo 3 >> "$TS_OUTPUT"
34 "$TS_CMD_WAITPID" "$BG1" "$BG2"
35 ts_skip_exitcode_not_supported
36
37 echo 4 >> "$TS_OUTPUT"
38
39 ts_finalize_subtest
40
41 ts_init_subtest timeout
42 "$TS_CMD_WAITPID" -v -t 0.1 1 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
43 echo $? >> "$TS_OUTPUT"
44 ts_finalize_subtest
45
46 ts_init_subtest exited
47 "$TS_CMD_WAITPID" -v -e 2147483647 >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
48 echo $? >> "$TS_ERRLOG"
49 ts_finalize_subtest
50
51 ts_init_subtest count
52 (sleep 0.2; echo 1 >> "$TS_OUTPUT") &
53 BG1="$!"
54
55 "$TS_CMD_WAITPID" -c 1 1 "$BG1" >> "$TS_OUTPUT" 2>> "$TS_ERRLOG"
56 echo $? >> "$TS_ERRLOG"
57 ts_finalize_subtest
58
59 ts_finalize