* [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh
@ 2020-11-16 12:46 Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update " Joerg Vehlow
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Joerg Vehlow @ 2020-11-16 12:46 UTC (permalink / raw)
To: ltp
Hi,
this patch series converts (all?) remeianing tests in network/stress to
use tst_net.sh
J?rg
.../stress/multicast/packet-flood/mcast4-pktfld01 | 114 +++----------
.../stress/multicast/packet-flood/mcast4-pktfld02 | 116 +++----------
.../stress/multicast/packet-flood/mcast6-pktfld01 | 112 +++----------
.../stress/multicast/packet-flood/mcast6-pktfld02 | 114 +++----------
.../stress/multicast/query-flood/mcast4-queryfld01 | 153 +++++------------
.../stress/multicast/query-flood/mcast4-queryfld02 | 145 ++++-------------
.../stress/multicast/query-flood/mcast4-queryfld03 | 142 ++++------------
.../stress/multicast/query-flood/mcast4-queryfld04 | 148 ++++-------------
.../stress/multicast/query-flood/mcast4-queryfld05 | 181 +++++++--------------
.../stress/multicast/query-flood/mcast4-queryfld06 | 166 ++++++-------------
.../stress/multicast/query-flood/mcast6-queryfld01 | 144 ++++------------
.../stress/multicast/query-flood/mcast6-queryfld02 | 140 ++++------------
.../stress/multicast/query-flood/mcast6-queryfld03 | 144 +++++-----------
.../stress/multicast/query-flood/mcast6-queryfld04 | 147 +++++------------
.../stress/multicast/query-flood/mcast6-queryfld05 | 180 +++++++-------------
.../stress/multicast/query-flood/mcast6-queryfld06 | 177 ++++++--------------
testcases/network/stress/route/route4-redirect | 155 +++++-------------
testcases/network/stress/route/route6-redirect | 143 ++++------------
18 files changed, 662 insertions(+), 1959 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update to tst_net.sh
2020-11-16 12:46 [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh Joerg Vehlow
@ 2020-11-16 12:46 ` Joerg Vehlow
2020-11-16 19:31 ` Petr Vorel
2020-11-16 12:46 ` [LTP] [PATCH 2/3] network/stress/multicast/query-flood: Convert " Joerg Vehlow
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Joerg Vehlow @ 2020-11-16 12:46 UTC (permalink / raw)
To: ltp
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
.../multicast/packet-flood/mcast4-pktfld01 | 114 ++++-------------
.../multicast/packet-flood/mcast4-pktfld02 | 116 ++++--------------
.../multicast/packet-flood/mcast6-pktfld01 | 112 ++++-------------
.../multicast/packet-flood/mcast6-pktfld02 | 114 ++++-------------
4 files changed, 85 insertions(+), 371 deletions(-)
diff --git a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01 b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
index c1ee513d4..20284569d 100644
--- a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
+++ b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
@@ -42,41 +42,20 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-pktfld01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Multicast Address
MCAST_ADDR=224.10.0.1
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -89,11 +68,7 @@ do_cleanup()
{
# Make sure to kill the multicast receiver and sender
killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ tst_rhost_run -c "killall -SIGHUP ns-udpsender >/dev/null 2>&1"
}
@@ -107,57 +82,15 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
# Unset the maximum number of processes
ulimit -u unlimited
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
# Make sure the sysctl values
sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
fi
sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
@@ -173,35 +106,30 @@ do_setup()
#
# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv4 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ tst_res TINFO "Verify that the kernel is not crashed when joining a IPv4 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
# Find the available consecutive ports
mcast_port=`find_portbundle udp 1025 1`
if [ $? -ne 0 ]; then
- tst_resm TBROK "No port is available."
- exit 1
+ tst_brk TBROK "No port is available."
fi
# Run a receiver
ns-mcast_receiver -f 4 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast receiver"
- exit 1
+ tst_brk TBROK "Failed to start multicast receiver"
fi
# Run a sender
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 4 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast sender"
- exit 1
-fi
+ tst_rhost_run -s -c "ns-udpsender -D $MCAST_ADDR -f 4 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ tst_res TPASS "Test is finished successfully."
+}
-tst_resm TPASS "Test is finished successfully."
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02 b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
index b3b6134c3..ac591fce1 100644
--- a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
+++ b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld02
@@ -43,42 +43,18 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-pktfld02
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the multicast address
MCAST_ADDR_PREFIX=224.10
-# Number of the multicast connection
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
-
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -92,11 +68,7 @@ do_cleanup()
{
# Make sure to kill the multicast receiver and sender
killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ tst_rhost_run -c "killall -SIGHUP ns-udpsender >/dev/null 2>&1"
}
@@ -110,57 +82,15 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
# Unset the maximum number of processes
ulimit -u unlimited
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
# Make sure the sysctl values
sysctl -w net.ipv4.igmp_max_memberships=$MCASTNUM_NORMAL >/dev/null
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
fi
sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
@@ -176,16 +106,18 @@ do_setup()
#
# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
-# Make sure the value of LTPROOT
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
mcastnum=0
mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get enough port"
- exit 1
+ tst_brk TBROK "Failed to get enough port"
fi
mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
@@ -194,8 +126,7 @@ while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
x=`expr $mcastnum \/ 254`
y=`expr $mcastnum % 254 + 1`
if [ $x -gt 254 ]; then
- tst_resm TINFO "The number of the connection is less than $mcastnum"
- break
+ tst_res TINFO "The number of the connection is less than $mcastnum"
fi
mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
@@ -203,23 +134,18 @@ while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
mcast_port=`expr $mcast_port_top + $mcastnum`
ns-mcast_receiver -f 4 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast receiver"
- exit 1
+ tst_brk TBROK "Failed to start multicast receiver"
fi
# Run a sender
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 4 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+ tst_rhost_run -s -c "ns-udpsender -D $mcast_addr -f 4 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION"
mcastnum=`expr $mcastnum + 1`
done
sleep $NS_DURATION
-do_cleanup
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ tst_res TPASS "Test is finished successfully."
+}
-tst_resm TPASS "Test is finished successfully."
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01 b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
index e9d932b43..bd20b2b07 100644
--- a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
+++ b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld01
@@ -42,37 +42,19 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-pktfld01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Multicast Address
MCAST_ADDR=ff0e::1111:1
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -86,11 +68,7 @@ do_cleanup()
{
# Make sure to kill the multicast receiver and sender
killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ tst_rhost_run -c "killall -SIGHUP ns-udpsender >/dev/null 2>&1"
}
@@ -104,57 +82,15 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
# Unset the maximum number of processes
ulimit -u unlimited
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
# Make sure the sysctl values
sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
fi
sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
@@ -168,36 +104,30 @@ do_setup()
#
#
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv6 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
-
-do_setup
+ tst_res TINFO "Verify that the kernel is not crashed when joining a IPv6 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
# Find the available consecutive ports
mcast_port=`find_portbundle udp 1025 1`
if [ $? -ne 0 ]; then
- tst_resm TBROK "No port is available."
- exit 1
+ tst_brk TBROK "No port is available."
fi
# Run a receiver
ns-mcast_receiver -f 6 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast receiver"
- exit 1
+ tst_brk TBROK "Failed to start multicast receiver"
fi
# Run a sender
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 6 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast sender"
- exit 1
-fi
+ tst_rhost_run -s -c "ns-udpsender -D $MCAST_ADDR -f 6 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ tst_res TPASS "Test is finished successfully."
+}
-tst_resm TPASS "Test is finished successfully."
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02 b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
index e8187b1a6..201a63a05 100644
--- a/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
+++ b/testcases/network/stress/multicast/packet-flood/mcast6-pktfld02
@@ -43,39 +43,19 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-pktfld02
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the multicast address
MCAST_ADDR_PREFIX=ff0e::1111
-# Number of the multicast connection
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
-
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -89,11 +69,7 @@ do_cleanup()
{
# Make sure to kill the multicast receiver and sender
killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ tst_rhost_run -c "killall -SIGHUP ns-udpsender >/dev/null 2>&1"
}
@@ -107,57 +83,15 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
# Unset the maximum number of processes
ulimit -u unlimited
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
# Make sure the sysctl values
sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
fi
sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
@@ -171,24 +105,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
-# Make sure the value of LTPROOT
-do_setup
+# Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
mcastnum=0
mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get enough port"
- exit 1
+ tst_brk TBROK "Failed to get enough port"
fi
mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
# Define the multicast address
if [ $mcastnum -gt 65535 ]; then
- tst_resm TINFO "The number of the connection is less than 65535"
+ tst_res TINFO "The number of the connection is less than 65535"
break
fi
mcastnum_hex=`printf "%x" $mcastnum`
@@ -198,23 +133,18 @@ while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
mcast_port=`expr $mcast_port_top + $mcastnum`
ns-mcast_receiver -f 6 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast receiver"
- exit 1
+ tst_brk TBROK "Failed to start multicast receiver"
fi
# Run a sender
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 6 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+ tst_rhost_run -s -c "ns-udpsender -D $mcast_addr -f 6 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION"
mcastnum=`expr $mcastnum + 1`
done
sleep $NS_DURATION
-do_cleanup
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ tst_res TPASS "Test is finished successfully."
+}
-tst_resm TPASS "Test is finished successfully."
-exit 0
+tst_run
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/3] network/stress/multicast/query-flood: Convert to tst_net.sh
2020-11-16 12:46 [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update " Joerg Vehlow
@ 2020-11-16 12:46 ` Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 3/3] network/stress/route: " Joerg Vehlow
2020-11-16 19:42 ` [LTP] [PATCH 0/3] Convert network stress tests " Petr Vorel
3 siblings, 0 replies; 6+ messages in thread
From: Joerg Vehlow @ 2020-11-16 12:46 UTC (permalink / raw)
To: ltp
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
.../multicast/query-flood/mcast4-queryfld01 | 153 ++++-----------
.../multicast/query-flood/mcast4-queryfld02 | 145 ++++----------
.../multicast/query-flood/mcast4-queryfld03 | 142 ++++----------
.../multicast/query-flood/mcast4-queryfld04 | 148 ++++----------
.../multicast/query-flood/mcast4-queryfld05 | 181 ++++++------------
.../multicast/query-flood/mcast4-queryfld06 | 166 +++++-----------
.../multicast/query-flood/mcast6-queryfld01 | 144 ++++----------
.../multicast/query-flood/mcast6-queryfld02 | 140 ++++----------
.../multicast/query-flood/mcast6-queryfld03 | 144 ++++----------
.../multicast/query-flood/mcast6-queryfld04 | 147 ++++----------
.../multicast/query-flood/mcast6-queryfld05 | 180 ++++++-----------
.../multicast/query-flood/mcast6-queryfld06 | 177 ++++++-----------
12 files changed, 503 insertions(+), 1364 deletions(-)
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld01 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld01
index 992cf423e..a659db387 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld01
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld01
@@ -42,40 +42,18 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -87,13 +65,9 @@ MCAST_ADDR_PREFIX=224.10
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -107,59 +81,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -169,31 +101,24 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
-
-do_setup
-
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
-
-# Send IGMP General Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start IGMP querier"
- exit 1
-fi
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
+
+ # Send IGMP General Query from the remote host
+ tst_rhost_run -s -c "ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0"
+
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld02 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld02
index b731e0218..d71650acf 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld02
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld02
@@ -43,43 +43,22 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld02
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
# Multicast Address
MCAST_ADDR=224.10.0.1 # If you modify this, please refer ns-mcast_join.c
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -90,13 +69,9 @@ MCAST_ADDR=224.10.0.1 # If you modify this, please refer ns-mcast_join.c
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -110,59 +85,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -172,31 +105,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
-do_setup
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-# Send IGMP Multicast Address Specific Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -t $NS_DURATION -r 0' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start IGMP querier"
- exit 1
-fi
+ # Send IGMP Multicast Address Specific Query from the remote host
+ tst_rhost_run -s -c "ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -t $NS_DURATION -r 0"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld03 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld03
index 568178b32..a3e05a61e 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld03
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld03
@@ -43,37 +43,14 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld03
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
@@ -86,6 +63,8 @@ SRC_ADDR=10.10.10.1
# Filter Mode
FILTER_MODE="include"
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -96,13 +75,9 @@ FILTER_MODE="include"
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -116,59 +91,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -178,31 +111,24 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
-
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
-# Send IGMP Multicast Address and Source Specific Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -s $SRC_ADDR -t $NS_DURATION -r 0' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start IGMP querier"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ # Send IGMP Multicast Address and Source Specific Query from the remote host
+ tst_rhost_run -s -c "ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -s $SRC_ADDR -t $NS_DURATION -r 0"
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld04 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld04
index f89393ffc..74e8bf489 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld04
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld04
@@ -42,43 +42,18 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld04
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Number of the multicast to join
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -90,13 +65,9 @@ MCAST_ADDR_PREFIX=224.10
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -110,59 +81,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -172,31 +101,24 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
-
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
-# Send IGMP General Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start IGMP querier"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ # Send IGMP General Query from the remote host
+ tst_rhost_run -s -c "ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0"
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld05 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld05
index 6d73027a6..0ef1f9add 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld05
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld05
@@ -43,23 +43,10 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld05
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# Number of the multicast to join
MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
@@ -67,19 +54,11 @@ MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -90,13 +69,9 @@ MCAST_ADDR_PREFIX=224.10
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -110,59 +85,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -172,42 +105,40 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
-
-do_setup
-
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
-
-# Send IGMP Multicast Address Specific Query from the remote host
-querier_num=0
-while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- x=`expr $querier_num \/ 254`
- y=`expr $querier_num % 254 + 1`
- if [ $x -gt 254 ]; then
- tst_resm TINFO "The number of the connection is less than $querier_num"
- break
- fi
- mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
-
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -t $NS_DURATION -r 0 -b
-
- querier_num=`expr $querier_num + 1`
-done
-sleep $NS_DURATION
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-do_cleanup
-tst_resm TPASS "Test is finished successfully."
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
+
+ # Send IGMP Multicast Address Specific Query from the remote host
+ querier_num=0
+ while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ x=`expr $querier_num \/ 254`
+ y=`expr $querier_num % 254 + 1`
+ if [ $x -gt 254 ]; then
+ tst_res TINFO "The number of the connection is less than $querier_num"
+ break
+ fi
+ mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+ tst_rhost_run -c "ns-igmp_querier -I $rhost_ifname -m $mcast_addr -t $NS_DURATION -r 0 -b"
+
+ querier_num=`expr $querier_num + 1`
+ done
+
+ sleep $NS_DURATION
+
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast4-queryfld06 b/testcases/network/stress/multicast/query-flood/mcast4-queryfld06
index b45162045..b2b8ef3d4 100644
--- a/testcases/network/stress/multicast/query-flood/mcast4-queryfld06
+++ b/testcases/network/stress/multicast/query-flood/mcast4-queryfld06
@@ -43,23 +43,10 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast4-queryfld06
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# Number of the multicast to join
MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
@@ -67,16 +54,6 @@ MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv4 address
-NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-NETWORK_MASK=24
-
-# Host portion of the IPv4 address
-LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
-RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=224.10
@@ -86,6 +63,8 @@ SRC_ADDR=10.10.10.1
# Filter Mode
FILTER_MODE="include"
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -96,13 +75,9 @@ FILTER_MODE="include"
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "killall -SIGHUP ns-igmp_querier >/dev/null 2>&1"
}
@@ -116,59 +91,17 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv4 addresses to the interfaces
- set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
- set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv4 address of the local/remote host
- lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv4 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
+ # Make sure the sysctl values
+ sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
- sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
- sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+ sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
}
@@ -178,42 +111,39 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
-
-do_setup
-
-# Run a multicast join tool
-ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
-
-# Send IGMP Multicast Address Specific Query from the remote host
-querier_num=0
-while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- x=`expr $querier_num \/ 254`
- y=`expr $querier_num % 254 + 1`
- if [ $x -gt 254 ]; then
- tst_resm TINFO "The number of the connection is less than $querier_num"
- break
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+ # Run a multicast join tool
+ ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
fi
- mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -s $SRC_ADDR -t $NS_DURATION -r 0 -b
+ # Send IGMP Multicast Address Specific Query from the remote host
+ querier_num=0
+ while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ x=`expr $querier_num \/ 254`
+ y=`expr $querier_num % 254 + 1`
+ if [ $x -gt 254 ]; then
+ tst_res TINFO "The number of the connection is less than $querier_num"
+ fi
+ mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
- querier_num=`expr $querier_num + 1`
-done
-sleep $NS_DURATION
+ tst_rhost_run -c "ns-igmp_querier -I $rhost_ifname -m $mcast_addr -s $SRC_ADDR -t $NS_DURATION -r 0 -b"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ querier_num=`expr $querier_num + 1`
+ done
-do_cleanup
-tst_resm TPASS "Test is finished successfully."
+ sleep $NS_DURATION
+
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld01 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld01
index 8c09d4897..4c3f31938 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld01
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld01
@@ -42,37 +42,19 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -84,13 +66,9 @@ MCAST_ADDR_PREFIX=ff0e:
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
@@ -104,59 +82,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -166,32 +101,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
-
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
-# Send MLD General Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start MLD querier"
- exit 1
-fi
+ # Send MLD General Query from the remote host
+ tst_rhost_run -s -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld02 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld02
index 17cdae75d..e6b9cec06 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld02
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld02
@@ -43,40 +43,23 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld02
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
# Multicast Address
MCAST_ADDR=ff0e::1 # If you modify this, please refer ns-mcast_join.c
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -87,13 +70,9 @@ MCAST_ADDR=ff0e::1 # If you modify this, please refer ns-mcast_join.c
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
@@ -107,59 +86,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -169,31 +105,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
-
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
-# Send MLD Multicast Address Specific Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start MLD querier"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ # Send MLD Multicast Address Specific Query from the remote host
+ tst_rhost_run -s -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -r 0 -t $NS_DURATION"
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld03 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld03
index bac7726a9..5b39b0875 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld03
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld03
@@ -43,34 +43,15 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld03
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
@@ -83,6 +64,8 @@ SRC_ADDR=fec0:100:100:100::1
# Filter Mode
FILTER_MODE="include"
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -93,13 +76,9 @@ FILTER_MODE="include"
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
@@ -113,59 +92,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -175,31 +111,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
-do_setup
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-# Send MLD Multicast Address and Source Specific Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -a $SRC_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start MLD querier"
- exit 1
-fi
+ # Send MLD Multicast Address and Source Specific Query from the remote host
+ tst_rhost_run -s -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -a $SRC_ADDR -r 0 -t $NS_DURATION"
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld04 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld04
index cd56d4b40..75b10b801 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld04
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld04
@@ -42,40 +42,19 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld04
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Number of the multicast to join
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
+. tst_net.sh
#-----------------------------------------------------------------------
#
@@ -87,16 +66,13 @@ MCAST_ADDR_PREFIX=ff0e:
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
+
#-----------------------------------------------------------------------
#
# Function: do_setup
@@ -107,59 +83,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -169,31 +102,25 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
-
-do_setup
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
-# Send MLD General Query from the remote host
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
-if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to start MLD querier"
- exit 1
-fi
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+ # Send MLD General Query from the remote host
+ tst_rhost_run -s -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION"
-killall -SIGHUP ns-mcast_join >/dev/null 2>&1
-tst_resm TPASS "Test is finished successfully."
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld05 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld05
index 84c2ee109..5cae71ed3 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld05
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld05
@@ -43,40 +43,20 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld05
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Number of the multicast to join
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -87,13 +67,9 @@ MCAST_ADDR_PREFIX=ff0e:
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
@@ -107,59 +83,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -169,41 +102,40 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
-
-do_setup
-
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
-
-# Send MLD Multicast Address Specific Query from the remote host
-querier_num=0
-while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
- # Define the multicast address
- if [ $querier_num -gt 65535 ]; then
- tst_resm TINFO "The number of the querier is less than 65535"
- break
- fi
- querier_num_hex=`printf "%x" $querier_num`
- mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
-
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -r 0 -t $NS_DURATION -b
-
- querier_num=`expr $querier_num + 1`
-done
-sleep $NS_DURATION
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-do_cleanup
-tst_resm TPASS "Test is finished successfully."
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
+
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
+
+ # Send MLD Multicast Address Specific Query from the remote host
+ querier_num=0
+ while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ # Define the multicast address
+ if [ $querier_num -gt 65535 ]; then
+ tst_res TINFO "The number of the querier is less than 65535"
+ break
+ fi
+ querier_num_hex=`printf "%x" $querier_num`
+ mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+ tst_rhost_run -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -r 0 -t $NS_DURATION -b"
+
+ querier_num=`expr $querier_num + 1`
+ done
+
+ sleep $NS_DURATION
+
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
diff --git a/testcases/network/stress/multicast/query-flood/mcast6-queryfld06 b/testcases/network/stress/multicast/query-flood/mcast6-queryfld06
index d94a78efe..507037ab0 100644
--- a/testcases/network/stress/multicast/query-flood/mcast6-queryfld06
+++ b/testcases/network/stress/multicast/query-flood/mcast6-queryfld06
@@ -43,37 +43,15 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=mcast6-queryfld06
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Number of the multicast to join
-MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=6
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
-# Network portion of the IPv6 address
-NETWORK_PART="fec0:1:1:1"
-
-# Host portion of the IPv6 address
-LHOST_HOST_PART=":2" # local host
-RHOST_HOST_PART=":1" # remote host
-
# Prefix of the Multicast Address
MCAST_ADDR_PREFIX=ff0e:
@@ -83,6 +61,8 @@ SRC_ADDR=fec0:100:100:100::1
# Filter Mode
FILTER_MODE="include"
+. tst_net.sh
+
#-----------------------------------------------------------------------
#
# Function: do_cleanup
@@ -93,16 +73,11 @@ FILTER_MODE="include"
#-----------------------------------------------------------------------
do_cleanup()
{
- # Make sure to kill the multicast receiver and sender
- killall -SIGHUP ns-mcast_join >/dev/null 2>&1
- $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
-
- # Clean up each interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Make sure to kill the multicast receiver and sender
+ killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+ tst_rhost_run -c "ns-icmpv6_sender >/dev/null 2>&1"
}
-
#-----------------------------------------------------------------------
#
# Function: do_setup
@@ -113,59 +88,16 @@ do_cleanup()
#-----------------------------------------------------------------------
do_setup()
{
- # Initialize the system configuration
- do_cleanup
-
- # Call do_cleanup function before exit
- trap do_cleanup 0
-
- # name of interface of the local/remote host
- lhost_ifname=`get_ifname lhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- rhost_ifname=`get_ifname rhost $LINK_NUM`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Set IPv6 addresses to the interfaces
- add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
-
- add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- # IPv6 address of the local/remote host
- lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
- rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
- rhost_linklocal="fe80:${RHOST_HOST_PART}"
-
- # Make sure the connectvity
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "There is no IPv6 connectivity."
- exit 1
- fi
-
- # Make sure the sysctl values
- sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to set the sysctl value regarding multicast"
- exit $TST_TOTAL
- fi
-
- sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
- sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+
+ # Make sure the sysctl values
+ sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to set the sysctl value regarding multicast"
+ fi
+
+ sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+ sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
}
@@ -175,39 +107,38 @@ do_setup()
#
#
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
-
-do_setup
-
-# Run a multicast join tool
-ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
-if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
- exit 1
-fi
-
-# Send MLD Multicast Address Specific Query from the remote host
-querier_num=0
-while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
- if [ $querier_num -gt 65535 ]; then
- tst_resm TINFO "The number of the querier is less than 65535"
- break
- fi
- querier_num_hex=`printf "%x" $querier_num`
- mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
-
- $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -a $SRC_ADDR -r 0 -t $NS_DURATION -b
- querier_num=`expr $querier_num + 1`
-done
-sleep $NS_DURATION
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
-
-do_cleanup
-tst_resm TPASS "Test is finished successfully."
+test_body()
+{
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+ local rhost_linklocal=$(tst_ipaddr lhost ${LINK_NUM})
+
+ # Test description
+ tst_res TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+ # Run a multicast join tool
+ ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to start multicast joining tool Please check the environment"
+ fi
+
+ # Send MLD Multicast Address Specific Query from the remote host
+ querier_num=0
+ while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+ if [ $querier_num -gt 65535 ]; then
+ tst_res TINFO "The number of the querier is less than 65535"
+ break
+ fi
+ querier_num_hex=`printf "%x" $querier_num`
+ mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+ tst_rhost_run -c "ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -a $SRC_ADDR -r 0 -t $NS_DURATION -b"
+ querier_num=`expr $querier_num + 1`
+ done
+
+ sleep $NS_DURATION
+
+ tst_res TPASS "Test is finished successfully."
+}
-exit 0
+tst_run
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 3/3] network/stress/route: Convert to tst_net.sh
2020-11-16 12:46 [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update " Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 2/3] network/stress/multicast/query-flood: Convert " Joerg Vehlow
@ 2020-11-16 12:46 ` Joerg Vehlow
2020-11-16 19:42 ` [LTP] [PATCH 0/3] Convert network stress tests " Petr Vorel
3 siblings, 0 replies; 6+ messages in thread
From: Joerg Vehlow @ 2020-11-16 12:46 UTC (permalink / raw)
To: ltp
From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---
.../network/stress/route/route4-redirect | 155 +++++-------------
.../network/stress/route/route6-redirect | 143 ++++------------
2 files changed, 74 insertions(+), 224 deletions(-)
diff --git a/testcases/network/stress/route/route4-redirect b/testcases/network/stress/route/route4-redirect
index 53df9abf2..8c0b09347 100644
--- a/testcases/network/stress/route/route4-redirect
+++ b/testcases/network/stress/route/route4-redirect
@@ -42,26 +42,10 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=route4-redirect01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Test description
-tst_resm TINFO "Verify the kernel is not crashed when the IPv4 route is modified by ICMP Redirects frequently"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
@@ -69,14 +53,7 @@ LINK_NUM=${LINK_NUM:-0}
# Network portion of the IPv4 address
IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
-# Netmask of for the tested network
-IPV4_NETMASK_NUM=24
-
-# Broadcast address of the tested network
-IPV4_BROADCAST=${IPV4_NETWORK}.255
-
# Host portion of the IPv4 address
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"1"} # src
RHOST_IPV4_HOST="2" # gateway
# The destination network
@@ -84,24 +61,12 @@ DST_NETWORK="10.10.0" # destination network would be 10.10.0.0/24
DST_HOST="5"
DST_PORT="7"
+. tst_net.sh
-#-----------------------------------------------------------------------
-#
-# NAME:
-# do_cleanup
-#
-# DESCRIPTION:
-# Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
do_cleanup()
{
- # Kill the redirector utility
- $LTP_RSH $RHOST killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1
-
- # Initialize the interfaces
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ # Kill the redirector utility
+ tst_rhost_run -c "killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1"
}
@@ -113,55 +78,25 @@ do_cleanup()
# DESCRIPTION:
# Set the initial route and start icmp redirect on the remote host
#
-# SET VALUES:
-# rhost_ipv4addr - IPv4 Address of the remote host
-# lhost_ifname - Interface name of the local host
-# rhost_ifname - Interface name of the remote host
-#
#-----------------------------------------------------------------------
do_setup()
{
- # Make sure to clean up
- do_cleanup
-
- # Get the Interface name of local host
- lhost_ifname=`get_ifname lhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- # Get the Interface name of remote host
- rhost_ifname=`get_ifname rhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Remove the link-local address of the remote host
- sleep 3
- $LTP_RSH $RHOST "ip addr flush dev $rhost_ifname" > /dev/null
-
- # Assign IPv4 address to the interface of the local host
- set_ipv4addr lhost ${LINK_NUM} ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to assign an IPv4 address at the local host"
- return 1
- fi
-
- # Add route to the initial gateway
- route add -net ${DST_NETWORK}.0 netmask 255.255.255.0 gw ${IPV4_NETWORK}.${RHOST_IPV4_HOST} dev $lhost_ifname
-
- # Make sure the sysctl value is set for accepting the redirect
- sysctl -w net.ipv4.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
- sysctl -w net.ipv4.conf.${lhost_ifname}.secure_redirects=0 >/dev/null
-
- # Run the redirector utility at the remote host
- ret=`$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmp_redirector -I $rhost_ifname -b ; "'echo $?'`
- if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to run icmp redirector at the remote host"
- exit $TST_TOTAL
- fi
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ # Remove the link-local address of the remote host
+ sleep 3
+ tst_rhost_run -s -c "ip addr flush dev $rhost_ifname"
+
+ # Add route to the initial gateway
+ route add -net ${DST_NETWORK}.0 netmask 255.255.255.0 gw ${IPV4_NETWORK}.${RHOST_IPV4_HOST} dev $lhost_ifname
+
+ # Make sure the sysctl value is set for accepting the redirect
+ sysctl -w net.ipv4.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
+ sysctl -w net.ipv4.conf.${lhost_ifname}.secure_redirects=0 >/dev/null
+
+ # Run the redirector utility at the remote host
+ tst_rhost_run -s -c "ns-icmp_redirector -I $rhost_ifname -b"
}
@@ -180,33 +115,21 @@ do_setup()
#-----------------------------------------------------------------------
test_body()
{
- # Loop for changing the route
- cnt=0
- while [ $cnt -lt $NS_TIMES ]; do
- ns-udpsender -f 4 -D ${DST_NETWORK}.${DST_HOST} -p $DST_PORT -o -s 8
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to run udp packet sender"
- return 1
- fi
- cnt=`expr $cnt + 1`
- done
-
- tst_resm TPASS "Test is finished correctly."
- return 0
+ # Test description
+ tst_resm TINFO "Verify the kernel is not crashed when the IPv4 route is modified by ICMP Redirects frequently"
+ # Loop for changing the route
+ cnt=0
+ while [ $cnt -lt $NS_TIMES ]; do
+ ns-udpsender -f 4 -D ${DST_NETWORK}.${DST_HOST} -p $DST_PORT -o -s 8
+ if [ $? -ne 0 ]; then
+ tst_res TBROK "Failed to run udp packet sender"
+ return 1
+ fi
+ cnt=`expr $cnt + 1`
+ done
+
+ tst_res TPASS "Test is finished correctly."
+ return 0
}
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-# The number of the failure
-#
-#-----------------------------------------------------------------------
-RC=0
-do_setup
-test_body || RC=`expr $RC + 1`
-do_cleanup
-
-exit $RC
+tst_run
diff --git a/testcases/network/stress/route/route6-redirect b/testcases/network/stress/route/route6-redirect
index e12c7c816..8ecbdd626 100644
--- a/testcases/network/stress/route/route6-redirect
+++ b/testcases/network/stress/route/route6-redirect
@@ -42,26 +42,11 @@
#trace_logic=${trace_logic:-"set -x"}
$trace_logic
-# The test case ID, the test case count and the total number of test case
-TCID=route6-redirect01
-TST_TOTAL=1
-TST_COUNT=1
-export TCID
-export TST_COUNT
-export TST_TOTAL
-
-# Test description
-tst_resm TINFO "Verify the kernel is not crashed when the IPv6 route is modified by ICMP Redirects frequently"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# The number of times where route is changed
-NS_TIMES=${NS_TIMES:-10000}
+TST_TESTFUNC=test_body
+TST_NEEDS_ROOT=1
+TST_IPV6=1
+TST_SETUP=do_setup
+TST_CLEANUP=do_cleanup
# The number of the test link where tests run
LINK_NUM=${LINK_NUM:-0}
@@ -81,24 +66,11 @@ DST_NETWORK="fec0:100:100:100" # destination network
DST_HOST=":5"
DST_PORT="7"
+. tst_net.sh
-#-----------------------------------------------------------------------
-#
-# NAME:
-# do_cleanup
-#
-# DESCRIPTION:
-# Recover the tested interfaces
-#
-#-----------------------------------------------------------------------
do_cleanup()
{
- # Kill the redirector utility
- $LTP_RSH $RHOST killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1
-
- # Initialize the interfaces
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ tst_rhost_run -c "killall -SIGHUP ns-icmp_redirector >/dev/null 2>&1"
}
@@ -110,54 +82,25 @@ do_cleanup()
# DESCRIPTION:
# Set the initial route and start icmp redirect on the remote host
#
-# SET VALUES:
-# rhost_ipv6addr - IPv6 Address of the remote host
-# lhost_ifname - Interface name of the local host
-# rhost_ifname - Interface name of the remote host
-#
#-----------------------------------------------------------------------
do_setup()
{
- # Make sure to cleanup the test environment
- do_cleanup
-
- # Get the Interface name of local host
- lhost_ifname=`get_ifname lhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- # Get the Interface name of remote host
- rhost_ifname=`get_ifname rhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the remote host"
- exit $TST_TOTAL
- fi
-
- # Remove the link-local address of the remote host
- sleep 5
- $LTP_RSH $RHOST "ip addr flush dev $rhost_ifname" > /dev/null
-
- # Assign IPv6 address to the interface of the local host
- add_ipv6addr lhost ${LINK_NUM} ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to assign an IPv6 address at the local host"
- return 1
- fi
-
- # Add route to the initial gateway
- route -A inet6 add ${DST_NETWORK}::/64 gw fe80:${RHOST_IPV6_HOST} dev $lhost_ifname
-
- # Make sure the sysctl value is set for accepting the redirect
- sysctl -w net.ipv6.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
-
- # Run the redirector utility at the remote host
- ret=`$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmp_redirector -I $rhost_ifname -b ; "'echo $?'`
- if [ $ret -ne 0 ]; then
- tst_resm TBROK "Failed to run icmp redirector at the remote host"
- exit $TST_TOTAL
- fi
+ local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
+ local rhost_ifname=$(tst_iface rhost ${LINK_NUM})
+
+ # Remove the link-local address of the remote host
+ sleep 3
+ tst_rhost_run -s -c "ip addr flush dev $rhost_ifname"
+ tst_rhost_run -s -c "ip addr add ${IPV6_NETWORK}:${LHOST_IPV6_HOST}/${IPV6_NETMASK_NUM} dev ${rhost_ifname}"
+
+ # Add route to the initial gateway
+ route -A inet6 add ${DST_NETWORK}::/${IPV6_NETMASK_NUM} gw fe80:${RHOST_IPV6_HOST} dev $lhost_ifname
+
+ # Make sure the sysctl value is set for accepting the redirect
+ sysctl -w net.ipv6.conf.${lhost_ifname}.accept_redirects=1 >/dev/null
+
+ # Run the redirector utility at the remote host
+ tst_rhost_run -s -c "ns-icmp_redirector -I $rhost_ifname -b"
}
@@ -175,33 +118,17 @@ do_setup()
#-----------------------------------------------------------------------
test_body()
{
- # Loop for changing the route
- cnt=0
- while [ $cnt -lt $NS_TIMES ]; do
- ns-udpsender -f 6 -D ${DST_NETWORK}:${DST_HOST} -p $DST_PORT -o -s 8
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to run udp packet sender"
- return 1
- fi
- cnt=`expr $cnt + 1`
- done
-
- tst_resm TPASS "Test is finished correctly."
- return 0
+ # Loop for changing the route
+ cnt=0
+ while [ $cnt -lt $NS_TIMES ]; do
+ ns-udpsender -f 6 -D ${DST_NETWORK}:${DST_HOST} -p $DST_PORT -o -s 8
+ if [ $? -ne 0 ]; then
+ tst_brk TBROK "Failed to run udp packet sender"
+ fi
+ cnt=`expr $cnt + 1`
+ done
+
+ tst_res TPASS "Test is finished correctly."
}
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-# The number of the failure
-#
-#-----------------------------------------------------------------------
-RC=0
-do_setup
-test_body || RC=`expr $RC + 1`
-do_cleanup
-
-exit $RC
+tst_run
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update to tst_net.sh
2020-11-16 12:46 ` [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update " Joerg Vehlow
@ 2020-11-16 19:31 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2020-11-16 19:31 UTC (permalink / raw)
To: ltp
Hi Joerg,
> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> ---
> .../multicast/packet-flood/mcast4-pktfld01 | 114 ++++-------------
> .../multicast/packet-flood/mcast4-pktfld02 | 116 ++++--------------
> .../multicast/packet-flood/mcast6-pktfld01 | 112 ++++-------------
> .../multicast/packet-flood/mcast6-pktfld02 | 114 ++++-------------
Thanks a lot!
Could you please merge files into single one:
mcast{4,6}-pktfld01 => mcast-pktfld01
mcast{4,6}-pktfld02 => mcast-pktfld02
as done previously in other multicast and route tests?
Could you also add ".sh" extension to the files? (it's then obvious it's shell,
not a compiled binary).
NOTE: $TST_IPVER is often used.
Also, please remove all bogus comments like GPL verbose text (replaced by SPDX)
and also bogus comments like:
# Test description
The comment at the top should be small, e.g.:
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) International Business Machines Corp., 2006
# your copyright
# Author: Mitsuru Chinen <mitch@jp.ibm.com>
# joining a IPv4/IPv6 multicast group on a single socket, then receiving a large
# number of UDP packets at the socket
You also mix tabs and spaces. We usually prefer tabs, but please reformat whole
file.
> 4 files changed, 85 insertions(+), 371 deletions(-)
> diff --git a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01 b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
> index c1ee513d4..20284569d 100644
> --- a/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
> +++ b/testcases/network/stress/multicast/packet-flood/mcast4-pktfld01
> @@ -42,41 +42,20 @@
> #trace_logic=${trace_logic:-"set -x"}
> $trace_logic
Please remove this.
> -# The test case ID, the test case count and the total number of test case
> -TCID=mcast4-pktfld01
> -TST_TOTAL=1
> -TST_COUNT=1
> -export TCID
> -export TST_COUNT
> -export TST_TOTAL
> -
> -# Make sure the value of LTPROOT
> -LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
> -export LTPROOT
> -
> -# Check the environmanet variable
> -. check_envval || exit $TST_TOTAL
> -
> -# Dulation of the test [sec]
> -NS_DURATION=${NS_DURATION:-3600} # 1 hour
> +TST_TESTFUNC=test_body
> +TST_NEEDS_ROOT=1
> +TST_SETUP=do_setup
> +TST_CLEANUP=do_cleanup
> # The number of the test link where tests run
> LINK_NUM=${LINK_NUM:-0}
LINK_NUM is not needed
> -# Network portion of the IPv4 address
> -NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
> -
> -# Netmask of the IPv4 network
> -NETWORK_MASK=24
> -
> -# Host portion of the IPv4 address
> -LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"} # local host
> -RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"} # remote host
> -
> # Multicast Address
> MCAST_ADDR=224.10.0.1
MCAST_ADDR is replaced by MCAST_IPV{4,6}_ADDR in tst_net_stress.sh (which is
used by mcast-lib.sh, see below).
> +. tst_net.sh
NOTE:
other multicast tests use
testcases/network/stress/multicast/grp-operation/mcast-lib.sh, which also uses
testcases/network/stress/ns-tools/tst_net_stress.sh. I wrote them some time ago
(today I'd do things differently), they deserve cleanup (so does also my rewrite
of multicast stress tests). Even they're not perfect, it'd be probably better to
use it to avoid redundancy.
> # Function: do_cleanup
> @@ -89,11 +68,7 @@ do_cleanup()
> {
> # Make sure to kill the multicast receiver and sender
> killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
> - $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
> -
> - # Clean up each interface
> - initialize_if lhost ${LINK_NUM}
> - initialize_if rhost ${LINK_NUM}
> + tst_rhost_run -c "killall -SIGHUP ns-udpsender >/dev/null 2>&1"
> }
Also cleanup is handled safer (if I remember correctly using killall -SIGHUP in
original do_cleanup() does not work).
> @@ -107,57 +82,15 @@ do_cleanup()
> #-----------------------------------------------------------------------
> do_setup()
> {
> - # Initialize the system configuration
> - do_cleanup
> -
> - # Call do_cleanup function before exit
> - trap do_cleanup 0
> + local lhost_ifname=$(tst_iface lhost ${LINK_NUM})
Also {l,r}host_ifname is not needed. You use $(tst_iface rhost) for -I
parameter, see mcast_setup() in mcast-lib.sh.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh
2020-11-16 12:46 [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh Joerg Vehlow
` (2 preceding siblings ...)
2020-11-16 12:46 ` [LTP] [PATCH 3/3] network/stress/route: " Joerg Vehlow
@ 2020-11-16 19:42 ` Petr Vorel
3 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2020-11-16 19:42 UTC (permalink / raw)
To: ltp
Hi Joerg,
> Hi,
> this patch series converts (all?) remeianing tests in network/stress to
> use tst_net.sh
Please see my comments in first patch, they apply to second one and mostly to
third one as well (it should use route-lib.sh).
Ad all: I've never reposted fixed version for route{4,6}-rmmod [1] (needs a cleanup)
I'll do it soon.
Kind regards,
Petr
[1] http://lists.linux.it/pipermail/ltp/2017-July/005079.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-11-16 19:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-16 12:46 [LTP] [PATCH 0/3] Convert network stress tests to tst_net.sh Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 1/3] network/stress/mutlicast/packet-flood: Update " Joerg Vehlow
2020-11-16 19:31 ` Petr Vorel
2020-11-16 12:46 ` [LTP] [PATCH 2/3] network/stress/multicast/query-flood: Convert " Joerg Vehlow
2020-11-16 12:46 ` [LTP] [PATCH 3/3] network/stress/route: " Joerg Vehlow
2020-11-16 19:42 ` [LTP] [PATCH 0/3] Convert network stress tests " Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).