Home | History | Annotate | Download | only in ping
      1 #! /bin/sh
      2 # Copyright (c) 2014-2016 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, see <http://www.gnu.org/licenses/>.
     17 #
     18 #  PURPOSE: To test the basic functionality of the `ping` command.
     19 #
     20 #  SETUP: If "RHOST" is not exported, then the local hostname is used.
     21 #
     22 #  HISTORY:
     23 #    06/06/03 Manoj Iyer manjo (at] mail.utexas.edu
     24 #    - Modified testcase to use test APIs and also fixed minor bugs
     25 #    03/01 Robbie Williamson (robbiew (at] us.ibm.com)
     26 #      -Ported
     27 
     28 TST_TOTAL=10
     29 TCID="ping01"
     30 
     31 . test_net.sh
     32 
     33 do_setup()
     34 {
     35 	COUNT=${COUNT:-3}
     36 	PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"}
     37 
     38 	PING_CMD=ping${TST_IPV6}
     39 
     40 	tst_check_cmds $PING_CMD
     41 }
     42 
     43 do_test()
     44 {
     45 	tst_resm TINFO "$PING_CMD with $PACKETSIZES ICMP packets"
     46 	local ipaddr=$(tst_ipaddr rhost)
     47 	for packetsize in $PACKETSIZES; do
     48 		EXPECT_PASS $PING_CMD -c $COUNT -s $packetsize $ipaddr \>/dev/null
     49 	done
     50 }
     51 
     52 do_setup
     53 do_test
     54 
     55 tst_exit
     56