Skip to contentSkip to conversation

net/multicast: Create mcast_setup_normal()

PATCH New Petr Vorel 2 participants 8 messages Feb 5, 2021 – Feb 12, 2021

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/4 net/multicast: Create mcast_setup_normal()

to reduce duplicity
+ define TST_SETUP in tests

---
 .../grp-operation/mcast-group-multiple-socket.sh         | 1 +
 .../multicast/grp-operation/mcast-group-same-group.sh    | 6 +-----
 .../multicast/grp-operation/mcast-group-single-socket.sh | 1 +
 .../multicast/grp-operation/mcast-group-source-filter.sh | 6 +-----
 .../network/stress/multicast/grp-operation/mcast-lib.sh  | 6 +++++-
 .../stress/multicast/packet-flood/mcast-pktfld01.sh      | 9 +++------
 .../stress/multicast/packet-flood/mcast-pktfld02.sh      | 9 +++------
 .../stress/multicast/query-flood/mcast-queryfld01.sh     | 6 +-----
 .../stress/multicast/query-flood/mcast-queryfld02.sh     | 6 +-----
 .../stress/multicast/query-flood/mcast-queryfld03.sh     | 6 +-----
 .../stress/multicast/query-flood/mcast-queryfld04.sh     | 6 +-----
 .../stress/multicast/query-flood/mcast-queryfld05.sh     | 6 +-----
 .../stress/multicast/query-flood/mcast-queryfld06.sh     | 8 ++------
 13 files changed, 22 insertions(+), 54 deletions(-)
testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh +1 -0
index 7b79b42df..2780a8d7c 100644
@@ -19,6 +19,7 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_SETUP="do_setup"
 . mcast-lib.sh
 
 do_setup()
testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh +1 -5
index e10f16c09..01fc95a1a 100644
@@ -19,13 +19,9 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh +1 -0
index ff58152cb..6e26ff52d 100644
@@ -19,6 +19,7 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_SETUP="do_setup"
 . mcast-lib.sh
 
 do_setup()
testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh +1 -5
index df70344da..65fff0f63 100644
@@ -19,13 +19,9 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group with a different source filters on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
testcases/network/stress/multicast/grp-operation/mcast-lib.sh +5 -1
index 381ab6bdf..52a90ca50 100644
@@ -6,7 +6,6 @@
 #
 # Setup script for multicast stress tests.
 
-TST_SETUP="do_setup"
 TST_CLEANUP="mcast_cleanup"
 TST_TESTFUNC="do_test"
 TST_NEEDS_TMPDIR=1
@@ -59,6 +58,11 @@ mcast_setup()
 	[ "$TST_IPV6" ] && mcast_setup6 || mcast_setup4 $max
 }
 
+mcast_setup_normal()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
 mcast_cleanup4()
 {
 	[ -n "$SYSFS_IGMP_MAX_MEMBERSHIPS" ] && sysctl -q -w net.ipv4.igmp_max_memberships=$SYSFS_IGMP_MAX_MEMBERSHIPS
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh +3 -6
index 57eddb7f2..29798c84c 100755
@@ -8,14 +8,11 @@
 # a single socket, then receiving a large number of UDP packets at the socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"
 
 do_test()
 {
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +3 -6
index 76d184995..2c356917a 100755
@@ -9,14 +9,11 @@
 # packets at each socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"
 
 do_test()
 {
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh +1 -5
index c88f079a1..d472a0c54 100755
@@ -9,13 +9,9 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 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"
testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh +1 -5
index 1c977d18b..199a8a016 100755
@@ -10,13 +10,9 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 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"
testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh +1 -5
index 9d3d318d0..2ea22605f 100755
@@ -10,17 +10,13 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
 SRC_ADDR_IPV4="10.10.10.1"
 SRC_ADDR_IPV6="fec0:100:100:100::1"
 FILTER_MODE="include"
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining an IPv${TST_IPVER} multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"
testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh +1 -5
index 6e276901e..dd341d7a3 100755
@@ -9,13 +9,9 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate socket, then receiving a large number of General Queries in $NS_DURATION seconds"
testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh +1 -5
index d6879841d..c73fca460 100755
@@ -10,13 +10,9 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Queries in $NS_DURATION seconds"
testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh +2 -6
index 43798f231..ee7b5016f 100755
@@ -10,22 +10,18 @@
 
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
+TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
 SRC_ADDR_IPV4=10.10.10.1
 SRC_ADDR_IPV6=fec0:100:100:100::1
 FILTER_MODE="include"
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Queries in $NS_DURATION seconds"
 
-    local prefix="$MCAST_IPV4_ADDR_PREFIX"
+	local prefix="$MCAST_IPV4_ADDR_PREFIX"
 	local src_addr="$SRC_ADDR_IPV4"
 	if [ "$TST_IPV6" ]; then
 		prefix="$MCAST_IPV6_ADDR_PREFIX"
Signature · 1 line
2.30.0
author
#1 lore raw

PATCH 1/4 net/multicast: Create mcast_setup_normal()

Hi,

Quoted 6 lines

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh

(quoted diff) +1 -0
@@ -8,14 +8,11 @@
 # a single socket, then receiving a large number of UDP packets at the socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"

Review line 15

Quoted 10 lines
(quoted diff) +2 -6
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"

Actually, this is wrong.
Variables must be set after setup has been run.

Quoted 11 lines
(quoted diff) +0 -0
 do_test()
 {
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +1 -0
index 76d184995..2c356917a 100755
@@ -9,14 +9,11 @@
 # packets at each socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 16

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +2 -6
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"

And here as well.

Fix is to move it into test function.

Kind regards,
Petr

network/stress/multicast/packet-flood/mcast-pktfld01.sh +3 -3
index 1db7b0605..1b9fe9d79 100755
@@ -11,13 +11,13 @@ TST_NEEDS_ROOT=1
 TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-MCAST_LCMD="ns-mcast_receiver"
-MCAST_RCMD="ns-udpsender"
-
 do_test()
 {
 	tst_res TINFO "joining an IPv${TST_IPVER} multicast group with a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION seconds"
 
+	MCAST_LCMD="ns-mcast_receiver"
+	MCAST_RCMD="ns-udpsender"
+
 	local addr="$MCAST_IPV4_ADDR"
 	[ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR"
 
network/stress/multicast/packet-flood/mcast-pktfld02.sh +3 -3
index ee62b347e..9b5de60db 100755
@@ -12,13 +12,13 @@ TST_NEEDS_ROOT=1
 TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-MCAST_LCMD="ns-mcast_receiver"
-MCAST_RCMD="ns-udpsender"
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
 
+	MCAST_LCMD="ns-mcast_receiver"
+	MCAST_RCMD="ns-udpsender"
+
 	local addr port
 	local n=0
 
#2 lore raw

PATCH 1/4 net/multicast: Create mcast_setup_normal()

Quoted 78 lines · Petr Vorel

Hi,

Quoted 6 lines

+++ b/testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh

(quoted diff) +1 -0
@@ -8,14 +8,11 @@
 # a single socket, then receiving a large number of UDP packets at the socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"

Review line 15

Quoted 10 lines
(quoted diff) +2 -6
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"

Actually, this is wrong.
Variables must be set after setup has been run.

Quoted 11 lines
(quoted diff) +0 -0
 do_test()
 {
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +1 -0
index 76d184995..2c356917a 100755
@@ -9,14 +9,11 @@
 # packets at each socket
 
 TST_NEEDS_ROOT=1
+TST_SETUP="mcast_setup_normal"

testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh line 16

Quoted 10 lines
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +2 -6
 . mcast-lib.sh
 
-do_setup()
-{
-	mcast_setup $MCASTNUM_NORMAL
-	MCAST_LCMD=ns-mcast_receiver
-	MCAST_RCMD=ns-udpsender
-}
+MCAST_LCMD="ns-mcast_receiver"
+MCAST_RCMD="ns-udpsender"

And here as well.

Fix is to move it into test function.

Kind regards,
Petr

network/stress/multicast/packet-flood/mcast-pktfld01.sh +3 -3
index 1db7b0605..1b9fe9d79 100755
@@ -11,13 +11,13 @@ TST_NEEDS_ROOT=1
 TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-MCAST_LCMD="ns-mcast_receiver"
-MCAST_RCMD="ns-udpsender"
-
 do_test()
 {
 	tst_res TINFO "joining an IPv${TST_IPVER} multicast group with a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION seconds"
 
+	MCAST_LCMD="ns-mcast_receiver"
+	MCAST_RCMD="ns-udpsender"
+
 	local addr="$MCAST_IPV4_ADDR"
 	[ "$TST_IPV6" ] && addr="$MCAST_IPV6_ADDR"
 
network/stress/multicast/packet-flood/mcast-pktfld02.sh +0 -0
index ee62b347e..9b5de60db 100755
@@ -12,13 +12,13 @@ TST_NEEDS_ROOT=1
 TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 

network/stress/multicast/packet-flood/mcast-pktfld02.sh TST_NEEDS_ROOT=1 · line 21

Quoted 10 lines
network/stress/multicast/packet-flood/mcast-pktfld02.sh +3 -3
-MCAST_LCMD="ns-mcast_receiver"
-MCAST_RCMD="ns-udpsender"
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
 
+	MCAST_LCMD="ns-mcast_receiver"
+	MCAST_RCMD="ns-udpsender"
+

Hi Petr,

Perhaps it would be better to move this to another wrapper in the lib along with mcast_setup_normal()?

mcast_setup_normal_udp()
{
mcast_setup_normal
MCAST_LCMD="ns-mcast_receiver"
MCAST_RCMD="ns-udpsender"
}

author
#3 lore raw

PATCH 1/4 net/multicast: Create mcast_setup_normal()

Hi Alexey,

Quoted 12 lines
Quoted 11 lines

+++ testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh

network/stress/multicast/packet-flood/mcast-pktfld02.sh +0 -3
@@ -12,13 +12,13 @@ TST_NEEDS_ROOT=1
 TST_SETUP="mcast_setup_normal"
 . mcast-lib.sh
 
-MCAST_LCMD="ns-mcast_receiver"
-MCAST_RCMD="ns-udpsender"
-
 do_test()
 {
 	tst_res TINFO "joining $MCASTNUM_NORMAL IPv${TST_IPVER} multicast groups on separate sockets, then receiving a large number of UDP packets at each socket in $NS_DURATION seconds"
Quoted 8 lines

network/stress/multicast/packet-flood/mcast-pktfld01.sh TST_NEEDS_ROOT=1 · line 20

Quoted 3 lines
network/stress/multicast/packet-flood/mcast-pktfld01.sh +3 -0
+	MCAST_LCMD="ns-mcast_receiver"
+	MCAST_RCMD="ns-udpsender"
+

Hi Petr,

Perhaps it would be better to move this to another wrapper in the lib along with mcast_setup_normal()?

Good idea, thanks!

Quoted 6 lines

mcast_setup_normal_udp()
{
mcast_setup_normal
MCAST_LCMD="ns-mcast_receiver"
MCAST_RCMD="ns-udpsender"
}

Kind regards,
Petr

author
#5 lore raw

PATCH 2/4 net/multicast: Move API variables from setup to tests

In reply to Petr Vorel

It's more readable to have variables in the test,
than mixing it in the test and in mcast-lib.sh.

---
 .../multicast/grp-operation/mcast-group-multiple-socket.sh    | 4 ++++
 .../stress/multicast/grp-operation/mcast-group-same-group.sh  | 4 ++++
 .../multicast/grp-operation/mcast-group-single-socket.sh      | 4 ++++
 .../multicast/grp-operation/mcast-group-source-filter.sh      | 4 ++++
 testcases/network/stress/multicast/grp-operation/mcast-lib.sh | 3 ---
 .../network/stress/multicast/packet-flood/mcast-pktfld01.sh   | 3 +++
 .../network/stress/multicast/packet-flood/mcast-pktfld02.sh   | 3 +++
 .../network/stress/multicast/query-flood/mcast-queryfld01.sh  | 2 ++
 .../network/stress/multicast/query-flood/mcast-queryfld02.sh  | 2 ++
 .../network/stress/multicast/query-flood/mcast-queryfld03.sh  | 2 ++
 .../network/stress/multicast/query-flood/mcast-queryfld04.sh  | 2 ++
 .../network/stress/multicast/query-flood/mcast-queryfld05.sh  | 2 ++
 .../network/stress/multicast/query-flood/mcast-queryfld06.sh  | 2 ++
 13 files changed, 34 insertions(+), 3 deletions(-)
testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh +4 -0
index 2780a8d7c..e4cafc27d 100644
@@ -19,7 +19,11 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="do_setup"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_setup()
testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh +4 -0
index 01fc95a1a..28c68c807 100644
@@ -19,7 +19,11 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh +4 -0
index 6e26ff52d..780eaf13c 100644
@@ -19,7 +19,11 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="do_setup"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_setup()
testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh +4 -0
index 65fff0f63..4c5a6e4c7 100644
@@ -19,7 +19,11 @@
 #
 # Author: Mitsuru Chinen <[email protected]>
 
+TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/grp-operation/mcast-lib.sh +0 -3
index 52a90ca50..851aadd5b 100644
@@ -6,9 +6,6 @@
 #
 # Setup script for multicast stress tests.
 
-TST_CLEANUP="mcast_cleanup"
-TST_TESTFUNC="do_test"
-TST_NEEDS_TMPDIR=1
 . tst_net_stress.sh
 
 mcast_setup4()
testcases/network/stress/multicast/packet-flood/mcast-pktfld01.sh +3 -0
index 29798c84c..37af5d354 100755
@@ -8,7 +8,10 @@
 # a single socket, then receiving a large number of UDP packets at the socket
 
 TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 MCAST_LCMD="ns-mcast_receiver"
testcases/network/stress/multicast/packet-flood/mcast-pktfld02.sh +3 -0
index 2c356917a..330722124 100755
@@ -9,7 +9,10 @@
 # packets at each socket
 
 TST_NEEDS_ROOT=1
+TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 MCAST_LCMD="ns-mcast_receiver"
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh +2 -0
index d472a0c54..faa1c08ef 100755
@@ -10,6 +10,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh +2 -0
index 199a8a016..66012a6f3 100755
@@ -11,6 +11,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/query-flood/mcast-queryfld03.sh +2 -0
index 2ea22605f..8ab9af544 100755
@@ -11,6 +11,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 SRC_ADDR_IPV4="10.10.10.1"
testcases/network/stress/multicast/query-flood/mcast-queryfld04.sh +2 -0
index dd341d7a3..5947562f1 100755
@@ -10,6 +10,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/query-flood/mcast-queryfld05.sh +2 -0
index c73fca460..3c064842f 100755
@@ -11,6 +11,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 do_test()
testcases/network/stress/multicast/query-flood/mcast-queryfld06.sh +2 -0
index ee7b5016f..bda064f7d 100755
@@ -11,6 +11,8 @@
 TST_NEEDS_ROOT=1
 TST_NEEDS_TMPDIR=1
 TST_SETUP="mcast_setup_normal"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
 . mcast-lib.sh
 
 SRC_ADDR_IPV4=10.10.10.1
Signature · 1 line
2.30.0
author
#6 lore raw

PATCH 3/4 net/multicast: Remove duplicity

In reply to Petr Vorel
---
 .../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(-)
testcases/network/stress/multicast/grp-operation/mcast-lib.sh +17 -1
index 851aadd5b..555501df7 100644
@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2018 Petr Vorel <[email protected]>
+# Copyright (c) 2017-2021 Petr Vorel <[email protected]>
 # Copyright (c) International Business Machines Corp., 2006
 # Author: Petr Vorel <[email protected]>
 #
@@ -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
+}
testcases/network/stress/multicast/query-flood/mcast-queryfld01.sh +2 -11
index faa1c08ef..e80026720 100755
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2006 International Business Machines  Corp.
 # Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Copyright (c) 2021 Petr Vorel <[email protected]>
 # Author: Mitsuru Chinen <[email protected]>
 #
 # 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
testcases/network/stress/multicast/query-flood/mcast-queryfld02.sh +4 -10
index 66012a6f3..8773bd86b 100755
@@ -2,6 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2006 International Business Machines  Corp.
 # Copyright (c) 2020 Joerg Vehlow <[email protected]>
+# Copyright (c) 2021 Petr Vorel <[email protected]>
 # Author: Mitsuru Chinen <[email protected]>
 #
 # 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
Signature · 1 line
2.30.0
author
#7 lore raw

PATCH 4/4 net/multicast: Use SPDX-License-Identifier

In reply to Petr Vorel
---
 .../mcast-group-multiple-socket.sh              | 17 +----------------
 .../grp-operation/mcast-group-same-group.sh     | 17 +----------------
 .../grp-operation/mcast-group-single-socket.sh  | 17 +----------------
 .../grp-operation/mcast-group-source-filter.sh  | 17 +----------------
 4 files changed, 4 insertions(+), 64 deletions(-)
testcases/network/stress/multicast/grp-operation/mcast-group-multiple-socket.sh +1 -16
index e4cafc27d..abd2dabb3 100644
@@ -1,22 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <[email protected]>
 # Copyright (c) International Business Machines  Corp., 2006
-#
-# This program 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 program is distributed in the hope that it would 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Setup: testcases/network/stress/README
-#
 # Author: Mitsuru Chinen <[email protected]>
 
 TST_NEEDS_ROOT=1
testcases/network/stress/multicast/grp-operation/mcast-group-same-group.sh +1 -16
index 28c68c807..33df2e422 100644
@@ -1,22 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <[email protected]>
 # Copyright (c) International Business Machines  Corp., 2006
-#
-# This program 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 program is distributed in the hope that it would 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Setup: testcases/network/stress/README
-#
 # Author: Mitsuru Chinen <[email protected]>
 
 TST_NEEDS_ROOT=1
testcases/network/stress/multicast/grp-operation/mcast-group-single-socket.sh +1 -16
index 780eaf13c..10c65918f 100644
@@ -1,22 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <[email protected]>
 # Copyright (c) International Business Machines  Corp., 2006
-#
-# This program 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 program is distributed in the hope that it would 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Setup: testcases/network/stress/README
-#
 # Author: Mitsuru Chinen <[email protected]>
 
 TST_NEEDS_ROOT=1
testcases/network/stress/multicast/grp-operation/mcast-group-source-filter.sh +1 -16
index 4c5a6e4c7..19bd426a4 100644
@@ -1,22 +1,7 @@
 #!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2017-2018 Petr Vorel <[email protected]>
 # Copyright (c) International Business Machines  Corp., 2006
-#
-# This program 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 program is distributed in the hope that it would 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.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Setup: testcases/network/stress/README
-#
 # Author: Mitsuru Chinen <[email protected]>
 
 TST_NEEDS_ROOT=1
Signature · 1 line
2.30.0