diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2011-07-15 04:43:44 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2011-07-15 04:43:44 +0000 |
| commit | d58b837942a135533f3ec576a133c7ceecad3eee (patch) | |
| tree | dd86ceaa1ea0056b4c96af2b966f9cc18658618c /qpid/java/tools | |
| parent | 665fd64f84261d3bb9342b00f7f7823f367e3981 (diff) | |
| download | qpid-python-d58b837942a135533f3ec576a133c7ceecad3eee.tar.gz | |
QPID-3358 Simplified the scripts to make it easy to run them.
1. Removed the various set-env scripts. Instead in their place I want to introduce profiles that sets the env to
run under different environments. Ex from a source checkout or installed rpms.
2. Introduced Profile-run-from-source to set the env to run the tools
from an SVN checkout in a linux env.
3. Modified the scripts to use common variable names things like
classpaths, java executable, logging config etc..
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1146959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/tools')
| -rwxr-xr-x | qpid/java/tools/bin/Profile-run-from-source | 71 | ||||
| -rwxr-xr-x | qpid/java/tools/bin/check-qpid-java-env | 38 | ||||
| -rwxr-xr-x | qpid/java/tools/bin/perf-report (renamed from qpid/java/tools/bin/perf_report.sh) | 7 | ||||
| -rwxr-xr-x[-rw-r--r--] | qpid/java/tools/bin/qpid-bench | 16 | ||||
| -rwxr-xr-x | qpid/java/tools/bin/qpid-python-testkit | 11 | ||||
| -rwxr-xr-x[-rw-r--r--] | qpid/java/tools/bin/run-pub (renamed from qpid/java/tools/bin/run_pub.sh) | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | qpid/java/tools/bin/run-sub (renamed from qpid/java/tools/bin/run_sub.sh) | 4 | ||||
| -rw-r--r-- | qpid/java/tools/bin/set-testkit-env.sh | 88 | ||||
| -rw-r--r-- | qpid/java/tools/bin/setenv.sh | 49 |
9 files changed, 124 insertions, 164 deletions
diff --git a/qpid/java/tools/bin/Profile-run-from-source b/qpid/java/tools/bin/Profile-run-from-source new file mode 100755 index 0000000000..f8ec45ccff --- /dev/null +++ b/qpid/java/tools/bin/Profile-run-from-source @@ -0,0 +1,71 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Sets the environment for running the scripts from a source checkout. +txtbld=$(tput bold) # Bold +txtrst=$(tput sgr0) # Reset +txtred=$(tput setaf 1) # red +txtgreen=$(tput setaf 2) # green + +echo "${txtbld}Setting the environment to run qpid java tools from a source checkout${txtrst}" + +abs_path() +{ + D=`dirname "$1"` + echo "`cd \"$D\" 2>/dev/null && pwd`" +} + +export QPID_CHECKOUT=`abs_path "../../../../"` +echo "${txtgreen}Using source checkout at $QPID_CHECKOUT${txtrst}" + +export PATH=$QPID_CHECKOUT/java/tools/bin:$PATH + +if [ "$JAVA" = "" ] ; then + export JAVA=$(which java) +fi + +#------------- Required for perf_report, qpid-bench & qpid-python-testkit ---------------- + +export VENDOR_LIB=$QPID_CHECKOUT/java/build/lib +export CLASSPATH=`find $VENDOR_LIB -name '*.jar' | tr '\n' ':'` +export LOG_CONFIG="-Dlog4j.configuration=file:///$QPID_CHECKOUT/java/tools/etc/test.log4j" + + +#------------- Required for qpid-python-testkit ----------------------------------------- + +PYTHONPATH=$QPID_CHECKOUT/python/qpid:$QPID_CHECKOUT/cpp/src/test/brokertest.py:$PYTHONPATH +export PATH=$QPID_CHECKOUT/python:$PATH + +if [ -x $QPID_CHECKOUT/cpp/src/qpidd ]; then + QPIDD_EXEC=$QPID_CHECKOUT/cpp/src/qpidd +else + echo "${txtred}WARNING: Qpid CPP broker executable not found. You will not be able to run qpid-python-testkit${txtrst}" +fi + +if [ -x $QPID_CHECKOUT/cpp/src/.libs/cluster.so ]; then + CLUSTER_LIB=$QPID_CHECKOUT/cpp/src/.libs/cluster.so +else + echo "${txtred}WARNING: Qpid cluster.so not found.You will not be able to run qpid-python-testkit${txtrst}" +fi + +if [ "$STORE_LIB" = "" ] ; then + echo "${txtred}WARNING: Please point the STORE_LIB variable to the message store module. If not persistence tests will not write messages to disk.${txtrst}" +fi + +export PYTHONPATH QPIDD_EXEC CLUSTER_LIB diff --git a/qpid/java/tools/bin/check-qpid-java-env b/qpid/java/tools/bin/check-qpid-java-env new file mode 100755 index 0000000000..dedd6e06ea --- /dev/null +++ b/qpid/java/tools/bin/check-qpid-java-env @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +if [ -z "$LOG_CONFIG" ]; then + echo "Please set the appropriate parameters for logging as it may affect performance. Ex log4j defaults to DEBUG if not configured properly" + exit -1 +fi + +if [ -z "$JAVA_MEM" ]; then + JAVA_MEM=-Xmx1024m +fi + +if [ -z "$JAVA" ]; then + echo "Please set the path to the correct java executable to JAVA" + exit -1 +fi + +if [ -z "$CLASSPATH" ]; then + echo "Please set the $CLASSPATH variable to point to the jar/class files" + exit -1 +fi diff --git a/qpid/java/tools/bin/perf_report.sh b/qpid/java/tools/bin/perf-report index dd80f8c72c..228f792a52 100755 --- a/qpid/java/tools/bin/perf_report.sh +++ b/qpid/java/tools/bin/perf-report @@ -23,14 +23,11 @@ SUB_MEM=-Xmx1024M PUB_MEM=-Xmx1024M -LOG_CONFIG="-Damqj.logging.level=WARN" QUEUE="queue;{create:always,node:{x-declare:{auto-delete:true}}}" DURA_QUEUE="dqueue;{create:always,node:{durable:true,x-declare:{auto-delete:true}}}" TOPIC="amq.topic/test" DURA_TOPIC="amq.topic/test;{create:always,link:{durable:true}}" -. setenv.sh - waitfor() { until grep -a -l "$2" $1 >/dev/null 2>&1 ; do sleep 1 ; done ; } cleanup() { @@ -46,9 +43,9 @@ cleanup() # $3 producer options run_testcase() { - sh run_sub.sh $LOG_CONFIG $SUB_MEM $2 > sub.out & + sh run-sub $LOG_CONFIG $SUB_MEM $2 > sub.out & waitfor sub.out "Warming up" - sh run_pub.sh $LOG_CONFIG $PUB_MEM $3 > pub.out & + sh run-pub $LOG_CONFIG $PUB_MEM $3 > pub.out & waitfor sub.out "Completed the test" waitfor pub.out "Consumer has completed the test" sleep 2 #give a grace period to shutdown diff --git a/qpid/java/tools/bin/qpid-bench b/qpid/java/tools/bin/qpid-bench index c982e64efd..cd894b607f 100644..100755 --- a/qpid/java/tools/bin/qpid-bench +++ b/qpid/java/tools/bin/qpid-bench @@ -18,18 +18,6 @@ # under the License. # -if [ -z "$QPID_HOME" ]; then - export QPID_HOME=$(dirname $(dirname $(readlink -f $0))) - export PATH=${PATH}:${QPID_HOME}/bin -fi +. check-qpid-java-env -# Set classpath to include Qpid jar with all required jars in manifest -QPID_LIBS=$QPID_HOME/lib/qpid-all.jar - -# Set other variables used by the qpid-run script before calling -export JAVA=java \ - JAVA_VM=-server \ - JAVA_MEM=-Xmx1024m \ - QPID_CLASSPATH=$QPID_LIBS - -. qpid-run org.apache.qpid.tools.QpidBench "$@" +$JAVA -cp $CLASSPATH -server $JAVA_MEM $LOG_CONFIG org.apache.qpid.tools.QpidBench "$@" diff --git a/qpid/java/tools/bin/qpid-python-testkit b/qpid/java/tools/bin/qpid-python-testkit index cbe7972421..7233d0d075 100755 --- a/qpid/java/tools/bin/qpid-python-testkit +++ b/qpid/java/tools/bin/qpid-python-testkit @@ -22,9 +22,12 @@ # via the python test runner. The defaults are set for a running # from an svn checkout -. ./set-testkit-env.sh +. check-qpid-java-env export PYTHONPATH=./:$PYTHONPATH -rm -rf $OUTDIR -qpid-python-test -DOUTDIR=$OUTDIR -m testkit "$@" - +echo $PYTHONPATH +if [ "$OUTDIR" = "" ] ; then + OUTDIR=$PWD +fi +testdir=$OUTDIR/testkit-out-`date +%F-%H-%M-%S` +qpid-python-test -m testkit -DOUTDIR=$testdir"$@" diff --git a/qpid/java/tools/bin/run_pub.sh b/qpid/java/tools/bin/run-pub index 91b9287dea..1af58eede3 100644..100755 --- a/qpid/java/tools/bin/run_pub.sh +++ b/qpid/java/tools/bin/run-pub @@ -18,7 +18,7 @@ # under the License. # -. $QPID_TEST_HOME/bin/setenv.sh +. check-qpid-java-env echo "$@" -$JAVA_HOME/bin/java -cp $CLASSPATH $@ org.apache.qpid.tools.PerfProducer +$JAVA -cp $CLASSPATH $LOG_CONFIG $JAVA_MEM $@ org.apache.qpid.tools.PerfProducer diff --git a/qpid/java/tools/bin/run_sub.sh b/qpid/java/tools/bin/run-sub index c9ad2fed74..e9eea5197e 100644..100755 --- a/qpid/java/tools/bin/run_sub.sh +++ b/qpid/java/tools/bin/run-sub @@ -18,8 +18,8 @@ # under the License. # -. $QPID_TEST_HOME/bin/setenv.sh +. check-qpid-java-env echo "$@" -$JAVA_HOME/bin/java -cp $CLASSPATH $@ org.apache.qpid.tools.PerfConsumer +$JAVA -cp $CLASSPATH $LOG_CONFIG $JAVA_MEM $@ org.apache.qpid.tools.PerfConsumer diff --git a/qpid/java/tools/bin/set-testkit-env.sh b/qpid/java/tools/bin/set-testkit-env.sh deleted file mode 100644 index 051dad8179..0000000000 --- a/qpid/java/tools/bin/set-testkit-env.sh +++ /dev/null @@ -1,88 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# If QPIDD_EXEC ..etc is not set, it will first check to see -# if this is run from a qpid svn check out, if not it will look -# for installed rpms. - -abs_path() -{ - D=`dirname "$1"` - B=`basename "$1"` - echo "`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B" -} - -# Environment for python tests - -if [ -d ../../../python ] ; then - PYTHON_DIR=../../../python - PYTHONPATH=$PYTHON_DIR:$PYTHON_DIR/qpid -elif [ -z `echo $PYTHONPATH | awk '$0 ~ /qpid/'` ]; then - echo "WARNING: skipping test, no qpid python scripts found ."; exit 0; -fi - - -if [ "$QPIDD_EXEC" = "" ] ; then - if [ -x ../../../cpp/src/qpidd ]; then - QPIDD_EXEC=`abs_path "../../../cpp/src/qpidd"` - elif [ -n "$(which qpidd)" ] ; then - QPIDD_EXEC=$(which qpidd) - else - echo "WARNING: skipping test, QPIDD_EXEC not set and qpidd not found."; exit 0; - fi -fi - -if [ "$CLUSTER_LIB" = "" ] ; then - if [ -x ../../../cpp/src/.libs/cluster.so ]; then - CLUSTER_LIB=`abs_path "../../../cpp/src/.libs/cluster.so"` - elif [ -e /usr/lib64/qpid/daemon/cluster.so ] ; then - CLUSTER_LIB="/usr/lib64/qpid/daemon/cluster.so" - elif [ -e /usr/lib/qpid/daemon/cluster.so ] ; then - CLUSTER_LIB="/usr/lib/qpid/daemon/cluster.so" - else - echo "WARNING: skipping test, CLUSTER_LIB not set and cluster.so not found."; exit 0; - fi -fi - -if [ "$STORE_LIB" = "" ] ; then - if [ -e /usr/lib64/qpid/daemon/msgstore.so ] ; then - STORE_LIB="/usr/lib64/qpid/daemon/msgstore.so" - elif [ -e /usr/lib/qpid/daemon/msgstore.so ] ; then - STORE_LIB="/usr/lib/qpid/daemon/msgstore.so" - #else - # echo "WARNING: skipping test, STORE_LIB not set and msgstore.so not found."; exit 0; - fi -fi - -if [ "$QP_CP" = "" ] ; then - if [ -d ../../build/lib/ ]; then - QP_JAR_PATH=`abs_path "../../build/lib/"` - elif [ -d /usr/share/java/qpid-deps ]; then - QP_JAR_PATH=`abs_path "/usr/share/java"` - else - "WARNING: skipping test, QP_CP not set and the Qpid jars are not present."; exit 0; - fi - QP_CP=`find $QP_JAR_PATH -name '*.jar' | tr '\n' ':'` -fi - -if [ "$OUTDIR" = "" ] ; then - OUTDIR=`abs_path "./output"` -fi - -export PYTHONPATH PYTHON_DIR QPIDD_EXEC CLUSTER_LIB QP_CP OUTDIR diff --git a/qpid/java/tools/bin/setenv.sh b/qpid/java/tools/bin/setenv.sh deleted file mode 100644 index 24135e711b..0000000000 --- a/qpid/java/tools/bin/setenv.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Compiles the test classes and sets the CLASSPATH - -# check for QPID_TEST_HOME -if [ "$QPID_TEST_HOME" = "" ] ; then - echo "ERROR: Please set QPID_TEST_HOME ...." - exit 1 -fi - -# check for JAVA_HOME -if [ "$JAVA_HOME" = "" ] ; then - echo "ERROR: Please set JAVA_HOME ...." - exit 1 -fi - -# VENDOR_LIB path needs to be set -# for Qpid set this to {qpid_checkout}/java/build/lib -if [ "$VENDOR_LIB" = "" ] ; then - echo "ERROR: Please set VENDOR_LIB path in the script ...." - exit 1 -fi - - -[ -d $QPID_TEST_HOME/classes ] || mkdir $QPID_TEST_HOME/classes - -CLASSPATH=`find $VENDOR_LIB -name *.jar* | tr '\n' ":"` -$JAVA_HOME/bin/javac -cp $CLASSPATH -d $QPID_TEST_HOME/classes -sourcepath $QPID_TEST_HOME/src `find $QPID_TEST_HOME/src -name '*.java'` - -export CLASSPATH=$QPID_TEST_HOME/classes:$CLASSPATH - |
