* [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender
@ 2017-02-08 15:07 Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 2/3] net: broken_ip: don't send packets from rhost Alexey Kodanev
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Alexey Kodanev @ 2017-02-08 15:07 UTC (permalink / raw)
To: ltp
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/lib/test_net.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index d3fbbf0..90dce0b 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -416,6 +416,48 @@ tst_ping()
return $ret
}
+# tst_icmp -t TIMEOUT -s MESSAGE_SIZE_ARRAY OPTS
+# TIMEOUT: total time for the test in seconds
+# OPTS: additional options for ns-icmpv4|6-sender tool
+tst_icmp()
+{
+ local timeout=1
+ local msg_sizes=56
+ local opts=
+ local num=
+ local ret=0
+ local ver="${TST_IPV6:-4}"
+
+ OPTIND=0
+ while getopts :t:s: opt; do
+ case "$opt" in
+ t) timeout="$OPTARG" ;;
+ s) msg_sizes="$OPTARG" ;;
+ *) opts="-$OPTARG $opts" ;;
+ esac
+ done
+ OPTIND=0
+
+ local num=$(echo "$msg_sizes" | wc -w)
+ timeout="$(($timeout / $num))"
+ [ "$timeout" -eq 0 ] && timeout=1
+
+ opts="${opts}-I $(tst_iface) -S $(tst_ipaddr) -D $(tst_ipaddr rhost) "
+ opts="${opts}-M $(tst_hwaddr rhost) -t $timeout"
+
+ for size in $msg_sizes; do
+ ns-icmpv${ver}_sender -s $size $opts
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ tst_resm TPASS "'ns-icmpv${ver}_sender -s $size $opts' pass"
+ else
+ tst_resm TFAIL "'ns-icmpv${ver}_sender -s $size $opts' fail"
+ break
+ fi
+ done
+ return $ret
+}
+
# tst_set_sysctl NAME VALUE [safe]
# It can handle netns case when sysctl not namespaceified.
tst_set_sysctl()
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 2/3] net: broken_ip: don't send packets from rhost
2017-02-08 15:07 [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
@ 2017-02-08 15:07 ` Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 3/3] net: interfaces: various fixes Alexey Kodanev
2017-02-27 11:28 ` [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
2 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2017-02-08 15:07 UTC (permalink / raw)
To: ltp
* add new test-cases with different packet sizes;
* use tst_icmp() to run icmpv*_sender;
* remove broken*_lib.sh;
* check connectivity after sending malformed packets with tst_ping;
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/net_stress.broken_ip | 8 ++--
.../network/stress/broken_ip/broken_ip4-checksum | 13 +++-----
.../network/stress/broken_ip/broken_ip4-dstaddr | 14 +++------
.../network/stress/broken_ip/broken_ip4-fragment | 13 +++-----
testcases/network/stress/broken_ip/broken_ip4-ihl | 14 +++------
.../network/stress/broken_ip/broken_ip4-protcol | 13 +++-----
.../network/stress/broken_ip/broken_ip4-totlen | 13 +++-----
.../network/stress/broken_ip/broken_ip4-version | 13 +++-----
.../network/stress/broken_ip/broken_ip4_lib.sh | 28 ------------------
.../network/stress/broken_ip/broken_ip6-dstaddr | 14 +++------
.../network/stress/broken_ip/broken_ip6-nexthdr | 13 +++-----
testcases/network/stress/broken_ip/broken_ip6-plen | 14 +++------
.../network/stress/broken_ip/broken_ip6-version | 13 +++-----
.../network/stress/broken_ip/broken_ip6_lib.sh | 30 --------------------
14 files changed, 59 insertions(+), 154 deletions(-)
delete mode 100644 testcases/network/stress/broken_ip/broken_ip4_lib.sh
delete mode 100644 testcases/network/stress/broken_ip/broken_ip6_lib.sh
diff --git a/runtest/net_stress.broken_ip b/runtest/net_stress.broken_ip
index c037f3e..32e3b99 100644
--- a/runtest/net_stress.broken_ip
+++ b/runtest/net_stress.broken_ip
@@ -11,7 +11,7 @@ broken_ip4-protcol broken_ip4-protcol
broken_ip4-checksum broken_ip4-checksum
broken_ip4-dstaddr broken_ip4-dstaddr
-broken_ip6-dstaddr broken_ip6-dstaddr
-broken_ip6-nexthdr broken_ip6-nexthdr
-broken_ip6-plen broken_ip6-plen
-broken_ip6-version broken_ip6-version
+broken_ip6-dstaddr broken_ip6-dstaddr -6
+broken_ip6-nexthdr broken_ip6-nexthdr -6
+broken_ip6-plen broken_ip6-plen -6
+broken_ip6-version broken_ip6-version -6
diff --git a/testcases/network/stress/broken_ip/broken_ip4-checksum b/testcases/network/stress/broken_ip/broken_ip4-checksum
index bc268af..33667ba 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-checksum
+++ b/testcases/network/stress/broken_ip/broken_ip4-checksum
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip4-checksum01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong value in the checksum field"
+tst_resm TINFO "Sending ICMPv4 with wrong chksum field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -c"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -c
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-dstaddr b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
index f3ddba4..b4b676e 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,15 +21,12 @@
TCID=broken_ip4-dstaddr01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets whose destination address is wrong \
-(destination MAC address is correct)"
+tst_resm TINFO "Sending ICMPv4 with wrong dst address for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -i"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -i
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-fragment b/testcases/network/stress/broken_ip/broken_ip4-fragment
index f477996..dbef193 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-fragment
+++ b/testcases/network/stress/broken_ip/broken_ip4-fragment
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip4-fragment01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong fragment information"
+tst_resm TINFO "Sending ICMPv4 with wrong frag. info for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -f"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -f
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-ihl b/testcases/network/stress/broken_ip/broken_ip4-ihl
index c3a34ec..48deb3b 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-ihl
+++ b/testcases/network/stress/broken_ip/broken_ip4-ihl
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,15 +21,12 @@
TCID=broken_ip4-ihl01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong value in the header \
-length field."
+tst_resm TINFO "Sending ICMPv4 with wrong header len field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -l"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -l
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-protcol b/testcases/network/stress/broken_ip/broken_ip4-protcol
index 60a6f17..b4b767c 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-protcol
+++ b/testcases/network/stress/broken_ip/broken_ip4-protcol
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip4-protocol01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong value in the protocol field"
+tst_resm TINFO "Sending ICMPv4 with wrong proto field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
--M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -p"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -p
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-totlen b/testcases/network/stress/broken_ip/broken_ip4-totlen
index e854d52..051d969 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-totlen
+++ b/testcases/network/stress/broken_ip/broken_ip4-totlen
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip4-totlen01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong value in the total length field."
+tst_resm TINFO "Sending ICMPv4 with wrong total len field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
--M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -L"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -L
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-version b/testcases/network/stress/broken_ip/broken_ip4-version
index 6ba635a..c3ccf7f 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-version
+++ b/testcases/network/stress/broken_ip/broken_ip4-version
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip4-version01
TST_TOTAL=1
-. broken_ip4_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv4 packets that have wrong value in version field."
+tst_resm TINFO "Sending ICMPv4 with wrong version field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv4_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -v"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1472" -v
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4_lib.sh b/testcases/network/stress/broken_ip/broken_ip4_lib.sh
deleted file mode 100644
index 5b8e17f..0000000
--- a/testcases/network/stress/broken_ip/broken_ip4_lib.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines Corp., 2006
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-. test_net.sh
-
-tst_resm TINFO "Test duration is $NS_DURATION [sec]"
-
-lhost_addr=$(tst_ipaddr)
-rhost_addr=$(tst_ipaddr rhost)
-
-tst_rhost_run -s -c \
- "check_icmpv4_connectivity $(tst_iface rhost) $lhost_addr"
diff --git a/testcases/network/stress/broken_ip/broken_ip6-dstaddr b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
index 833015e..5da38ab 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,15 +21,12 @@
TCID=broken_ip6-dstaddr01
TST_TOTAL=1
-. broken_ip6_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv6 packets whose destination address is wrong \
-(destination MAC address is correct)"
+tst_resm TINFO "Sending ICMPv6 with wrong dst address for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv6_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -i"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -i
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-nexthdr b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
index 866a92d..bb1bdcb 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-nexthdr
+++ b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip6-nexthdr01
TST_TOTAL=1
-. broken_ip6_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv6 packets that have wrong value in the next header field."
+tst_resm TINFO "Sending ICMPv4 with wrong next header for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv6_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -n"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -n
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-plen b/testcases/network/stress/broken_ip/broken_ip6-plen
index 75ee080..8eacbf4 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-plen
+++ b/testcases/network/stress/broken_ip/broken_ip6-plen
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,15 +21,12 @@
TCID=broken_ip6-plen01
TST_TOTAL=1
-. broken_ip6_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv6 packets that have wrong value in the payload \
-length field."
+tst_resm TINFO "Sending ICMPv4 with wrong payload len for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv6_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -L"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -L
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-version b/testcases/network/stress/broken_ip/broken_ip6-version
index 9467347..cdce71f 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-version
+++ b/testcases/network/stress/broken_ip/broken_ip6-version
@@ -1,6 +1,5 @@
#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2006
#
# This program is free software; you can redistribute it and/or
@@ -22,14 +21,12 @@
TCID=broken_ip6-version01
TST_TOTAL=1
-. broken_ip6_lib.sh
+. test_net.sh
-tst_resm TINFO "Verify that the kernel is not crashed with receiving \
-a large number of IPv6 packets that have wrong value in version field."
+tst_resm TINFO "Sending ICMPv6 with wrong version field for $NS_DURATION sec"
-tst_rhost_run -s -c "ns-icmpv6_sender -I $(tst_iface rhost) -S $rhost_addr \
- -M $(tst_hwaddr lhost) -D $lhost_addr -s 56 -t $NS_DURATION -v"
+tst_icmp -t $NS_DURATION -s "0 100 500 1000 1452" -v
-tst_resm TPASS "Test is finished successfully."
+EXPECT_PASS tst_ping
tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6_lib.sh b/testcases/network/stress/broken_ip/broken_ip6_lib.sh
deleted file mode 100644
index e2429ac..0000000
--- a/testcases/network/stress/broken_ip/broken_ip6_lib.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-# Copyright (c) International Business Machines Corp., 2006
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-. test_net.sh
-
-TST_IPV6=6
-
-tst_resm TINFO "Test duration is $NS_DURATION [sec]"
-
-lhost_addr=$(tst_ipaddr)
-rhost_addr=$(tst_ipaddr rhost)
-
-tst_rhost_run -s -c \
- "check_icmpv6_connectivity $(tst_iface rhost) $lhost_addr"
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 3/3] net: interfaces: various fixes
2017-02-08 15:07 [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 2/3] net: broken_ip: don't send packets from rhost Alexey Kodanev
@ 2017-02-08 15:07 ` Alexey Kodanev
2017-02-27 11:28 ` [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
2 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2017-02-08 15:07 UTC (permalink / raw)
To: ltp
* if4-addr-change: fix 'local: can only be used in a function' error;
* call tst_wait_ipv6_dad() after restoring interface configuration and
brining up interface in 'if-updown' tests;
* remove tst_restore_ipaddr() from tests which don't change IP addresses
or routes;
* if-mtu-change:
* save MTU before test and restore in cleanup;
* change MTU on both ends;
* tst_sleep (change inerval) right after changing MTU and before tst_ping;
* use 552 as a minimum mtu for IPv4 (net.ipv4.route.min_pmtu);
* pass different message sizes to tst_ping in order to test fragmentation;
* change check interval calculation, allow to have up to 20 intervals, not 100;
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/stress/interface/if-addr-adddel | 14 ++++-
.../network/stress/interface/if-addr-addlarge | 16 ++++--
testcases/network/stress/interface/if-lib.sh | 16 +++++-
testcases/network/stress/interface/if-mtu-change | 54 ++++++++++++--------
testcases/network/stress/interface/if-route-adddel | 14 ++++-
.../network/stress/interface/if-route-addlarge | 15 ++++-
testcases/network/stress/interface/if-updown | 6 +--
testcases/network/stress/interface/if4-addr-change | 30 +++++------
8 files changed, 109 insertions(+), 56 deletions(-)
diff --git a/testcases/network/stress/interface/if-addr-adddel b/testcases/network/stress/interface/if-addr-adddel
index 0a069ef..569c36d 100644
--- a/testcases/network/stress/interface/if-addr-adddel
+++ b/testcases/network/stress/interface/if-addr-adddel
@@ -22,8 +22,16 @@ TCID=if-addr-adddel
. if-lib.sh
+TST_CLEANUP="do_cleanup"
+
# The interval of the check interface activity (check ten times)
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 100))}
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 20))}
+
+do_cleanup()
+{
+ cleanup
+ restore_ipaddr
+}
test_body()
{
@@ -47,8 +55,10 @@ test_body()
tst_resm TINFO "'$cmd_name' add/del IPv$ipver '$new_ip' $NS_TIMES times"
- tst_restore_ipaddr || \
+ if ! restore_ipaddr; then
tst_resm TBROK "Failed to set default IP addresses"
+ return
+ fi
make_background_tcp_traffic
diff --git a/testcases/network/stress/interface/if-addr-addlarge b/testcases/network/stress/interface/if-addr-addlarge
index a6b841d..d5cb83b 100644
--- a/testcases/network/stress/interface/if-addr-addlarge
+++ b/testcases/network/stress/interface/if-addr-addlarge
@@ -22,8 +22,16 @@ TCID=if-addr-addlarge
. if-lib.sh
+TST_CLEANUP="do_cleanup"
+
# The interval of the check interface activity (check ten times)
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($IP_TOTAL / 100))}
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($IP_TOTAL / 20))}
+
+do_cleanup()
+{
+ cleanup
+ restore_ipaddr
+}
test_body()
{
@@ -41,8 +49,10 @@ test_body()
tst_resm TINFO "'$cmd_name' add $IP_TOTAL IPv$ipver addresses"
tst_resm TINFO "check interval that $iface is working: $CHECK_INTERVAL"
- tst_restore_ipaddr || \
+ if ! restore_ipaddr; then
tst_resm TBROK "Failed to set default IP addresses"
+ return
+ fi
make_background_tcp_traffic
@@ -67,8 +77,6 @@ test_body()
local new_ip=${IPV4_NET16_UNUSED}.$x.$y
fi
- tst_resm TINFO "set new ip $new_ip"
-
case $cmd_type in
if_cmd)
if [ "$TST_IPV6" ]; then
diff --git a/testcases/network/stress/interface/if-lib.sh b/testcases/network/stress/interface/if-lib.sh
index 363c18d..4168dd0 100644
--- a/testcases/network/stress/interface/if-lib.sh
+++ b/testcases/network/stress/interface/if-lib.sh
@@ -37,7 +37,6 @@ cleanup()
# Stop the background TCP traffic
pkill -13 -x netstress
tst_rhost_run -c "pkill -13 -x netstress"
- tst_restore_ipaddr
}
make_background_tcp_traffic()
@@ -49,15 +48,26 @@ make_background_tcp_traffic()
check_connectivity()
{
- local cnt=$1
+ local cnt="$1"
+ local restore="$2"
+
[ $CHECK_INTERVAL -eq 0 ] && return
[ $(($cnt % $CHECK_INTERVAL)) -ne 0 ] && return
tst_resm TINFO "check connectivity through $(tst_iface) on step $cnt"
- check_icmpv${ipver}_connectivity $(tst_iface) $(tst_ipaddr rhost)
+
+ [ -n "$restore" ] && restore_ipaddr
+
+ tst_ping
if [ $? -ne 0 ]; then
tst_resm TFAIL "$(tst_iface) is broken"
return 1
fi
return 0
}
+
+restore_ipaddr()
+{
+ tst_restore_ipaddr || return $?
+ tst_wait_ipv6_dad
+}
diff --git a/testcases/network/stress/interface/if-mtu-change b/testcases/network/stress/interface/if-mtu-change
index 6c6ac25..637fa63 100644
--- a/testcases/network/stress/interface/if-mtu-change
+++ b/testcases/network/stress/interface/if-mtu-change
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2005
#
# This program is free software; you can redistribute it and/or
@@ -22,13 +22,28 @@ TCID=if-mtu-change
. if-lib.sh
+TST_CLEANUP="do_cleanup"
+
# The interval of the mtu change [second]
CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($MTU_CHANGE_TIMES / 100))}
# The array of the value which MTU is changed into sequentially
-CHANGE_VALUES="784 1142 426 1500 68 1500 68 748 68 1142 1500"
+# 552 - net.ipv4.route.min_pmtu
+CHANGE_VALUES="784 1142 552 1500 552 1500 552 748 552 1142 1500"
CHANGE6_VALUES="1280 1445 1335 1390 1500 1280 1500 1280 1335 1500"
[ "$TST_IPV6" ] && CHANGE_VALUES=$CHANGE6_VALUES
+saved_mtu=
+
+do_cleanup()
+{
+ cleanup
+ if [ "$saved_mtu" ]; then
+ ip li set $(tst_iface) mtu $saved_mtu
+ tst_rhost_run -c "ip li set $(tst_iface rhost) mtu $saved_mtu"
+ fi
+ tst_restore_ipaddr
+ tst_restore_ipaddr rhost
+ tst_wait_ipv6_dad
+}
test_body()
{
@@ -41,57 +56,54 @@ test_body()
esac
local iface=$(tst_iface)
+ local iface_rmt=$(tst_iface rhost)
[ "$TST_IPV6" ] && local netmask=64 || local netmask=16
tst_resm TINFO "'$cmd_name changes MTU $MTU_CHANGE_TIMES times " \
"every $CHANGE_INTERVAL seconds"
- tst_restore_ipaddr || \
- tst_resm TBROK "Failed to set default IP addresses"
-
make_background_tcp_traffic
mtu_array_len=$(echo $CHANGE_VALUES | wc -w)
local cnt=0
while [ $cnt -lt $MTU_CHANGE_TIMES ]; do
- sleep $CHANGE_INTERVAL
local nth=$(($cnt % $mtu_array_len))
field=$(($nth + 1))
cnt=$(($cnt + 1))
mtu=$(echo $CHANGE_VALUES | cut -d ' ' -f $field)
- [ $cnt -eq $MTU_CHANGE_TIMES ] && mtu=1500
+ [ $cnt -eq $MTU_CHANGE_TIMES ] && mtu="$saved_mtu"
tst_resm TINFO "set MTU to $mtu $cnt/$MTU_CHANGE_TIMES"
+ local ret=0
case $cmd_type in
- if_cmd) ifconfig $iface mtu $mtu ;;
- ip_cmd) ip link set $iface mtu $mtu ;;
+ if_cmd) ifconfig $iface mtu $mtu || ret=1
+ tst_rhost_run -c "ifconfig $iface_rmt mtu $mtu"
+ ;;
+ ip_cmd) ip link set $iface mtu $mtu || ret=1
+ tst_rhost_run -c "ip link set $iface_rmt mtu $mtu"
+ ;;
esac
- if [ $? -ne 0 ]; then
+ if [ $? -ne 0 -o $ret -ne 0 ]; then
tst_resm TFAIL "Failed to change the mtu at $cnt time"
return
fi
- check_connectivity $cnt || return
+ tst_sleep $CHANGE_INTERVAL
+
+ EXPECT_PASS tst_ping $(tst_ipaddr) $(tst_ipaddr rhost) "1 1000 65507"
# Check the background TCP traffic
pgrep -x netstress > /dev/null || make_background_tcp_traffic
done
-
- tst_resm TINFO "check connectivity through $iface"
- check_icmpv${ipver}_connectivity $iface $(tst_ipaddr rhost)
- if [ $? -ne 0 ]; then
- tst_resm TFAIL "$iface is broken"
- return
- fi
-
- tst_resm TPASS "Test is finished correctly"
}
setup
tst_check_cmds ifconfig
+saved_mtu="$(cat /sys/class/net/$(tst_iface)/mtu)"
+
test_body 'if_cmd'
test_body 'ip_cmd'
diff --git a/testcases/network/stress/interface/if-route-adddel b/testcases/network/stress/interface/if-route-adddel
index ac15b5e..4516741 100644
--- a/testcases/network/stress/interface/if-route-adddel
+++ b/testcases/network/stress/interface/if-route-adddel
@@ -22,7 +22,15 @@ TCID=if-route-adddel
. if-lib.sh
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 100))}
+TST_CLEANUP="do_cleanup"
+
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 20))}
+
+do_cleanup()
+{
+ cleanup
+ restore_ipaddr
+}
test_body()
{
@@ -51,8 +59,10 @@ test_body()
tst_resm TINFO "'$cmd_name' add/del ${new_rt}${opt_rt} $NS_TIMES times"
- tst_restore_ipaddr || \
+ if ! restore_ipaddr; then
tst_resm TBROK "Failed to set default IP addresses"
+ return
+ fi
make_background_tcp_traffic
diff --git a/testcases/network/stress/interface/if-route-addlarge b/testcases/network/stress/interface/if-route-addlarge
index 43a0599..e83cf60 100644
--- a/testcases/network/stress/interface/if-route-addlarge
+++ b/testcases/network/stress/interface/if-route-addlarge
@@ -19,11 +19,18 @@
TST_TOTAL=2
TCID=if-route-addlarge
-TST_CLEANUP="cleanup"
. if-lib.sh
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($ROUTE_TOTAL / 100))}
+TST_CLEANUP="do_cleanup"
+
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($ROUTE_TOTAL / 20))}
+
+do_cleanup()
+{
+ cleanup
+ restore_ipaddr
+}
test_body()
{
@@ -49,8 +56,10 @@ test_body()
tst_resm TINFO "'$cmd_name' add IPv$ipver $ROUTE_TOTAL routes"
- tst_restore_ipaddr || \
+ if ! restore_ipaddr; then
tst_resm TBROK "Failed to set default IP addresses"
+ return
+ fi
make_background_tcp_traffic
diff --git a/testcases/network/stress/interface/if-updown b/testcases/network/stress/interface/if-updown
index b18aa0d..deefef6 100644
--- a/testcases/network/stress/interface/if-updown
+++ b/testcases/network/stress/interface/if-updown
@@ -22,7 +22,7 @@ TCID=if-updown
. if-lib.sh
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($IF_UPDOWN_TIMES / 100))}
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($IF_UPDOWN_TIMES / 20))}
test_body()
{
@@ -38,8 +38,6 @@ test_body()
tst_resm TINFO "'$cmd_name ups/downs $iface $IF_UPDOWN_TIMES times"
tst_resm TINFO "check connectivity interval is $CHECK_INTERVAL"
- tst_restore_ipaddr || \
- tst_resm TBROK "Failed to set default IP addresses"
local cnt=1
while [ $cnt -le $IF_UPDOWN_TIMES ]; do
@@ -61,7 +59,7 @@ test_body()
return
fi
- check_connectivity $cnt || return
+ check_connectivity $cnt restore_ip || return
cnt=$(($cnt + 1))
done
diff --git a/testcases/network/stress/interface/if4-addr-change b/testcases/network/stress/interface/if4-addr-change
index f569202..5599b08 100644
--- a/testcases/network/stress/interface/if4-addr-change
+++ b/testcases/network/stress/interface/if4-addr-change
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2016 Oracle and/or its affiliates. All Rights Reserved.
# Copyright (c) International Business Machines Corp., 2005
#
# This program is free software; you can redistribute it and/or
@@ -19,27 +19,28 @@
TST_TOTAL=1
TCID=if4-addr-change
-TST_CLEANUP="tst_restore_ipaddr"
+TST_CLEANUP="do_cleanup"
. test_net.sh
# Broadcast address of the tested network
-CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 100))}
+CHECK_INTERVAL=${CHECK_INTERVAL:-$(($NS_TIMES / 20))}
# Maximum host portion of the IPv4 address on the local host
LHOST_IPV4_HOST_MAX="254"
+do_cleanup()
+{
+ tst_restore_ipaddr
+ tst_wait_ipv6_dad
+}
+
trap "tst_brkm TBROK 'test interrupted'" INT
tst_check_cmds ifconfig
tst_resm TINFO "ifconfig changes IPv4 address $NS_TIMES times"
-tst_restore_ipaddr
-
-check_icmpv4_connectivity $(tst_iface) $(tst_ipaddr rhost) || \
- tst_brkm TBROK "Failed to ping to $(tst_ipaddr rhost)"
-
-local cnt=0
+cnt=0
num=1
while [ $cnt -lt $NS_TIMES ]; do
# Define the network portion
@@ -60,15 +61,10 @@ while [ $cnt -lt $NS_TIMES ]; do
[ $CHECK_INTERVAL -eq 0 ] && continue
[ $(($cnt % $CHECK_INTERVAL)) -ne 0 ] && continue
- tst_resm TINFO "ping from $lhost_ipv4addr to $(tst_ipaddr rhost)"
- check_icmpv4_connectivity $(tst_iface) $(tst_ipaddr rhost) || \
- tst_brkm TFAIL "$(tst_iface) link broken after ${cnt} times"
+ tst_resm TINFO "ping $(tst_ipaddr):$(tst_ipaddr rhost) ${cnt}/$NS_TIMES"
+ EXPECT_PASS tst_ping
done
-tst_resm TINFO "ping from $lhost_ipv4addr to $(tst_ipaddr rhost)"
-check_icmpv4_connectivity $(tst_iface) $(tst_ipaddr rhost) || \
- tst_brkm TFAIL "$(tst_iface) is broken"
-
-tst_resm TPASS "Test is finished successfully"
+EXPECT_PASS tst_ping
tst_exit
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender
2017-02-08 15:07 [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 2/3] net: broken_ip: don't send packets from rhost Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 3/3] net: interfaces: various fixes Alexey Kodanev
@ 2017-02-27 11:28 ` Alexey Kodanev
2 siblings, 0 replies; 4+ messages in thread
From: Alexey Kodanev @ 2017-02-27 11:28 UTC (permalink / raw)
To: ltp
On 02/08/2017 06:07 PM, Alexey Kodanev wrote:
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
> testcases/lib/test_net.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 42 insertions(+), 0 deletions(-)
Patch-set applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-27 11:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 15:07 [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 2/3] net: broken_ip: don't send packets from rhost Alexey Kodanev
2017-02-08 15:07 ` [LTP] [PATCH 3/3] net: interfaces: various fixes Alexey Kodanev
2017-02-27 11:28 ` [LTP] [PATCH 1/3] test_net: add tst_icmp() which use ns-icmpv4|6-sender Alexey Kodanev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.