It provides the following functions: * basic setup and cleanup * making TCP background traffic * checking connectivity between test hosts
Moreover it defines new IPV4_NET16_UNUSED and IPV6_NET32_UNUSED variables. They are needed because some of the interface tests add more then 254 new addresses to interface which could overlap with existed ones on test network. Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com> --- testcases/network/stress/interface/if-lib.sh | 64 ++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) create mode 100644 testcases/network/stress/interface/if-lib.sh diff --git a/testcases/network/stress/interface/if-lib.sh b/testcases/network/stress/interface/if-lib.sh new file mode 100644 index 0000000..fde6310 --- /dev/null +++ b/testcases/network/stress/interface/if-lib.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. +# +# 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 +# +# Author: Alexey Kodanev <alexey.koda...@oracle.com> + +TST_CLEANUP="cleanup" + +. test_net.sh + +ipver=${TST_IPV6:-4} + +IPV4_NET16_UNUSED=${IPV4_NET16_UNUSED:-"10.23"} +IPV6_NET32_UNUSED=${IPV6_NET32_UNUSED:-"fd00:23"} + +setup() +{ + tst_require_root + tst_check_cmds ip pgrep pkill + trap "tst_brkm TBROK 'test interrupted'" INT +} + +cleanup() +{ + # Stop the background TCP traffic + pkill -13 -x tcp_fastopen + tst_rhost_run -c "pkill -13 -x tcp_fastopen" + tst_restore_ipaddr +} + +make_background_tcp_traffic() +{ + port=$(tst_get_unused_port ipv${ipver} stream) + tcp_fastopen -R 3 -g $port > /dev/null 2>&1 & + tst_rhost_run -b -c "tcp_fastopen -l -H $(tst_ipaddr) -g $port" +} + +check_connectivity() +{ + local cnt=$1 + [ $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) + if [ $? -ne 0 ]; then + tst_resm TFAIL "$(tst_iface) is broken" + return 1 + fi + return 0 +} -- 1.7.1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list