http-stress.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. # Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
  3. # Copyright (c) International Business Machines Corp., 2005
  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, write the Free Software Foundation,
  17. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. #
  19. # Author: Mitsuru Chinen <mitch@jp.ibm.com>
  20. TCID=http-stress
  21. TST_TOTAL=2
  22. TST_CLEANUP="cleanup"
  23. TST_USE_LEGACY_API=1
  24. . tst_net.sh
  25. cleanup()
  26. {
  27. rm -f $HTTP_DOWNLOAD_DIR/http_file
  28. }
  29. setup()
  30. {
  31. tst_require_root
  32. tst_resm TINFO "run over IPv$TST_IPVER"
  33. trap "tst_brkm TBROK 'test interrupted'" INT
  34. [ -d "$HTTP_DOWNLOAD_DIR" ] || \
  35. tst_brkm TCONF "Start server manually, set HTTP_DOWNLOAD_DIR"
  36. # As the apache with normal setting cannot handle the file whose size
  37. # is bigger than or equal to 2G byte. Therefore, the file size is
  38. # resetted into 2G - 1 byte."
  39. if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then
  40. tst_resm TINFO "Setting file size to 2G - 1 byte"
  41. DOWNLOAD_BIGFILESIZE=2147483647
  42. fi
  43. create_file $HTTP_DOWNLOAD_DIR/http_file $DOWNLOAD_BIGFILESIZE || \
  44. tst_resm TBROK "Failed to create test file"
  45. }
  46. test01()
  47. {
  48. tst_resm TINFO "http client download test file"
  49. tst_rhost_run -s -c "http-stress01-rmt.sh $(tst_ipaddr) \
  50. http_file $DOWNLOAD_BIGFILESIZE"
  51. tst_resm TPASS "Test is finished successfully"
  52. }
  53. test02()
  54. {
  55. tst_resm TINFO "clients request data asynchronously $NS_DURATION sec"
  56. tst_rhost_run -s -c "http-stress02-rmt.sh $(tst_ipaddr) http_file \
  57. $DOWNLOAD_BIGFILESIZE $NS_DURATION $CONNECTION_TOTAL"
  58. tst_resm TPASS "Test is finished successfully"
  59. }
  60. setup
  61. test01
  62. test02
  63. tst_exit