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-stress01-rmt" 23 TST_TOTAL=1 24 25 . test.sh 26 27 tst_test_cmds awk curl 28 29 # Check the arguments 30 [ $# -ne 3 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename filesize" 31 32 server_ipaddr="$1" 33 filename="$2" 34 filesize="$3" 35 36 echo $server_ipaddr | grep -F ':' > /dev/null 37 if [ $? -eq 0 ]; then 38 server_ipaddr='['$server_ipaddr']' 39 fi 40 41 out=$(curl --noproxy '*' -sS -g "http://$server_ipaddr/$filename" -o /dev/null \ 42 -w "time=%{time_total} size=%{size_download} speed=%{speed_download}") 43 44 tst_resm TINFO "stat: $out" 45 recv_filesize=$(echo "$out" | awk '{print $2}') 46 47 if [ $recv_filesize != "size=$filesize" ]; then 48 tst_resm TINFO "expected file size '$filesize'" 49 tst_brkm TBROK "Failed to get http://${server_ipaddr}/${filename}" 50 fi 51 52 tst_exit 53