1#!/bin/sh 2 3# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. 4# Copyright (c) International Business Machines Corp., 2005 5# 6# This program is free software; you can redistribute it and/or 7# modify it under the terms of the GNU General Public License as 8# published by the Free Software Foundation; either version 2 of 9# the License, or (at your option) any later version. 10# 11# This program is distributed in the hope that it would be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, write the Free Software Foundation, 18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19# 20# Author: Mitsuru Chinen <mitch@jp.ibm.com> 21 22TCID=http-stress 23TST_TOTAL=2 24TST_CLEANUP="cleanup" 25 26TST_USE_LEGACY_API=1 27. tst_net.sh 28 29cleanup() 30{ 31 rm -f $HTTP_DOWNLOAD_DIR/http_file 32} 33 34setup() 35{ 36 tst_require_root 37 38 tst_resm TINFO "run over IPv$TST_IPVER" 39 40 trap "tst_brkm TBROK 'test interrupted'" INT 41 42 [ -d "$HTTP_DOWNLOAD_DIR" ] || \ 43 tst_brkm TCONF "Start server manually, set HTTP_DOWNLOAD_DIR" 44 45 # As the apache with normal setting cannot handle the file whose size 46 # is bigger than or equal to 2G byte. Therefore, the file size is 47 # resetted into 2G - 1 byte." 48 if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then 49 tst_resm TINFO "Setting file size to 2G - 1 byte" 50 DOWNLOAD_BIGFILESIZE=2147483647 51 fi 52 53 create_file $HTTP_DOWNLOAD_DIR/http_file $DOWNLOAD_BIGFILESIZE || \ 54 tst_resm TBROK "Failed to create test file" 55} 56 57test01() 58{ 59 tst_resm TINFO "http client download test file" 60 61 tst_rhost_run -s -c "http-stress01-rmt $(tst_ipaddr) \ 62 http_file $DOWNLOAD_BIGFILESIZE" 63 64 tst_resm TPASS "Test is finished successfully" 65} 66 67test02() 68{ 69 tst_resm TINFO "clients request data asynchronously $NS_DURATION sec" 70 71 tst_rhost_run -s -c "http-stress02-rmt $(tst_ipaddr) http_file \ 72 $DOWNLOAD_BIGFILESIZE $NS_DURATION $CONNECTION_TOTAL" 73 74 tst_resm TPASS "Test is finished successfully" 75} 76 77setup 78 79test01 80test02 81 82tst_exit 83