From fe5dea4beb78ca37e88211cfa845dd16fec63797 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 28 Nov 2007 15:35:03 +0000 Subject: src/tests/perfdist: Updated for changes to perftest. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@599028 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/perfdist | 60 +++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 18 deletions(-) (limited to 'qpid/cpp/src/tests/perfdist') diff --git a/qpid/cpp/src/tests/perfdist b/qpid/cpp/src/tests/perfdist index 6c5d6b6b11..8705cac7eb 100755 --- a/qpid/cpp/src/tests/perfdist +++ b/qpid/cpp/src/tests/perfdist @@ -1,32 +1,56 @@ #!/bin/bash # +set -e usage() { cat < --pubhosts --subhosts + +All perftest args must come before --pubhost or --subhost. Runs one +publish process on each publish-host, one subscribe process on each +subscribe-host. To run multiple processes on the same host, list it +more than once. + +Do not pass action flags --setup, --control, --publish, --subscribe they +will be passed to the appropriate processes. + +Do not pass --nsubs or --npubs, they are calculated by counting the host lists. EOF exit 1 } -while test "$HOSTS" != "$*"; do +while test $# -gt 0; do case $1 in - --consumers|--publish|--listen) usage ;; - --) shift; PUB="$1" ; shift ; HOSTS="$*" ;; + --publish|--subscribe|--setup|--control|--npubs|--nsubs) usage ;; + --pubhosts) COLLECT=PUBHOSTS; shift; break ;; + --subhosts) COLLECT=SUBHOSTS; shift; break ;; *) ARGS="$ARGS $1"; shift ;; esac done -test -n "$HOSTS" || { echo "No -- found"; usage; } -N=`echo $HOSTS | wc -w` -PERFTEST=`PATH=$PWD:$PATH which perftest` -$PERFTEST --purge $ARGS -ssh $PUB $PERFTEST $ARGS --publish --consumers $N& -for h in $HOSTS; do - ssh $h $PERFTEST $ARGS --listen& + +if [ -z "$COLLECT" ]; then echo "No --pubhost or --subhost specified"; usage; fi + +while test $# -gt 0; do + case $1 in + --pubhosts) COLLECT=PUBHOSTS; shift ;; + --subhosts) COLLECT=SUBHOSTS; shift ;; + *) eval "$COLLECT=\"\$$COLLECT $1\""; shift ;; + esac done -wait +if [ -z "$PUBHOSTS" ]; then echo "Missing --pubhost or --subhost"; usage; fi +if [ -z "$SUBHOSTS" ]; then echo "Missing --subhost or --subhost"; usage; fi + +NPUBS=`echo $PUBHOSTS | wc -w` +NSUBS=`echo $SUBHOSTS | wc -w` +ARGS="$ARGS --npubs $NPUBS --nsubs $NSUBS" +PERFTEST="`PATH=$PWD:$PATH which perftest` $ARGS" + +start() { + echo $1 on $2 + ssh $2 $PERFTEST --$1 +} + +$PERFTEST --setup +for h in $PUBHOSTS; do start publish $h & done +for h in $SUBHOSTS; do start subscribe $h & done +$PERFTEST --control -- cgit v1.2.1