1f08c3bdfSopenharmony_ci#!/bin/sh 2f08c3bdfSopenharmony_ci 3f08c3bdfSopenharmony_ci# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved. 4f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines Corp., 2005 5f08c3bdfSopenharmony_ci# 6f08c3bdfSopenharmony_ci# This program is free software; you can redistribute it and/or 7f08c3bdfSopenharmony_ci# modify it under the terms of the GNU General Public License as 8f08c3bdfSopenharmony_ci# published by the Free Software Foundation; either version 2 of 9f08c3bdfSopenharmony_ci# the License, or (at your option) any later version. 10f08c3bdfSopenharmony_ci# 11f08c3bdfSopenharmony_ci# This program is distributed in the hope that it would be useful, 12f08c3bdfSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 13f08c3bdfSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14f08c3bdfSopenharmony_ci# GNU General Public License for more details. 15f08c3bdfSopenharmony_ci# 16f08c3bdfSopenharmony_ci# You should have received a copy of the GNU General Public License 17f08c3bdfSopenharmony_ci# along with this program; if not, write the Free Software Foundation, 18f08c3bdfSopenharmony_ci# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19f08c3bdfSopenharmony_ci# 20f08c3bdfSopenharmony_ci# Author: Mitsuru Chinen <mitch@jp.ibm.com> 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_ciTCID="http-stress01-rmt" 23f08c3bdfSopenharmony_ciTST_TOTAL=1 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci. test.sh 26f08c3bdfSopenharmony_ci 27f08c3bdfSopenharmony_citst_require_cmds awk curl 28f08c3bdfSopenharmony_ci 29f08c3bdfSopenharmony_ci# Check the arguments 30f08c3bdfSopenharmony_ci[ $# -ne 3 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename filesize" 31f08c3bdfSopenharmony_ci 32f08c3bdfSopenharmony_ciserver_ipaddr="$1" 33f08c3bdfSopenharmony_cifilename="$2" 34f08c3bdfSopenharmony_cifilesize="$3" 35f08c3bdfSopenharmony_ci 36f08c3bdfSopenharmony_ciecho $server_ipaddr | grep -F ':' > /dev/null 37f08c3bdfSopenharmony_ciif [ $? -eq 0 ]; then 38f08c3bdfSopenharmony_ci server_ipaddr='['$server_ipaddr']' 39f08c3bdfSopenharmony_cifi 40f08c3bdfSopenharmony_ci 41f08c3bdfSopenharmony_ciout=$(curl --noproxy '*' -sS -g "http://$server_ipaddr/$filename" -o /dev/null \ 42f08c3bdfSopenharmony_ci -w "time=%{time_total} size=%{size_download} speed=%{speed_download}") 43f08c3bdfSopenharmony_ci 44f08c3bdfSopenharmony_citst_resm TINFO "stat: $out" 45f08c3bdfSopenharmony_cirecv_filesize=$(echo "$out" | awk '{print $2}') 46f08c3bdfSopenharmony_ci 47f08c3bdfSopenharmony_ciif [ $recv_filesize != "size=$filesize" ]; then 48f08c3bdfSopenharmony_ci tst_resm TINFO "expected file size '$filesize'" 49f08c3bdfSopenharmony_ci tst_brkm TBROK "Failed to get http://${server_ipaddr}/${filename}" 50f08c3bdfSopenharmony_cifi 51f08c3bdfSopenharmony_ci 52f08c3bdfSopenharmony_citst_exit 53