1f08c3bdfSopenharmony_ci#! /bin/sh
2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later
3f08c3bdfSopenharmony_ci# Copyright (c) 2014-2019 Oracle and/or its affiliates. All Rights Reserved.
4f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines Corp., 2000
5f08c3bdfSopenharmony_ci#
6f08c3bdfSopenharmony_ci# To test the basic functionality of the `ping` command.
7f08c3bdfSopenharmony_ci#
8f08c3bdfSopenharmony_ci#  HISTORY:
9f08c3bdfSopenharmony_ci#    06/06/03 Manoj Iyer manjo@mail.utexas.edu
10f08c3bdfSopenharmony_ci#    - Modified testcase to use test APIs and also fixed minor bugs
11f08c3bdfSopenharmony_ci#    03/01 Robbie Williamson (robbiew@us.ibm.com)
12f08c3bdfSopenharmony_ci#      -Ported
13f08c3bdfSopenharmony_ci
14f08c3bdfSopenharmony_ciTST_SETUP="do_setup"
15f08c3bdfSopenharmony_ciTST_TESTFUNC="do_test"
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci
18f08c3bdfSopenharmony_cido_setup()
19f08c3bdfSopenharmony_ci{
20f08c3bdfSopenharmony_ci	COUNT=${COUNT:-3}
21f08c3bdfSopenharmony_ci	PACKETSIZES=${PACKETSIZES:-"8 16 32 64 128 256 512 1024 2048 4064"}
22f08c3bdfSopenharmony_ci
23f08c3bdfSopenharmony_ci	PING_CMD=ping${TST_IPV6}
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci	tst_require_cmds $PING_CMD
26f08c3bdfSopenharmony_ci}
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_cido_test()
29f08c3bdfSopenharmony_ci{
30f08c3bdfSopenharmony_ci	tst_res TINFO "$PING_CMD with $PACKETSIZES ICMP packets"
31f08c3bdfSopenharmony_ci	local ipaddr=$(tst_ipaddr rhost)
32f08c3bdfSopenharmony_ci	local s
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ci	for s in $PACKETSIZES; do
35f08c3bdfSopenharmony_ci		EXPECT_PASS $PING_CMD -i 0.2 -c $COUNT -s $s $ipaddr \>/dev/null
36f08c3bdfSopenharmony_ci	done
37f08c3bdfSopenharmony_ci}
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci. tst_net.sh
40f08c3bdfSopenharmony_citst_run
41