]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/lsfd/option-inet
lsfd: skip test option-inet in qemu-user
[thirdparty/util-linux.git] / tests / ts / lsfd / option-inet
1 #!/bin/bash
2 #
3 # Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com>
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="--inet option"
19
20 . "$TS_TOPDIR"/functions.sh
21 ts_init "$*"
22 ts_skip_qemu_user
23
24 ts_check_test_command "$TS_CMD_LSFD"
25 ts_check_test_command "$TS_HELPER_MKFDS"
26
27 ts_cd "$TS_OUTDIR"
28
29 {
30 "$TS_HELPER_MKFDS" -q tcp 3 4 5 server-port=34567 client-port=23456 &
31 PID0=$!
32
33 "$TS_HELPER_MKFDS" -q tcp6 3 4 5 server-port=34567 client-port=23456 &
34 PID1=$!
35
36 "$TS_HELPER_MKFDS" -q ro-regular-file 3 file=/etc/passwd &
37 PID2=$!
38
39 "$TS_HELPER_MKFDS" -q udp 3 4 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1&
40 PID3=$!
41
42 "$TS_HELPER_MKFDS" -q udp6 3 4 lite=1 server-port=34567 client-port=23456 server-do-bind=1 client-do-bind=1 client-do-connect=1&
43 PID4=$!
44
45 OPT='--inet'
46 echo "# $OPT"
47 ${TS_CMD_LSFD} -n \
48 $OPT \
49 -o ASSOC,TYPE,NAME \
50 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
51
52 OPT='--inet=4'
53 echo "# $OPT"
54 ${TS_CMD_LSFD} -n \
55 $OPT \
56 -o ASSOC,TYPE,NAME \
57 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
58
59 OPT='--inet=6'
60 echo "# $OPT"
61 ${TS_CMD_LSFD} -n \
62 $OPT \
63 -o ASSOC,TYPE,NAME \
64 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
65
66 OPT='-i'
67 echo "# $OPT"
68 ${TS_CMD_LSFD} -n \
69 $OPT \
70 -o ASSOC,TYPE,NAME \
71 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
72
73 OPT='-i4'
74 echo "# $OPT"
75 ${TS_CMD_LSFD} -n \
76 $OPT \
77 -o ASSOC,TYPE,NAME \
78 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
79
80 OPT='-i6'
81 echo "# $OPT"
82 ${TS_CMD_LSFD} -n \
83 $OPT \
84 -o ASSOC,TYPE,NAME \
85 -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
86
87 kill -CONT "${PID0}"
88 wait "${PID0}"
89
90 kill -CONT "${PID1}"
91 wait "${PID1}"
92
93 kill -CONT "${PID2}"
94 wait "${PID2}"
95 } > "$TS_OUTPUT" 2>&1
96
97 ts_finalize