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 <[email protected]> 21 22TCID=http-stress 23TST_TOTAL=2 24TST_CLEANUP="cleanup" 25 26TST_USE_LEGACY_API=1 27 28cleanup() 29{ 30 rm -f $HTTP_DOWNLOAD_DIR/http_file 31} 32 33setup() 34{ 35 tst_require_root 36 37 tst_resm TINFO "run over IPv$TST_IPVER" 38 39 trap "tst_brkm TBROK 'test interrupted'" INT 40 41 [ -d "$HTTP_DOWNLOAD_DIR" ] || \ 42 tst_brkm TCONF "Start server manually, set HTTP_DOWNLOAD_DIR" 43 44 # As the apache with normal setting cannot handle the file whose size 45 # is bigger than or equal to 2G byte. Therefore, the file size is 46 # resetted into 2G - 1 byte." 47 if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then 48 tst_resm TINFO "Setting file size to 2G - 1 byte" 49 DOWNLOAD_BIGFILESIZE=2147483647 50 fi 51 52 create_file $HTTP_DOWNLOAD_DIR/http_file $DOWNLOAD_BIGFILESIZE || \ 53 tst_resm TBROK "Failed to create test file" 54} 55 56test01() 57{ 58 tst_resm TINFO "http client download test file" 59 60 tst_rhost_run -s -c "http-stress01-rmt.sh $(tst_ipaddr) \ 61 http_file $DOWNLOAD_BIGFILESIZE" 62 63 tst_resm TPASS "Test is finished successfully" 64} 65 66test02() 67{ 68 tst_resm TINFO "clients request data asynchronously $NS_DURATION sec" 69 70 tst_rhost_run -s -c "http-stress02-rmt.sh $(tst_ipaddr) http_file \ 71 $DOWNLOAD_BIGFILESIZE $NS_DURATION $CONNECTION_TOTAL" 72 73 tst_resm TPASS "Test is finished successfully" 74} 75 76. tst_net.sh 77setup 78test01 79test02 80tst_exit 81