summaryrefslogtreecommitdiffstats
path: root/tests/ts/lsfd/option-inet
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ts/lsfd/option-inet')
-rwxr-xr-xtests/ts/lsfd/option-inet98
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/ts/lsfd/option-inet b/tests/ts/lsfd/option-inet
new file mode 100755
index 0000000..011a9b3
--- /dev/null
+++ b/tests/ts/lsfd/option-inet
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# Copyright (C) 2023 Masatake YAMATO <yamato@redhat.com>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="--inet option"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+ts_skip_qemu_user
+ts_skip_docker
+
+ts_check_test_command "$TS_CMD_LSFD"
+ts_check_test_command "$TS_HELPER_MKFDS"
+
+ts_cd "$TS_OUTDIR"
+
+{
+ "$TS_HELPER_MKFDS" -q tcp 3 4 5 server-port=34567 client-port=23456 &
+ PID0=$!
+
+ "$TS_HELPER_MKFDS" -q tcp6 3 4 5 server-port=34567 client-port=23456 &
+ PID1=$!
+
+ "$TS_HELPER_MKFDS" -q ro-regular-file 3 file=/etc/passwd &
+ PID2=$!
+
+ "$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&
+ PID3=$!
+
+ "$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&
+ PID4=$!
+
+ OPT='--inet'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ OPT='--inet=4'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ OPT='--inet=6'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ OPT='-i'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ OPT='-i4'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ OPT='-i6'
+ echo "# $OPT"
+ ${TS_CMD_LSFD} -n \
+ $OPT \
+ -o ASSOC,TYPE,NAME \
+ -Q "(PID == $PID0) or (PID == $PID1) or (PID == $PID2) or (PID == $PID3) or (PID == $PID4)"
+
+ kill -CONT "${PID0}"
+ wait "${PID0}"
+
+ kill -CONT "${PID1}"
+ wait "${PID1}"
+
+ kill -CONT "${PID2}"
+ wait "${PID2}"
+} > "$TS_OUTPUT" 2>&1
+
+ts_finalize