• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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@mail.utexas.edu
24#    - Modified testcase to use test APIs and also fixed minor bugs
25#    03/01 Robbie Williamson (robbiew@us.ibm.com)
26#      -Ported
27
28TST_TOTAL=10
29TCID="ping01"
30
31TST_USE_LEGACY_API=1
32. tst_net.sh
33
34do_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_test_cmds $PING_CMD
42}
43
44do_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		EXPECT_PASS $PING_CMD -c $COUNT -s $packetsize $ipaddr \>/dev/null
50	done
51}
52
53do_setup
54do_test
55
56tst_exit
57