ping01.sh 890 B

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