From 8e8e9924bf8a59c39e0de3aa5928cd8730874fcd Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 23 Jun 2009 10:03:37 +0000 Subject: Renamed new directory to avoid clashing with executable name where build is done in source tree. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@787618 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/cluster_test/README.txt | 20 ------------ cpp/src/tests/cluster_test/cluster_check | 17 ---------- cpp/src/tests/cluster_test/cluster_start | 36 ---------------------- cpp/src/tests/cluster_test/cluster_stop | 18 ----------- cpp/src/tests/cluster_test/config_example.sh | 25 --------------- cpp/src/tests/cluster_test/perftest | 34 -------------------- cpp/src/tests/cluster_test_scripts/README.txt | 20 ++++++++++++ cpp/src/tests/cluster_test_scripts/cluster_check | 17 ++++++++++ cpp/src/tests/cluster_test_scripts/cluster_start | 36 ++++++++++++++++++++++ cpp/src/tests/cluster_test_scripts/cluster_stop | 18 +++++++++++ .../tests/cluster_test_scripts/config_example.sh | 25 +++++++++++++++ cpp/src/tests/cluster_test_scripts/perftest | 34 ++++++++++++++++++++ 12 files changed, 150 insertions(+), 150 deletions(-) delete mode 100644 cpp/src/tests/cluster_test/README.txt delete mode 100755 cpp/src/tests/cluster_test/cluster_check delete mode 100755 cpp/src/tests/cluster_test/cluster_start delete mode 100755 cpp/src/tests/cluster_test/cluster_stop delete mode 100755 cpp/src/tests/cluster_test/config_example.sh delete mode 100755 cpp/src/tests/cluster_test/perftest create mode 100644 cpp/src/tests/cluster_test_scripts/README.txt create mode 100755 cpp/src/tests/cluster_test_scripts/cluster_check create mode 100755 cpp/src/tests/cluster_test_scripts/cluster_start create mode 100755 cpp/src/tests/cluster_test_scripts/cluster_stop create mode 100755 cpp/src/tests/cluster_test_scripts/config_example.sh create mode 100755 cpp/src/tests/cluster_test_scripts/perftest (limited to 'cpp/src') diff --git a/cpp/src/tests/cluster_test/README.txt b/cpp/src/tests/cluster_test/README.txt deleted file mode 100644 index e861a2f397..0000000000 --- a/cpp/src/tests/cluster_test/README.txt +++ /dev/null @@ -1,20 +0,0 @@ -Cluster test scripts. - -A set of scripts to start and stop cluster and test clients on -multiple hosts using ssh. - -Pre-requisites: You must be - - set up for password-free ssh access to the test hosts. - - a member of the ais group on all the test hosts. - -Configuration: - -Copy defaults.sh to config.sh and edit the values as necessary. - -Test scripts: - -Test scripts use the functions in functions.sh to start & monitor -cluster and clients. -A test script can collect other scripts. - - diff --git a/cpp/src/tests/cluster_test/cluster_check b/cpp/src/tests/cluster_test/cluster_check deleted file mode 100755 index 5cc872a921..0000000000 --- a/cpp/src/tests/cluster_test/cluster_check +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Check that all members of a cluster are running - -source config.sh - -HOSTS=(`cat $CLUSTER_HOME/hosts`) -PORTS=(`cat $CLUSTER_HOME/ports`) - -for ((i=0; i<${#HOSTS[*]}; ++i)); do - host=${HOSTS[$i]} - port=${PORTS[$i]} - ssh $host "$QPIDD -cp $port" > /dev/null || { - ret=1 - echo "ERROR: broker not running $host:$port" - } -done -exit $ret diff --git a/cpp/src/tests/cluster_test/cluster_start b/cpp/src/tests/cluster_test/cluster_start deleted file mode 100755 index bde582ef2b..0000000000 --- a/cpp/src/tests/cluster_test/cluster_start +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# Start a cluster -# -# Arguments: NAME HOST [host...] -# Start a cluster called NAME with N nodes running on the given HOSTs -# repeat the host name to run multiple brokers on one host. Use dynamic -# ports. -# -# Log files, data directories and hosts/ports files are all stored under -# $HOME/cluster_test/$NAME -# - -source config.sh - -CLUSTER_NAME=`date +"${USER}_%F_%T"` -HOSTS=($BROKER_HOSTS) -for ((i = 0; i < ${#HOSTS[*]}; ++i)) ; do - host=${HOSTS[$i]} - datadir=$CLUSTER_HOME/broker$i - log=$datadir/qpidd.log - ssh $host "rm -rf $datadir; mkdir -p $datadir" || { - echo "ERROR: can't make data dir $datadir"; exit 1 - } - port=`ssh $host "echo $QPIDD -dp0 --cluster-name=$CLUSTER_NAME \ - --data-dir=$datadir \ - --log-to-file=$log --log-prefix=broker$i \ - $QPIDD_OPTS | newgrp ais"` || { - error "ERROR: can't start broker $i on $host"; exit 1; - } - PORTS="$PORTS $port" -done - -echo "$BROKER_HOSTS" > $CLUSTER_HOME/hosts -echo "$PORTS" > $CLUSTER_HOME/ports - -`dirname $0`/cluster_check $NAME diff --git a/cpp/src/tests/cluster_test/cluster_stop b/cpp/src/tests/cluster_test/cluster_stop deleted file mode 100755 index d4543d2d4a..0000000000 --- a/cpp/src/tests/cluster_test/cluster_stop +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# Stop the cluster. - -source config.sh - -HOSTS=(`cat $CLUSTER_HOME/hosts`) -PORTS=(`cat $CLUSTER_HOME/ports`) - -for ((i=0; i<${#HOSTS[*]}; ++i)); do - host=${HOSTS[$i]} - port=${PORTS[$i]} - ssh $host "$QPIDD -qp $port" > /dev/null || { - ret=1 - echo "ERROR: stopping broker at $host:$port" - } -done - -exit $ret diff --git a/cpp/src/tests/cluster_test/config_example.sh b/cpp/src/tests/cluster_test/config_example.sh deleted file mode 100755 index fd5b800df7..0000000000 --- a/cpp/src/tests/cluster_test/config_example.sh +++ /dev/null @@ -1,25 +0,0 @@ -# Cluster configuration. - -# All output stored under $HOME/$CLUSTER_HOME. -CLUSTER_HOME=$HOME/cluster_test - -# Hosts where brokers will be run. Repeat hostname to run multiple brokers on 1 host. -BROKER_HOSTS="mrg22 mrg23 mrg24 mrg25 mrg26" - -# Hosts where clients will be run. -CLIENT_HOSTS="$BROKER_HOSTS" - -# Paths to executables -QPIDD=qpidd -PERFTEST=perftest - -# Directory containing tests -TESTDIR=/usr/bin - -# Options for qpidd, must be sufficient to load the cluster plugin. -# Scripts will add --cluster-name, --daemon, --port and --log-to-file options here. -QPIDD_OPTS=" \ ---auth=no \ ---log-enable=notice+ \ ---log-enable=debug+:cluster \ -" diff --git a/cpp/src/tests/cluster_test/perftest b/cpp/src/tests/cluster_test/perftest deleted file mode 100755 index 72c8268835..0000000000 --- a/cpp/src/tests/cluster_test/perftest +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Run a distributed perftest against a cluster. -# Args: npubs nsubs [perftest-options] - -source config.sh - -NPUBS=${1:-4} ; shift -NSUBS=${1:-4} ; shift -OPTS="--npubs $NPUBS --nsubs $NSUBS $*" - -CLIENTS=($CLIENT_HOSTS) -BROKERS=(`cat $CLUSTER_HOME/hosts`) -PORTS=(`cat $CLUSTER_HOME/ports`) - -start() { - client=${CLIENTS[i % ${#CLIENTS[*]}]} - broker=${BROKERS[i % ${#BROKERS[*]}]} - port=${PORTS[i % ${#PORTS[*]}]} - ssh -n $client $PERFTEST $OPTS $* -b $broker -p $port & - PIDS="$PIDS $!" -} - -ssh ${CLIENTS[0]} $PERFTEST $OPTS --setup -b ${BROKERS[0]} -p${PORTS[0]} -for (( i=0 ; i < $NPUBS ; ++i)); do start --publish; done -for (( ; i < $NPUBS+$NSUBS ; ++i)); do start --subscribe; done -ssh ${CLIENTS[0]} $PERFTEST $OPTS --control -b ${BROKERS[0]} -p${PORTS[0]} - -for pid in $PIDS; do - wait $pid || echo "ERROR: client process $pid failed" -done - -`dirname $0`/cluster_check - - diff --git a/cpp/src/tests/cluster_test_scripts/README.txt b/cpp/src/tests/cluster_test_scripts/README.txt new file mode 100644 index 0000000000..e861a2f397 --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/README.txt @@ -0,0 +1,20 @@ +Cluster test scripts. + +A set of scripts to start and stop cluster and test clients on +multiple hosts using ssh. + +Pre-requisites: You must be + - set up for password-free ssh access to the test hosts. + - a member of the ais group on all the test hosts. + +Configuration: + +Copy defaults.sh to config.sh and edit the values as necessary. + +Test scripts: + +Test scripts use the functions in functions.sh to start & monitor +cluster and clients. +A test script can collect other scripts. + + diff --git a/cpp/src/tests/cluster_test_scripts/cluster_check b/cpp/src/tests/cluster_test_scripts/cluster_check new file mode 100755 index 0000000000..5cc872a921 --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/cluster_check @@ -0,0 +1,17 @@ +#!/bin/sh +# Check that all members of a cluster are running + +source config.sh + +HOSTS=(`cat $CLUSTER_HOME/hosts`) +PORTS=(`cat $CLUSTER_HOME/ports`) + +for ((i=0; i<${#HOSTS[*]}; ++i)); do + host=${HOSTS[$i]} + port=${PORTS[$i]} + ssh $host "$QPIDD -cp $port" > /dev/null || { + ret=1 + echo "ERROR: broker not running $host:$port" + } +done +exit $ret diff --git a/cpp/src/tests/cluster_test_scripts/cluster_start b/cpp/src/tests/cluster_test_scripts/cluster_start new file mode 100755 index 0000000000..bde582ef2b --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/cluster_start @@ -0,0 +1,36 @@ +#!/bin/sh +# Start a cluster +# +# Arguments: NAME HOST [host...] +# Start a cluster called NAME with N nodes running on the given HOSTs +# repeat the host name to run multiple brokers on one host. Use dynamic +# ports. +# +# Log files, data directories and hosts/ports files are all stored under +# $HOME/cluster_test/$NAME +# + +source config.sh + +CLUSTER_NAME=`date +"${USER}_%F_%T"` +HOSTS=($BROKER_HOSTS) +for ((i = 0; i < ${#HOSTS[*]}; ++i)) ; do + host=${HOSTS[$i]} + datadir=$CLUSTER_HOME/broker$i + log=$datadir/qpidd.log + ssh $host "rm -rf $datadir; mkdir -p $datadir" || { + echo "ERROR: can't make data dir $datadir"; exit 1 + } + port=`ssh $host "echo $QPIDD -dp0 --cluster-name=$CLUSTER_NAME \ + --data-dir=$datadir \ + --log-to-file=$log --log-prefix=broker$i \ + $QPIDD_OPTS | newgrp ais"` || { + error "ERROR: can't start broker $i on $host"; exit 1; + } + PORTS="$PORTS $port" +done + +echo "$BROKER_HOSTS" > $CLUSTER_HOME/hosts +echo "$PORTS" > $CLUSTER_HOME/ports + +`dirname $0`/cluster_check $NAME diff --git a/cpp/src/tests/cluster_test_scripts/cluster_stop b/cpp/src/tests/cluster_test_scripts/cluster_stop new file mode 100755 index 0000000000..d4543d2d4a --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/cluster_stop @@ -0,0 +1,18 @@ +#!/bin/sh +# Stop the cluster. + +source config.sh + +HOSTS=(`cat $CLUSTER_HOME/hosts`) +PORTS=(`cat $CLUSTER_HOME/ports`) + +for ((i=0; i<${#HOSTS[*]}; ++i)); do + host=${HOSTS[$i]} + port=${PORTS[$i]} + ssh $host "$QPIDD -qp $port" > /dev/null || { + ret=1 + echo "ERROR: stopping broker at $host:$port" + } +done + +exit $ret diff --git a/cpp/src/tests/cluster_test_scripts/config_example.sh b/cpp/src/tests/cluster_test_scripts/config_example.sh new file mode 100755 index 0000000000..fd5b800df7 --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/config_example.sh @@ -0,0 +1,25 @@ +# Cluster configuration. + +# All output stored under $HOME/$CLUSTER_HOME. +CLUSTER_HOME=$HOME/cluster_test + +# Hosts where brokers will be run. Repeat hostname to run multiple brokers on 1 host. +BROKER_HOSTS="mrg22 mrg23 mrg24 mrg25 mrg26" + +# Hosts where clients will be run. +CLIENT_HOSTS="$BROKER_HOSTS" + +# Paths to executables +QPIDD=qpidd +PERFTEST=perftest + +# Directory containing tests +TESTDIR=/usr/bin + +# Options for qpidd, must be sufficient to load the cluster plugin. +# Scripts will add --cluster-name, --daemon, --port and --log-to-file options here. +QPIDD_OPTS=" \ +--auth=no \ +--log-enable=notice+ \ +--log-enable=debug+:cluster \ +" diff --git a/cpp/src/tests/cluster_test_scripts/perftest b/cpp/src/tests/cluster_test_scripts/perftest new file mode 100755 index 0000000000..72c8268835 --- /dev/null +++ b/cpp/src/tests/cluster_test_scripts/perftest @@ -0,0 +1,34 @@ +#!/bin/sh +# Run a distributed perftest against a cluster. +# Args: npubs nsubs [perftest-options] + +source config.sh + +NPUBS=${1:-4} ; shift +NSUBS=${1:-4} ; shift +OPTS="--npubs $NPUBS --nsubs $NSUBS $*" + +CLIENTS=($CLIENT_HOSTS) +BROKERS=(`cat $CLUSTER_HOME/hosts`) +PORTS=(`cat $CLUSTER_HOME/ports`) + +start() { + client=${CLIENTS[i % ${#CLIENTS[*]}]} + broker=${BROKERS[i % ${#BROKERS[*]}]} + port=${PORTS[i % ${#PORTS[*]}]} + ssh -n $client $PERFTEST $OPTS $* -b $broker -p $port & + PIDS="$PIDS $!" +} + +ssh ${CLIENTS[0]} $PERFTEST $OPTS --setup -b ${BROKERS[0]} -p${PORTS[0]} +for (( i=0 ; i < $NPUBS ; ++i)); do start --publish; done +for (( ; i < $NPUBS+$NSUBS ; ++i)); do start --subscribe; done +ssh ${CLIENTS[0]} $PERFTEST $OPTS --control -b ${BROKERS[0]} -p${PORTS[0]} + +for pid in $PIDS; do + wait $pid || echo "ERROR: client process $pid failed" +done + +`dirname $0`/cluster_check + + -- cgit v1.2.1