1 #! /bin/sh 2 # Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved. 3 # Copyright (c) International Business Machines Corp., 2000 4 # 5 # This program is free software; you can redistribute it and/or 6 # modify it under the terms of the GNU General Public License as 7 # published by the Free Software Foundation; either version 2 of 8 # the License, or (at your option) any later version. 9 # 10 # This program is distributed in the hope that it would be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write the Free Software Foundation, 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 # 19 # PURPOSE: To test the basic functionality of the `ping` command. 20 # 21 # SETUP: If "RHOST" is not exported, then the local hostname is used. 22 # 23 # HISTORY: 24 # 06/06/03 Manoj Iyer manjo (at] mail.utexas.edu 25 # - Modified testcase to use test APIs and also fixed minor bugs 26 # 03/01 Robbie Williamson (robbiew (at] us.ibm.com) 27 # -Ported 28 29 TST_TOTAL=1 30 TCID="ping01" 31 32 . test_net.sh 33 34 do_setup() 35 { 36 COUNT=${COUNT:-3} 37 PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"} 38 39 PING_CMD=ping${TST_IPV6} 40 41 tst_check_cmds $PING_CMD 42 } 43 44 do_test() 45 { 46 tst_resm TINFO "$PING_CMD with $PACKETSIZES ICMP packets" 47 local ipaddr=$(tst_ipaddr rhost) 48 for packetsize in $PACKETSIZES; do 49 tst_resm TINFO "call $PING_CMD with packet size = $packetsize" 50 $PING_CMD -c $COUNT -s $packetsize $ipaddr > /dev/null 2>&1 51 if [ $? -ne 0 ]; then 52 tst_resm TFAIL "$PING_CMD -c $COUNT -s $packetsize $ipaddr" 53 return 54 fi 55 done 56 } 57 58 do_setup 59 do_test 60 61 tst_exit 62