All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/4] net/multicast: Remove duplicity
Date: Fri,  5 Feb 2021 16:10:14 +0100	[thread overview]
Message-ID: <20210205151015.7465-3-pvorel@suse.cz> (raw)
In-Reply-To: <20210205151015.7465-1-pvorel@suse.cz>

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .../multicast/grp-operation/mcast-lib.sh       | 18 +++++++++++++++++-
 .../multicast/query-flood/mcast-queryfld01.sh  | 13 ++-----------
 .../multicast/query-flood/mcast-queryfld02.sh  | 14 ++++----------
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
index 851aadd5b..555501df7 100644
--- a/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
+++ b/testcases/network/stress/multicast/grp-operation/mcast-lib.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) International Business Machines Corp., 2006
 # Author: Petr Vorel <pvorel@suse.cz>
 #
@@ -141,3 +141,19 @@ do_multicast_test_join_leave()
 
 	tst_res TPASS "test is finished successfully"
 }
+
+do_multicast_test_join_single_socket()
+{
+	local extra="$1"
+	local prefix="$MCAST_IPV4_ADDR_PREFIX"
+	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
+
+	# Run a multicast join tool
+	local tmpfile=$$
+	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix \> $tmpfile
+	tst_res TINFO "joined $(grep groups $tmpfile)"
+
+	local params
+	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
+	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params $extra
+}
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
index faa1c08ef..e80026720 100755
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
+++ b/testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2006 International Business Machines  Corp.
 # Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 #
 # Verify that the kernel is not crashed when joining a multicast group
@@ -18,18 +19,8 @@ do_test()
 {
 	tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of General Queries in $NS_DURATION seconds"
 
-	local prefix="$MCAST_IPV4_ADDR_PREFIX"
-	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
-	# Run a multicast join tool
-	local tmpfile=$$
-	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix \> $tmpfile
-	tst_res TINFO "joined $(grep groups $tmpfile)"
-
 	# Send General Query from the remote host
-	local params
-	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
-	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
+	do_multicast_test_join_single_socket
 }
 
 tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh b/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
index 66012a6f3..8773bd86b 100755
--- a/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
+++ b/testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2006 International Business Machines  Corp.
 # Copyright (c) 2020 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
 #
 # Verify that the kernel is not crashed when joining a multicast group
@@ -19,18 +20,11 @@ do_test()
 {
 	tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION seconds"
 
-	local prefix="$MCAST_IPV4_ADDR_PREFIX"
-	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
-	# Run a multicast join tool
-	local tmpfile=$$
-	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix \> $tmpfile
-	tst_res TINFO "joined $(grep groups $tmpfile)"
+	local extra="-m $MCAST_IPV4_ADDR"
+	[ "$TST_IPV6" ] && extra="-D $MCAST_IPV6_ADDR"
 
 	# Send IGMP Multicast Address Specific Query from the remote host
-	local params="-m $MCAST_IPV4_ADDR"
-	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m -D $MCAST_IPV6_ADDR"
-	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params
+	do_multicast_test_join_single_socket "$extra"
 }
 
 tst_run
-- 
2.30.0


  parent reply	other threads:[~2021-02-05 15:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 15:10 [LTP] [PATCH 1/4] net/multicast: Create mcast_setup_normal() Petr Vorel
2021-02-05 15:10 ` [LTP] [PATCH 2/4] net/multicast: Move API variables from setup to tests Petr Vorel
2021-02-05 15:10 ` Petr Vorel [this message]
2021-02-05 15:10 ` [LTP] [PATCH 4/4] net/multicast: Use SPDX-License-Identifier Petr Vorel
2021-02-06 19:14 ` [LTP] [PATCH 1/4] net/multicast: Create mcast_setup_normal() Petr Vorel
2021-02-10 11:56   ` Alexey Kodanev
2021-02-10 13:08     ` Petr Vorel
2021-02-12 19:26     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210205151015.7465-3-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.