Home | History | Annotate | Download | only in http
      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 (at] jp.ibm.com>
     21 
     22 TCID=http-stress
     23 TST_TOTAL=2
     24 TST_CLEANUP="cleanup"
     25 
     26 . test_net.sh
     27 
     28 cleanup()
     29 {
     30 	rm -f $HTTP_DOWNLOAD_DIR/http_file
     31 }
     32 
     33 setup()
     34 {
     35 	tst_require_root
     36 
     37 	ipver=${TST_IPV6:-'4'}
     38 	tst_resm TINFO "run over IPv$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 
     57 test01()
     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 
     67 test02()
     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 
     77 setup
     78 
     79 test01
     80 test02
     81 
     82 tst_exit
     83