* [LTP] [PATCH 1/6] network/stress/http: rename http4-stress
@ 2015-02-03 14:14 Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 2/6] network/stress/http: cleanup, use test_net.sh library Alexey Kodanev
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/stress/http/http-stress | 357 ++++++++++++++++++++++++++++
testcases/network/stress/http/http4-stress | 357 ----------------------------
2 files changed, 357 insertions(+), 357 deletions(-)
create mode 100644 testcases/network/stress/http/http-stress
delete mode 100644 testcases/network/stress/http/http4-stress
diff --git a/testcases/network/stress/http/http-stress b/testcases/network/stress/http/http-stress
new file mode 100644
index 0000000..07c812f
--- /dev/null
+++ b/testcases/network/stress/http/http-stress
@@ -0,0 +1,357 @@
+#!/bin/sh
+
+################################################################################
+## ##
+## Copyright (c) International Business Machines Corp., 2005 ##
+## ##
+## This program is free software; you can redistribute it and#or modify ##
+## it under the terms of the GNU General Public License as published by ##
+## the Free Software Foundation; either version 2 of the License, or ##
+## (at your option) any later version. ##
+## ##
+## This program is distributed in the hope that it will be useful, but ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
+## for more details. ##
+## ##
+## You should have received a copy of the GNU General Public License ##
+## along with this program; if not, write to the Free Software ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
+## ##
+## ##
+################################################################################
+#
+# File:
+# http4-stress
+#
+# Description:
+# Stress test for http over IPv4
+#
+# test01 - Verify the http server or the kernel is not down after
+# a http client requests large data
+# test02 - Verify the http server or the kernel is not down after
+# many http clients request data asynchronously for a long time
+#
+# Author:
+# Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+# Oct 19 2005 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
+export LTPROOT
+
+# Total number of the test case
+TST_TOTAL=2
+export TST_TOTAL
+
+# The version of IP
+IP_VER=${IP_VER:-4}
+
+# Default of the test case ID and the test case count
+TCID=http${IP_VER}-stress
+TST_COUNT=0
+export TCID
+export TST_COUNT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600} # 1 hour
+
+# Quantity of the connection for multi connection test
+CONNECTION_TOTAL=${CONNECTION_TOTAL:-4000}
+
+# Big file size to upload/download in ftp tests (byte)
+DOWNLOAD_BIGFILESIZE=${DOWNLOAD_BIGFILESIZE:-2147483647} # 2GB - 1byte
+
+# Regular file size to upload/download in ftp tests (byte)
+DOWNLOAD_REGFILESIZE=${DOWNLOAD_REGFILESIZE:-1048576} # 1MB
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
+
+# Host portion of the IPv4 address on the local host
+LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
+
+# Host portion of the IPv4 address on the remote host
+RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
+
+# Network portion of the IPv6 address
+IPV6_NETWORK="fd00:1:1:1"
+
+# Host portion of the IPv6 address of the local host
+LHOST_IPV6_HOST=":2"
+
+# Host portion of the IPv6 address of the remote host
+RHOST_IPV6_HOST=":1"
+
+# The test file name for downloading
+TESTFILE="http-stress.txt"
+
+#-----------------------------------------------------------------------
+#
+# Function:
+# do_cleanup
+#
+# Description:
+# Clean up after running http stress test
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+ # Delete the test file
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+
+ # Make sure to delete the temporary files
+ rm -f $message_file
+
+ # Initialize the interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function:
+# do_setup
+#
+# Description:
+# Setup for the http stress tests
+# - Assign IP address to the interfaces belong to the specified Link
+# - Run a httpd daemon for testing
+# - Create keys for password-less login
+#
+# Set Values:
+# lhost_addr: IP address of the local host
+# rhost_addr: IP address of the remote host
+# rhost_config: http_config at the remote host
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+ trap do_cleanup 0
+
+ # Check the environment variable HTTP_DOWNLOAD_DIR is set
+ if [ x$HTTP_DOWNLOAD_DIR = x ]; then
+ tst_resm TINFO "*) At this http stress test, the http server program does not run automatically. Please start the server manually and set the document root directory in the environment variable, HTTP_DOWNLOAD_DIR."
+ tst_resm TBROK "The environment variable HTTP_DOWNLOAD_DIR is not set"
+ exit 1
+ fi
+
+ # Initialize the interface
+ initialize_if lhost ${LINK_NUM}
+ initialize_if rhost ${LINK_NUM}
+
+ # Get the Interface name
+ lhost_ifname=`get_ifname lhost ${LINK_NUM}`
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to get the interface name at the local host"
+ exit $TST_TOTAL
+ fi
+
+ case $IP_VER in
+ 4)
+ # Set IPv4 address to the interfaces
+ set_ipv4addr lhost $LINK_NUM ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+ set_ipv4addr rhost $LINK_NUM ${IPV4_NETWORK} ${RHOST_IPV4_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ lhost_addr="${IPV4_NETWORK}.${LHOST_IPV4_HOST}"
+ rhost_addr="${IPV4_NETWORK}.${RHOST_IPV4_HOST}"
+ check_icmpv4_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to ping to $rhost_addr"
+ exit 1
+ fi
+ ;;
+
+ 6)
+ # Set IPv6 address to the interfaces
+ add_ipv6addr lhost $LINK_NUM ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the local host"
+ exit 1
+ fi
+ add_ipv6addr rhost $LINK_NUM ${IPV6_NETWORK} ${RHOST_IPV6_HOST}
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to add any IP address at the remote host"
+ exit 1
+ fi
+
+ lhost_addr="${IPV6_NETWORK}:${LHOST_IPV6_HOST}"
+ rhost_addr="${IPV6_NETWORK}:${RHOST_IPV6_HOST}"
+ check_icmpv6_connectivity $lhost_ifname $rhost_addr
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to ping to $rhost_addr"
+ exit 1
+ fi
+ ;;
+
+ *)
+ tst_resm TBROK "Unknown IP version: $IP_VER"
+ exit 1
+ ;;
+ esac
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function:
+# test01
+#
+# Description:
+# Verify the http server or the kernel is not down after a http
+# client requests large data
+#
+#-----------------------------------------------------------------------
+test01()
+{
+ TCID=http${IP_VER}-stress01
+ TST_COUNT=1
+ tst_resm TINFO "Verify the http server or the kernel is not down after a http client requests data whose size is $DOWNLOAD_BIGFILESIZE byte via IPv${IP_VER}"
+
+ # Create a test file for download
+ if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then
+ tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
+ DOWNLOAD_BIGFILESIZE=2147483647
+ fi
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+ create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_BIGFILESIZE
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
+ fi
+
+ # Script name at the remote host
+ rmtscript="http-stress01-rmt"
+
+ # Run the script at the remote host
+ message_file=`mktemp -p $TMPDIR`
+ not_run_rmtscript=true
+ for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
+ ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
+ if [ $ret -eq 0 ]; then
+ not_run_rmtscript=false
+ $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE" > $message_file
+ break
+ fi
+ done
+
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+
+ if $not_run_rmtscript ; then
+ tst_resm TBROK "Failed to run the test script at the remote host"
+ rm -f $message_file
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+ exit 1
+ fi
+
+ if [ -s $message_file ]; then
+ tst_resm TFAIL "`cat $message_file`"
+ rm -f $message_file
+ return 1
+ else
+ tst_resm TPASS "Test is finished successfully."
+ rm -f $message_file
+ return 0
+ fi
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function:
+# test02
+#
+# Description:
+# Verify the http server or the kernel is not down after many http
+# clients request data asynchronously for a long time
+#
+#-----------------------------------------------------------------------
+test02()
+{
+ TCID=http${IP_VER}-stress02
+ TST_COUNT=2
+ tst_resm TINFO "Verify the http server or the kernel is not down after many http clients request data over IPv${IP_VER} asynchronously in ${NS_DURATION}[sec]"
+ tst_resm TINFO "The number of client is not over $CONNECTION_TOTAL"
+
+ # Create a test file for download
+ if [ $DOWNLOAD_REGFILESIZE -gt 2147483647 ]; then
+ tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
+ DOWNLOAD_REGFILESIZE=2147483647
+ fi
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+ create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_REGFILESIZE
+ if [ $? -ne 0 ]; then
+ tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
+ fi
+
+ # Script name at the remote host
+ rmtscript="http-stress02-rmt"
+
+ # Run the script at the remote host
+ message_file=`mktemp -p $TMPDIR`
+ not_run_rmtscript=true
+ for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
+ ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
+ if [ $ret -eq 0 ]; then
+ not_run_rmtscript=false
+ $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE $NS_DURATION $CONNECTION_TOTAL" > $message_file 2>/dev/null
+ break
+ fi
+ done
+
+ rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+
+ if $not_run_rmtscript ; then
+ tst_resm TBROK "Failed to run the test script at the remote host"
+ rm -f $message_file
+ exit 1
+ fi
+
+ if [ -s $message_file ]; then
+ tst_resm TFAIL "`cat $message_file`"
+ rm -f $message_file
+ return 1
+ else
+ tst_resm TPASS "Test is finished successfully."
+ rm -f $message_file
+ return 0
+ fi
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+# Exit Value:
+# The number of the failure
+#
+#-----------------------------------------------------------------------
+
+RC=0
+do_setup
+test01 || RC=`expr $RC + 1`
+test02 || RC=`expr $RC + 1`
+
+exit $RC
diff --git a/testcases/network/stress/http/http4-stress b/testcases/network/stress/http/http4-stress
deleted file mode 100644
index 07c812f..0000000
--- a/testcases/network/stress/http/http4-stress
+++ /dev/null
@@ -1,357 +0,0 @@
-#!/bin/sh
-
-################################################################################
-## ##
-## Copyright (c) International Business Machines Corp., 2005 ##
-## ##
-## This program is free software; you can redistribute it and#or modify ##
-## it under the terms of the GNU General Public License as published by ##
-## the Free Software Foundation; either version 2 of the License, or ##
-## (at your option) any later version. ##
-## ##
-## This program is distributed in the hope that it will be useful, but ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
-## for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program; if not, write to the Free Software ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
-## ##
-## ##
-################################################################################
-#
-# File:
-# http4-stress
-#
-# Description:
-# Stress test for http over IPv4
-#
-# test01 - Verify the http server or the kernel is not down after
-# a http client requests large data
-# test02 - Verify the http server or the kernel is not down after
-# many http clients request data asynchronously for a long time
-#
-# Author:
-# Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-# Oct 19 2005 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
-TST_TOTAL=2
-export TST_TOTAL
-
-# The version of IP
-IP_VER=${IP_VER:-4}
-
-# Default of the test case ID and the test case count
-TCID=http${IP_VER}-stress
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Quantity of the connection for multi connection test
-CONNECTION_TOTAL=${CONNECTION_TOTAL:-4000}
-
-# Big file size to upload/download in ftp tests (byte)
-DOWNLOAD_BIGFILESIZE=${DOWNLOAD_BIGFILESIZE:-2147483647} # 2GB - 1byte
-
-# Regular file size to upload/download in ftp tests (byte)
-DOWNLOAD_REGFILESIZE=${DOWNLOAD_REGFILESIZE:-1048576} # 1MB
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv4 address
-IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
-
-# Host portion of the IPv4 address on the local host
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
-
-# Host portion of the IPv4 address on the remote host
-RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
-
-# Network portion of the IPv6 address
-IPV6_NETWORK="fd00:1:1:1"
-
-# Host portion of the IPv6 address of the local host
-LHOST_IPV6_HOST=":2"
-
-# Host portion of the IPv6 address of the remote host
-RHOST_IPV6_HOST=":1"
-
-# The test file name for downloading
-TESTFILE="http-stress.txt"
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# do_cleanup
-#
-# Description:
-# Clean up after running http stress test
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
- # Delete the test file
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
-
- # Make sure to delete the temporary files
- rm -f $message_file
-
- # Initialize the interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# do_setup
-#
-# Description:
-# Setup for the http stress tests
-# - Assign IP address to the interfaces belong to the specified Link
-# - Run a httpd daemon for testing
-# - Create keys for password-less login
-#
-# Set Values:
-# lhost_addr: IP address of the local host
-# rhost_addr: IP address of the remote host
-# rhost_config: http_config at the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
-{
- trap do_cleanup 0
-
- # Check the environment variable HTTP_DOWNLOAD_DIR is set
- if [ x$HTTP_DOWNLOAD_DIR = x ]; then
- tst_resm TINFO "*) At this http stress test, the http server program does not run automatically. Please start the server manually and set the document root directory in the environment variable, HTTP_DOWNLOAD_DIR."
- tst_resm TBROK "The environment variable HTTP_DOWNLOAD_DIR is not set"
- exit 1
- fi
-
- # Initialize the interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
-
- # Get the Interface name
- lhost_ifname=`get_ifname lhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
-
- case $IP_VER in
- 4)
- # Set IPv4 address to the interfaces
- set_ipv4addr lhost $LINK_NUM ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
- set_ipv4addr rhost $LINK_NUM ${IPV4_NETWORK} ${RHOST_IPV4_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- lhost_addr="${IPV4_NETWORK}.${LHOST_IPV4_HOST}"
- rhost_addr="${IPV4_NETWORK}.${RHOST_IPV4_HOST}"
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to ping to $rhost_addr"
- exit 1
- fi
- ;;
-
- 6)
- # Set IPv6 address to the interfaces
- add_ipv6addr lhost $LINK_NUM ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
- add_ipv6addr rhost $LINK_NUM ${IPV6_NETWORK} ${RHOST_IPV6_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- lhost_addr="${IPV6_NETWORK}:${LHOST_IPV6_HOST}"
- rhost_addr="${IPV6_NETWORK}:${RHOST_IPV6_HOST}"
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to ping to $rhost_addr"
- exit 1
- fi
- ;;
-
- *)
- tst_resm TBROK "Unknown IP version: $IP_VER"
- exit 1
- ;;
- esac
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# test01
-#
-# Description:
-# Verify the http server or the kernel is not down after a http
-# client requests large data
-#
-#-----------------------------------------------------------------------
-test01()
-{
- TCID=http${IP_VER}-stress01
- TST_COUNT=1
- tst_resm TINFO "Verify the http server or the kernel is not down after a http client requests data whose size is $DOWNLOAD_BIGFILESIZE byte via IPv${IP_VER}"
-
- # Create a test file for download
- if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then
- tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
- DOWNLOAD_BIGFILESIZE=2147483647
- fi
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_BIGFILESIZE
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
- fi
-
- # Script name at the remote host
- rmtscript="http-stress01-rmt"
-
- # Run the script at the remote host
- message_file=`mktemp -p $TMPDIR`
- not_run_rmtscript=true
- for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
- ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
- if [ $ret -eq 0 ]; then
- not_run_rmtscript=false
- $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE" > $message_file
- break
- fi
- done
-
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
-
- if $not_run_rmtscript ; then
- tst_resm TBROK "Failed to run the test script at the remote host"
- rm -f $message_file
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- exit 1
- fi
-
- if [ -s $message_file ]; then
- tst_resm TFAIL "`cat $message_file`"
- rm -f $message_file
- return 1
- else
- tst_resm TPASS "Test is finished successfully."
- rm -f $message_file
- return 0
- fi
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# test02
-#
-# Description:
-# Verify the http server or the kernel is not down after many http
-# clients request data asynchronously for a long time
-#
-#-----------------------------------------------------------------------
-test02()
-{
- TCID=http${IP_VER}-stress02
- TST_COUNT=2
- tst_resm TINFO "Verify the http server or the kernel is not down after many http clients request data over IPv${IP_VER} asynchronously in ${NS_DURATION}[sec]"
- tst_resm TINFO "The number of client is not over $CONNECTION_TOTAL"
-
- # Create a test file for download
- if [ $DOWNLOAD_REGFILESIZE -gt 2147483647 ]; then
- tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
- DOWNLOAD_REGFILESIZE=2147483647
- fi
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_REGFILESIZE
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
- fi
-
- # Script name at the remote host
- rmtscript="http-stress02-rmt"
-
- # Run the script at the remote host
- message_file=`mktemp -p $TMPDIR`
- not_run_rmtscript=true
- for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
- ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
- if [ $ret -eq 0 ]; then
- not_run_rmtscript=false
- $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE $NS_DURATION $CONNECTION_TOTAL" > $message_file 2>/dev/null
- break
- fi
- done
-
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
-
- if $not_run_rmtscript ; then
- tst_resm TBROK "Failed to run the test script at the remote host"
- rm -f $message_file
- exit 1
- fi
-
- if [ -s $message_file ]; then
- tst_resm TFAIL "`cat $message_file`"
- rm -f $message_file
- return 1
- else
- tst_resm TPASS "Test is finished successfully."
- rm -f $message_file
- return 0
- fi
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-# The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test01 || RC=`expr $RC + 1`
-test02 || RC=`expr $RC + 1`
-
-exit $RC
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 2/6] network/stress/http: cleanup, use test_net.sh library
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
@ 2015-02-03 14:14 ` Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 3/6] network/stress/http: check downloaded file size Alexey Kodanev
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/stress/http/00_Descriptions.txt | 16 +-
testcases/network/stress/http/http-stress | 366 +++------------------
testcases/network/stress/http/http-stress01-rmt | 91 ++----
testcases/network/stress/http/http-stress02-rmt | 126 +++-----
4 files changed, 121 insertions(+), 478 deletions(-)
diff --git a/testcases/network/stress/http/00_Descriptions.txt b/testcases/network/stress/http/00_Descriptions.txt
index 2823987..a0b2032 100644
--- a/testcases/network/stress/http/00_Descriptions.txt
+++ b/testcases/network/stress/http/00_Descriptions.txt
@@ -1,15 +1,7 @@
-http4-stress01
+http-stress01
Verify the http server or the kernel is not down after a http client
- requests large data via IPv4
+ requests large data via IPv4/IPv6
-http4-stress02
+http-stress02
Verify the http server or the kernel is not down after many http
- clients request data over IPv4 asynchronously for a long time
-
-http6-stress01
- Verify the http server or the kernel is not down after a http client
- requests large data via IPv6
-
-http6-stress02
- Verify the http server or the kernel is not down after many http
- clients request data over IPv6 asynchronously for a long time
+ clients request data over IPv4/IPv6 asynchronously for a long time
diff --git a/testcases/network/stress/http/http-stress b/testcases/network/stress/http/http-stress
index 07c812f..1dd2f4b 100644
--- a/testcases/network/stress/http/http-stress
+++ b/testcases/network/stress/http/http-stress
@@ -1,357 +1,81 @@
#!/bin/sh
-################################################################################
-## ##
-## Copyright (c) International Business Machines Corp., 2005 ##
-## ##
-## This program is free software; you can redistribute it and#or modify ##
-## it under the terms of the GNU General Public License as published by ##
-## the Free Software Foundation; either version 2 of the License, or ##
-## (at your option) any later version. ##
-## ##
-## This program is distributed in the hope that it will be useful, but ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
-## for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program; if not, write to the Free Software ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
-## ##
-## ##
-################################################################################
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2005
#
-# File:
-# http4-stress
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# Description:
-# Stress test for http over IPv4
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# test01 - Verify the http server or the kernel is not down after
-# a http client requests large data
-# test02 - Verify the http server or the kernel is not down after
-# many http clients request data asynchronously for a long time
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Author:
-# Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-# Oct 19 2005 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../../ ; pwd)`}
-export LTPROOT
-
-# Total number of the test case
+TCID=http-stress
TST_TOTAL=2
-export TST_TOTAL
-
-# The version of IP
-IP_VER=${IP_VER:-4}
-
-# Default of the test case ID and the test case count
-TCID=http${IP_VER}-stress
-TST_COUNT=0
-export TCID
-export TST_COUNT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600} # 1 hour
-
-# Quantity of the connection for multi connection test
-CONNECTION_TOTAL=${CONNECTION_TOTAL:-4000}
-
-# Big file size to upload/download in ftp tests (byte)
-DOWNLOAD_BIGFILESIZE=${DOWNLOAD_BIGFILESIZE:-2147483647} # 2GB - 1byte
-
-# Regular file size to upload/download in ftp tests (byte)
-DOWNLOAD_REGFILESIZE=${DOWNLOAD_REGFILESIZE:-1048576} # 1MB
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-# Network portion of the IPv4 address
-IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
-
-# Host portion of the IPv4 address on the local host
-LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
-
-# Host portion of the IPv4 address on the remote host
-RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
-
-# Network portion of the IPv6 address
-IPV6_NETWORK="fd00:1:1:1"
+TST_CLEANUP="cleanup"
-# Host portion of the IPv6 address of the local host
-LHOST_IPV6_HOST=":2"
+. test_net.sh
-# Host portion of the IPv6 address of the remote host
-RHOST_IPV6_HOST=":1"
-
-# The test file name for downloading
-TESTFILE="http-stress.txt"
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# do_cleanup
-#
-# Description:
-# Clean up after running http stress test
-#
-#-----------------------------------------------------------------------
-do_cleanup()
+cleanup()
{
- # Delete the test file
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
-
- # Make sure to delete the temporary files
- rm -f $message_file
-
- # Initialize the interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ rm -f $HTTP_DOWNLOAD_DIR/http_file
}
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# do_setup
-#
-# Description:
-# Setup for the http stress tests
-# - Assign IP address to the interfaces belong to the specified Link
-# - Run a httpd daemon for testing
-# - Create keys for password-less login
-#
-# Set Values:
-# lhost_addr: IP address of the local host
-# rhost_addr: IP address of the remote host
-# rhost_config: http_config at the remote host
-#
-#-----------------------------------------------------------------------
-do_setup()
+setup()
{
- trap do_cleanup 0
+ tst_require_root
- # Check the environment variable HTTP_DOWNLOAD_DIR is set
- if [ x$HTTP_DOWNLOAD_DIR = x ]; then
- tst_resm TINFO "*) At this http stress test, the http server program does not run automatically. Please start the server manually and set the document root directory in the environment variable, HTTP_DOWNLOAD_DIR."
- tst_resm TBROK "The environment variable HTTP_DOWNLOAD_DIR is not set"
- exit 1
- fi
+ ipver=${TST_IPV6:-'4'}
+ tst_resm TINFO "run over IPv$ipver"
- # Initialize the interface
- initialize_if lhost ${LINK_NUM}
- initialize_if rhost ${LINK_NUM}
+ trap "tst_brkm TBROK 'test interrupted'" INT
- # Get the Interface name
- lhost_ifname=`get_ifname lhost ${LINK_NUM}`
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to get the interface name at the local host"
- exit $TST_TOTAL
- fi
+ [ -d "$HTTP_DOWNLOAD_DIR" ] || \
+ tst_brkm TCONF "Start server manually, set HTTP_DOWNLOAD_DIR"
- case $IP_VER in
- 4)
- # Set IPv4 address to the interfaces
- set_ipv4addr lhost $LINK_NUM ${IPV4_NETWORK} ${LHOST_IPV4_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
- set_ipv4addr rhost $LINK_NUM ${IPV4_NETWORK} ${RHOST_IPV4_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
+ # As the apache with normal setting cannot handle the file whose size
+ # is bigger than or equal to 2G byte. Therefore, the file size is
+ # resetted into 2G - 1 byte."
+ if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then
+ tst_resm TINFO "Setting file size to 2G - 1 byte"
+ DOWNLOAD_BIGFILESIZE=2147483647
fi
- lhost_addr="${IPV4_NETWORK}.${LHOST_IPV4_HOST}"
- rhost_addr="${IPV4_NETWORK}.${RHOST_IPV4_HOST}"
- check_icmpv4_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to ping to $rhost_addr"
- exit 1
- fi
- ;;
-
- 6)
- # Set IPv6 address to the interfaces
- add_ipv6addr lhost $LINK_NUM ${IPV6_NETWORK} ${LHOST_IPV6_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the local host"
- exit 1
- fi
- add_ipv6addr rhost $LINK_NUM ${IPV6_NETWORK} ${RHOST_IPV6_HOST}
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to add any IP address at the remote host"
- exit 1
- fi
-
- lhost_addr="${IPV6_NETWORK}:${LHOST_IPV6_HOST}"
- rhost_addr="${IPV6_NETWORK}:${RHOST_IPV6_HOST}"
- check_icmpv6_connectivity $lhost_ifname $rhost_addr
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to ping to $rhost_addr"
- exit 1
- fi
- ;;
-
- *)
- tst_resm TBROK "Unknown IP version: $IP_VER"
- exit 1
- ;;
- esac
+ create_file $HTTP_DOWNLOAD_DIR/http_file $DOWNLOAD_BIGFILESIZE || \
+ tst_resm TBROK "Failed to create test file"
}
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# test01
-#
-# Description:
-# Verify the http server or the kernel is not down after a http
-# client requests large data
-#
-#-----------------------------------------------------------------------
test01()
{
- TCID=http${IP_VER}-stress01
- TST_COUNT=1
- tst_resm TINFO "Verify the http server or the kernel is not down after a http client requests data whose size is $DOWNLOAD_BIGFILESIZE byte via IPv${IP_VER}"
-
- # Create a test file for download
- if [ $DOWNLOAD_BIGFILESIZE -gt 2147483647 ]; then
- tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
- DOWNLOAD_BIGFILESIZE=2147483647
- fi
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_BIGFILESIZE
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
- fi
-
- # Script name at the remote host
- rmtscript="http-stress01-rmt"
-
- # Run the script at the remote host
- message_file=`mktemp -p $TMPDIR`
- not_run_rmtscript=true
- for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
- ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
- if [ $ret -eq 0 ]; then
- not_run_rmtscript=false
- $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE" > $message_file
- break
- fi
- done
+ tst_resm TINFO "http client download test file"
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+ tst_rhost_run -s -c "http-stress01-rmt $(tst_ipaddr) http_file"
- if $not_run_rmtscript ; then
- tst_resm TBROK "Failed to run the test script at the remote host"
- rm -f $message_file
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- exit 1
- fi
-
- if [ -s $message_file ]; then
- tst_resm TFAIL "`cat $message_file`"
- rm -f $message_file
- return 1
- else
- tst_resm TPASS "Test is finished successfully."
- rm -f $message_file
- return 0
- fi
+ tst_resm TPASS "Test is finished successfully"
}
-
-#-----------------------------------------------------------------------
-#
-# Function:
-# test02
-#
-# Description:
-# Verify the http server or the kernel is not down after many http
-# clients request data asynchronously for a long time
-#
-#-----------------------------------------------------------------------
test02()
{
- TCID=http${IP_VER}-stress02
- TST_COUNT=2
- tst_resm TINFO "Verify the http server or the kernel is not down after many http clients request data over IPv${IP_VER} asynchronously in ${NS_DURATION}[sec]"
- tst_resm TINFO "The number of client is not over $CONNECTION_TOTAL"
-
- # Create a test file for download
- if [ $DOWNLOAD_REGFILESIZE -gt 2147483647 ]; then
- tst_resm TINFO "As the apache with normal setting cannot handle the file whose size is bigger than or equal to 2G byte. Therefore, the file size is resetted into 2G - 1 byte."
- DOWNLOAD_REGFILESIZE=2147483647
- fi
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
- create_file $HTTP_DOWNLOAD_DIR/$TESTFILE $DOWNLOAD_REGFILESIZE
- if [ $? -ne 0 ]; then
- tst_resm TBROK "Failed to create $HTTP_DOWNLOAD_DIR/$TESTFILE"
- fi
-
- # Script name at the remote host
- rmtscript="http-stress02-rmt"
+ tst_resm TINFO "clients request data asynchronously $NS_DURATION sec"
- # Run the script at the remote host
- message_file=`mktemp -p $TMPDIR`
- not_run_rmtscript=true
- for rmtdir in ${LTPROOT}/testcases/bin ${PWD} ; do
- ret=`$LTP_RSH $RHOST 'test -x '${rmtdir}/${rmtscript}' ; echo $?'`
- if [ $ret -eq 0 ]; then
- not_run_rmtscript=false
- $LTP_RSH $RHOST "${rmtdir}/${rmtscript} $lhost_addr $TESTFILE $NS_DURATION $CONNECTION_TOTAL" > $message_file 2>/dev/null
- break
- fi
- done
-
- rm -f $HTTP_DOWNLOAD_DIR/$TESTFILE
+ tst_rhost_run -s -c "http-stress02-rmt $(tst_ipaddr) http_file \
+ $NS_DURATION $CONNECTION_TOTAL"
- if $not_run_rmtscript ; then
- tst_resm TBROK "Failed to run the test script at the remote host"
- rm -f $message_file
- exit 1
- fi
-
- if [ -s $message_file ]; then
- tst_resm TFAIL "`cat $message_file`"
- rm -f $message_file
- return 1
- else
- tst_resm TPASS "Test is finished successfully."
- rm -f $message_file
- return 0
- fi
+ tst_resm TPASS "Test is finished successfully"
}
+setup
-#-----------------------------------------------------------------------
-#
-# Main
-#
-# Exit Value:
-# The number of the failure
-#
-#-----------------------------------------------------------------------
-
-RC=0
-do_setup
-test01 || RC=`expr $RC + 1`
-test02 || RC=`expr $RC + 1`
+test01
+test02
-exit $RC
+tst_exit
diff --git a/testcases/network/stress/http/http-stress01-rmt b/testcases/network/stress/http/http-stress01-rmt
index 4a6be45..2567889 100644
--- a/testcases/network/stress/http/http-stress01-rmt
+++ b/testcases/network/stress/http/http-stress01-rmt
@@ -1,78 +1,43 @@
#!/bin/sh
-################################################################################
-## ##
-## Copyright (c) International Business Machines Corp., 2005 ##
-## ##
-## This program is free software; you can redistribute it and#or modify ##
-## it under the terms of the GNU General Public License as published by ##
-## the Free Software Foundation; either version 2 of the License, or ##
-## (at your option) any later version. ##
-## ##
-## This program is distributed in the hope that it will be useful, but ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
-## for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program; if not, write to the Free Software ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
-## ##
-## ##
-################################################################################
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2005
#
-# File:
-# http-stress01-rmt
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# Description:
-# This is the remote script for http-ipv${IP_VER}-stress01
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# Author:
-# Mitsuru Chinen <mitch@jp.ibm.com>
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Arguments:
-# $1: ip address of the server
-# $2: filename to download
-#
-# Exit Value:
-# 0: Success
-# >0: Fail
-#
-# History:
-# Oct 19 2005 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+TCID="http-stress01-rmt"
+TST_TOTAL=1
+
+. test_net.sh
+
+tst_check_cmds curl
# Check the arguments
-if [ $# -ne 2 ]; then
- echo "Usage: $0 server_ipaddr filename"
- exit 1
-fi
+[ $# -ne 2 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename"
+
server_ipaddr="$1"
filename="$2"
-echo $server_ipaddr | fgrep ':' >/dev/null 2>&1
+echo $server_ipaddr | grep -F ':' > /dev/null
if [ $? -eq 0 ]; then
- server_ipaddr='['$server_ipaddr']'
-fi
-
-# Check the curl command is available
-which curl >/dev/null 2>&1
-if [ $? -ne 0 ]; then
- echo "The remote host does not have curl command."
- exit 1
+ server_ipaddr='['$server_ipaddr']'
fi
-#
-# Download the test file
-#
-curl -g "http://${server_ipaddr}/${filename}" -o /dev/null >/dev/null 2>&1
-if [ $? -ne 0 ]; then
- echo "Failed to download the file from http://${server_ipaddr}/${filename}"
- exit 1
-fi
+curl -g "http://$server_ipaddr/$filename" -o /dev/null || \
+ tst_brkm TBROK "Failed to get http://${server_ipaddr}/${filename}"
-exit 0
+tst_exit
diff --git a/testcases/network/stress/http/http-stress02-rmt b/testcases/network/stress/http/http-stress02-rmt
index f2c1296..b59a75e 100644
--- a/testcases/network/stress/http/http-stress02-rmt
+++ b/testcases/network/stress/http/http-stress02-rmt
@@ -1,105 +1,67 @@
#!/bin/sh
-################################################################################
-## ##
-## Copyright (c) International Business Machines Corp., 2005 ##
-## ##
-## This program is free software; you can redistribute it and#or modify ##
-## it under the terms of the GNU General Public License as published by ##
-## the Free Software Foundation; either version 2 of the License, or ##
-## (at your option) any later version. ##
-## ##
-## This program is distributed in the hope that it will be useful, but ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
-## for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program; if not, write to the Free Software ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
-## ##
-## ##
-################################################################################
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines Corp., 2005
#
-# File:
-# http-stress02-rmt
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
#
-# Description:
-# This is the remote script for http-ipv${IP_VER}-stress02
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# Author:
-# Mitsuru Chinen <mitch@jp.ibm.com>
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
-# Arguments:
-# $1: ip address of the server
-# $2: filename to download
-# $3: duration
-# $4: connect quantity
-#
-# Exit Value:
-# 0: Success
-# >0: Fail
-#
-# History:
-# Oct 19 2005 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+TCID="http-stress02-rmt"
+TST_TOTAL=1
+
+. test_net.sh
+
+tst_check_cmds curl
-# Check the arguments
if [ $# -ne 4 ]; then
- echo "Usage: $0 server_addr filename duration connect_quantity"
- exit 1
+ tst_brkm TBROK "Usage: $0 server_addr filename duration connections"
fi
+
server_ipaddr="$1"
filename="$2"
duration="$3"
-connect_quantity="$4"
+connections="$4"
-echo $server_ipaddr | fgrep ':' >/dev/null 2>&1
+echo $server_ipaddr | grep -F ':' > /dev/null
if [ $? -eq 0 ]; then
- server_ipaddr='['$server_ipaddr']'
+ server_ipaddr='['$server_ipaddr']'
fi
-# Unset the maximum number of processes
-ulimit -u unlimited
-
-#
-# Main loop
-#
-start_epoc=`date +%s`
+start_epoc=$(date +%s)
while true ; do
- # Exit when the specified seconds have passed.
- current_epoc=`date +%s`
- elapse_epoc=`expr $current_epoc - $start_epoc`
- if [ $elapse_epoc -ge $duration ]; then
- break
- fi
+ # Exit when the specified seconds have passed.
+ current_epoc=$(date +%s)
+ elapse_epoc=$(($current_epoc - $start_epoc))
+
+ [ $elapse_epoc -ge $duration ] && break
- # Do not request the file over the specified quontity
- http_num=`ps auxw | grep -v grep | grep -- "curl -g.*$filename" | wc -l`
- if [ $http_num -ge $connect_quantity ]; then
- sleep 1
- continue;
- fi
+ # Do not request the file over the specified quantity
+ http_num=$(jobs | wc -l)
+ if [ $http_num -ge $connections ]; then
+ sleep 1
+ continue;
+ fi
- # Login to the server
- curl -g "http://${server_ipaddr}/${filename}" -o /dev/null >/dev/null 2>&1 &
+ # Login to the server
+ curl -s -g "http://$server_ipaddr/$filename" > /dev/null 2>&1 &
done
-# kill the curl command
-killall -SIGINT curl >/dev/null 2>&1
-sleep 3
-killall -SIGKILL curl >/dev/null 2>&1
-wait
+killall -qw -s SIGPIPE curl
-# Check the test file is abole to be downloaded
-curl -g "http://${server_ipaddr}/${filename}" -o /dev/null >/dev/null 2>&1
-if [ $? -ne 0 ]; then
- echo "Failed to download the file from http://${server_ipaddr}/${filename}"
- exit 1
-fi
+curl -g "http://$server_ipaddr/$filename" -o /dev/null || \
+ tst_brkm TBROK "Failed to get http://$server_ipaddr/$filename"
-exit 0
+tst_exit
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 3/6] network/stress/http: check downloaded file size
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 2/6] network/stress/http: cleanup, use test_net.sh library Alexey Kodanev
@ 2015-02-03 14:14 ` Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 4/6] lib/network.sh: add default http server directory Alexey Kodanev
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/stress/http/http-stress | 5 ++-
testcases/network/stress/http/http-stress01-rmt | 15 +++++++++++--
testcases/network/stress/http/http-stress02-rmt | 25 +++++++++++++++-------
3 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/testcases/network/stress/http/http-stress b/testcases/network/stress/http/http-stress
index 1dd2f4b..db18237 100644
--- a/testcases/network/stress/http/http-stress
+++ b/testcases/network/stress/http/http-stress
@@ -58,7 +58,8 @@ test01()
{
tst_resm TINFO "http client download test file"
- tst_rhost_run -s -c "http-stress01-rmt $(tst_ipaddr) http_file"
+ tst_rhost_run -s -c "http-stress01-rmt $(tst_ipaddr) \
+ http_file $DOWNLOAD_BIGFILESIZE"
tst_resm TPASS "Test is finished successfully"
}
@@ -68,7 +69,7 @@ test02()
tst_resm TINFO "clients request data asynchronously $NS_DURATION sec"
tst_rhost_run -s -c "http-stress02-rmt $(tst_ipaddr) http_file \
- $NS_DURATION $CONNECTION_TOTAL"
+ $DOWNLOAD_BIGFILESIZE $NS_DURATION $CONNECTION_TOTAL"
tst_resm TPASS "Test is finished successfully"
}
diff --git a/testcases/network/stress/http/http-stress01-rmt b/testcases/network/stress/http/http-stress01-rmt
index 2567889..9799007 100644
--- a/testcases/network/stress/http/http-stress01-rmt
+++ b/testcases/network/stress/http/http-stress01-rmt
@@ -24,20 +24,29 @@ TST_TOTAL=1
. test_net.sh
-tst_check_cmds curl
+tst_check_cmds awk curl
# Check the arguments
-[ $# -ne 2 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename"
+[ $# -ne 3 ] && tst_brkm TBROK "Usage: $0 server_ipaddr filename filesize"
server_ipaddr="$1"
filename="$2"
+filesize="$3"
echo $server_ipaddr | grep -F ':' > /dev/null
if [ $? -eq 0 ]; then
server_ipaddr='['$server_ipaddr']'
fi
-curl -g "http://$server_ipaddr/$filename" -o /dev/null || \
+out=$(curl --noproxy '*' -sS -g "http://$server_ipaddr/$filename" -o /dev/null \
+ -w "time=%{time_total} size=%{size_download} speed=%{speed_download}")
+
+tst_resm TINFO "stat: $out"
+recv_filesize=$(echo "$out" | awk '{print $2}')
+
+if [ $recv_filesize != "size=$filesize" ]; then
+ tst_resm TINFO "expected file size '$filesize'"
tst_brkm TBROK "Failed to get http://${server_ipaddr}/${filename}"
+fi
tst_exit
diff --git a/testcases/network/stress/http/http-stress02-rmt b/testcases/network/stress/http/http-stress02-rmt
index b59a75e..db21be4 100644
--- a/testcases/network/stress/http/http-stress02-rmt
+++ b/testcases/network/stress/http/http-stress02-rmt
@@ -24,16 +24,17 @@ TST_TOTAL=1
. test_net.sh
-tst_check_cmds curl
+tst_check_cmds awk curl
-if [ $# -ne 4 ]; then
- tst_brkm TBROK "Usage: $0 server_addr filename duration connections"
+if [ $# -ne 5 ]; then
+ tst_brkm TBROK "Usage: $0 server_addr fname fsize duration connections"
fi
server_ipaddr="$1"
filename="$2"
-duration="$3"
-connections="$4"
+filesize="$3"
+duration="$4"
+connections="$5"
echo $server_ipaddr | grep -F ':' > /dev/null
if [ $? -eq 0 ]; then
@@ -55,13 +56,21 @@ while true ; do
continue;
fi
- # Login to the server
- curl -s -g "http://$server_ipaddr/$filename" > /dev/null 2>&1 &
+ curl --noproxy '*' -s -g "http://$server_ipaddr/$filename" \
+ -o /dev/null &
done
killall -qw -s SIGPIPE curl
-curl -g "http://$server_ipaddr/$filename" -o /dev/null || \
+out=$(curl --noproxy '*' -sS -g "http://$server_ipaddr/$filename" -o /dev/null \
+ -w "time=%{time_total} size=%{size_download} speed=%{speed_download}")
+
+tst_resm TINFO "stat: $out"
+recv_filesize=$(echo "$out" | awk '{print $2}')
+
+if [ $recv_filesize != "size=$filesize" ]; then
+ tst_resm TINFO "expected file size '$filesize'"
tst_brkm TBROK "Failed to get http://$server_ipaddr/$filename"
+fi
tst_exit
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 4/6] lib/network.sh: add default http server directory
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 2/6] network/stress/http: cleanup, use test_net.sh library Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 3/6] network/stress/http: check downloaded file size Alexey Kodanev
@ 2015-02-03 14:14 ` Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 5/6] runtest/network-stress.appl: fix http test names Alexey Kodanev
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testscripts/network.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testscripts/network.sh b/testscripts/network.sh
index b9e1847..a1812eb 100755
--- a/testscripts/network.sh
+++ b/testscripts/network.sh
@@ -49,7 +49,7 @@ export LHOST_IPV6_REV=${LHOST_IPV6_REV:-"2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"}
# Reverse host portion of the IPv6 address of the remote host
export RHOST_IPV6_REV=${RHOST_IPV6_REV:-"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0"}
-export HTTP_DOWNLOAD_DIR=${HTTP_DOWNLOAD_DIR:-""}
+export HTTP_DOWNLOAD_DIR=${HTTP_DOWNLOAD_DIR:-"/var/www/html"}
export FTP_DOWNLOAD_DIR=${FTP_DOWNLOAD_DIR:-""}
export FTP_UPLOAD_DIR=${FTP_UPLOAD_DIR:-""}
export FTP_UPLOAD_URLDIR=${FTP_UPLOAD_URLDIR:-""}
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 5/6] runtest/network-stress.appl: fix http test names
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
` (2 preceding siblings ...)
2015-02-03 14:14 ` [LTP] [PATCH 4/6] lib/network.sh: add default http server directory Alexey Kodanev
@ 2015-02-03 14:14 ` Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 6/6] network/stress/http: remove http6-stress Alexey Kodanev
2015-05-20 8:47 ` [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
runtest/network_stress.appl | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/runtest/network_stress.appl b/runtest/network_stress.appl
index 91dbdd3..308751c 100644
--- a/runtest/network_stress.appl
+++ b/runtest/network_stress.appl
@@ -8,8 +8,8 @@ ssh6-stress ssh-stress -6
dns4-stress dns-stress
dns6-stress dns-stress -6
-http4-stress http4-stress
-http6-stress http6-stress
+http4-stress http-stress
+http6-stress http-stress -6
ftp4-download-stress ftp4-download-stress
ftp6-download-stress ftp6-download-stress
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 6/6] network/stress/http: remove http6-stress
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
` (3 preceding siblings ...)
2015-02-03 14:14 ` [LTP] [PATCH 5/6] runtest/network-stress.appl: fix http test names Alexey Kodanev
@ 2015-02-03 14:14 ` Alexey Kodanev
2015-05-20 8:47 ` [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-02-03 14:14 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/network/stress/http/http6-stress | 47 ----------------------------
1 files changed, 0 insertions(+), 47 deletions(-)
delete mode 100644 testcases/network/stress/http/http6-stress
diff --git a/testcases/network/stress/http/http6-stress b/testcases/network/stress/http/http6-stress
deleted file mode 100644
index a316967..0000000
--- a/testcases/network/stress/http/http6-stress
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-
-################################################################################
-## ##
-## Copyright (c) International Business Machines Corp., 2005 ##
-## ##
-## This program is free software; you can redistribute it and#or modify ##
-## it under the terms of the GNU General Public License as published by ##
-## the Free Software Foundation; either version 2 of the License, or ##
-## (at your option) any later version. ##
-## ##
-## This program is distributed in the hope that it will be useful, but ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
-## for more details. ##
-## ##
-## You should have received a copy of the GNU General Public License ##
-## along with this program; if not, write to the Free Software ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ##
-## ##
-## ##
-################################################################################
-#
-# File:
-# http6-stress
-#
-# Description:
-# This script is the stress test for http over IPv6
-#
-# Setup:
-# See ltp-yyyymmdd/testcases/network/stress/README
-#
-# Author:
-# Mitsuru Chinen <mitch@jp.ibm.com>
-#
-# History:
-# Oct 19 2005 - Created (Mitsuru Chinen)
-#
-#-----------------------------------------------------------------------
-# Uncomment line below for debug output.
-#trace_logic=${trace_logic:-"set -x"}
-$trace_logic
-
-# The version of IP
-IP_VER=6
-
-. http4-stress
--
1.7.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/6] network/stress/http: rename http4-stress
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
` (4 preceding siblings ...)
2015-02-03 14:14 ` [LTP] [PATCH 6/6] network/stress/http: remove http6-stress Alexey Kodanev
@ 2015-05-20 8:47 ` Alexey Kodanev
5 siblings, 0 replies; 7+ messages in thread
From: Alexey Kodanev @ 2015-05-20 8:47 UTC (permalink / raw)
To: ltp-list; +Cc: vasily.isaenko
Hi,
On 02/03/2015 05:14 PM, Alexey Kodanev wrote:
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
> testcases/network/stress/http/http-stress | 357 ++++++++++++++++++++++++++++
> testcases/network/stress/http/http4-stress | 357 ----------------------------
> 2 files changed, 357 insertions(+), 357 deletions(-)
> create mode 100644 testcases/network/stress/http/http-stress
> delete mode 100644 testcases/network/stress/http/http4-stress
>
Patch-set applied.
Thanks,
Alexey
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-20 8:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-03 14:14 [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 2/6] network/stress/http: cleanup, use test_net.sh library Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 3/6] network/stress/http: check downloaded file size Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 4/6] lib/network.sh: add default http server directory Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 5/6] runtest/network-stress.appl: fix http test names Alexey Kodanev
2015-02-03 14:14 ` [LTP] [PATCH 6/6] network/stress/http: remove http6-stress Alexey Kodanev
2015-05-20 8:47 ` [LTP] [PATCH 1/6] network/stress/http: rename http4-stress Alexey Kodanev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox