1#!/bin/sh 2# Copyright (c) 2018 Petr Vorel <pvorel@suse.cz> 3# 4# This program is free software; you can redistribute it and/or 5# modify it under the terms of the GNU General Public License as 6# published by the Free Software Foundation; either version 2 of 7# the License, or (at your option) any later version. 8# 9# This program is distributed in the hope that it would be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program; if not, write the Free Software Foundation, 16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17# 18# Author: Petr Vorel <pvorel@suse.cz> 19 20if_usage() 21{ 22 echo "-c Test command (ip, $IF_CMD)" 23} 24 25if_parse_args() 26{ 27 case $1 in 28 c) CMD="$2";; 29 esac 30} 31 32if_setup() 33{ 34 [ -n "$CMD" ] || tst_brk TBROK "IF_CMD variable not defined" 35 if [ "$CMD" != 'ip' -a "$CMD" != "$IF_CMD" ]; then 36 tst_brk TBROK "Missing or wrong -c parameter: '$CMD', use 'ip' or '$IF_CMD'" 37 fi 38 39 tst_test_cmds "$CMD" 40 netstress_setup 41 TST_CLEANUP="${TST_CLEANUP:-netstress_cleanup}" 42} 43 44if_cleanup_restore() 45{ 46 netstress_cleanup 47 restore_ipaddr 48 restore_ipaddr rhost 49} 50 51TST_SETUP="${TST_SETUP:-if_setup}" 52TST_TESTFUNC="test_body" 53TST_PARSE_ARGS="if_parse_args" 54TST_USAGE="if_usage" 55TST_OPTS="c:" 56 57. tst_net_stress.sh 58