dccp01.sh 865 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-or-later
  3. # Copyright (c) 2017-2018 Oracle and/or its affiliates. All Rights Reserved.
  4. TST_CNT=3
  5. TST_TESTFUNC="test"
  6. TST_NEEDS_TMPDIR=1
  7. TST_NEEDS_ROOT=1
  8. . tst_net.sh
  9. compare()
  10. {
  11. local per=$(( $res0 * 100 / $res1 - 100 ))
  12. if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
  13. tst_res TFAIL "$1 performance $per %"
  14. else
  15. tst_res TPASS "$1 performance $per % in range -100 ... 100 %"
  16. fi
  17. }
  18. test1()
  19. {
  20. tst_res TINFO "run UDP"
  21. tst_netload -H $(tst_ipaddr rhost) -T udp
  22. res0="$(cat tst_netload.res)"
  23. }
  24. test2()
  25. {
  26. tst_res TINFO "compare UDP/DCCP performance"
  27. tst_netload -H $(tst_ipaddr rhost) -T dccp
  28. res1="$(cat tst_netload.res)"
  29. compare DCCP
  30. }
  31. test3()
  32. {
  33. tst_res TINFO "compare UDP/UDP-Lite performance"
  34. tst_netload -H $(tst_ipaddr rhost) -T udp_lite
  35. res1="$(cat tst_netload.res)"
  36. compare UDP-Lite
  37. }
  38. tst_run