summaryrefslogtreecommitdiff
path: root/cpp/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-01-09 02:57:26 +0000
committerAlan Conway <aconway@apache.org>2007-01-09 02:57:26 +0000
commit7a65ac87c0fa28cab643207dd5a670bc8c4fef70 (patch)
tree7bbee13be65ec1def0d33c7570bb5b2125bacda7 /cpp/tests
parentc2055dbbf7d8ecd4a53d82b95dc2f666dbbb5fbc (diff)
downloadqpid-python-7a65ac87c0fa28cab643207dd5a670bc8c4fef70.tar.gz
Disabled python tests, added system tests to build: client_test, topictest.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@494308 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/tests')
-rw-r--r--cpp/tests/Makefile.am15
-rwxr-xr-xcpp/tests/broker45
-rwxr-xr-xcpp/tests/env23
-rwxr-xr-xcpp/tests/run-python-tests15
-rwxr-xr-xcpp/tests/run-system-tests18
-rw-r--r--cpp/tests/topic_publisher.cpp14
-rwxr-xr-xcpp/tests/topicall25
-rwxr-xr-xcpp/tests/topictest57
8 files changed, 53 insertions, 159 deletions
diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am
index 900bf47960..5e4d5dcc02 100644
--- a/cpp/tests/Makefile.am
+++ b/cpp/tests/Makefile.am
@@ -9,16 +9,13 @@ INCLUDES = \
-I$(top_srcdir)/lib/common/framing \
$(APR_CXXFLAGS)
-# FIXME: have e.g., topicall, run as part of "make check"?
EXTRA_DIST = \
- env \
- broker \
- topicall \
topictest \
qpid_test_plugin.h \
- APRBaseTest.cpp
+ MockSessionHandler.h
-client_tests = \
+
+client_exe_tests = \
client_test \
echo_service \
topic_listener \
@@ -62,9 +59,9 @@ unit_tests = \
$(misc_tests)
-noinst_PROGRAMS = $(client_tests)
+noinst_PROGRAMS = $(client_exe_tests)
-TESTS = run-unit-tests run-python-tests
+TESTS = run-unit-tests run-system-tests
EXTRA_DIST += $(TESTS)
include gen.mk
@@ -77,7 +74,7 @@ lib_broker = $(abs_builddir)/../lib/broker/libqpidbroker.la
gen.mk: Makefile.am
( \
- for i in $(client_tests); do \
+ for i in $(client_exe_tests); do \
echo $${i}_SOURCES = $$i.cpp; \
echo $${i}_LDADD = '$$(lib_client) $$(lib_common) $$(extra_libs)'; \
done; \
diff --git a/cpp/tests/broker b/cpp/tests/broker
deleted file mode 100755
index c49e967466..0000000000
--- a/cpp/tests/broker
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-. `dirname $0`/env
-
-brokerpid() {
- netstat -tpl 2> /dev/null | awk '/amqp/ {print gensub("/.*$","","g",$7) }'
-}
-
-killbroker () {
- PID=`brokerpid`
- if [ -n "$PID" ] ; then kill $PID ; fi
- for ((i=5;i--;)) {
- if [ -z "`brokerpid`" ] ; then exit 0 ; fi
- sleep 1
- }
- echo "Broker `brokerpid` refuses to die."
-}
-
-waitbroker () {
- while [ -z `brokerpid` ] ; do sleep 1 ; done
-}
-
-startbroker() {
- case $1 in
- j)
- export AMQJ_LOGGING_LEVEL=fatal
- export JDPA_OPTS=
- export QPID_OPTS=-Xmx1024M
- export debug=1
- CMD="qpid-server"
- qpid-run -run:print-command # Show the command line.
- ;;
- c) CMD=qpidd ;;
- esac
- nohup $CMD > /dev/null 2>&1 &
- waitbroker
- echo Broker started: $CMD
-}
-
-
-case $1 in
- j|c) startbroker $1 ;;
- stop|kill) killbroker ;;
- wait) waitbroker ;;
- pid) brokerpid ;;
-esac
diff --git a/cpp/tests/env b/cpp/tests/env
deleted file mode 100755
index 49201c01fd..0000000000
--- a/cpp/tests/env
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# Set environment variables for test scripts.
-
-pathmunge () {
- if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
- if [ "$2" = "after" ] ; then
- PATH=$PATH:$1
- else
- PATH=$1:$PATH
- fi
- fi
-}
-
-if [ -z QPID_ROOT ] ; then echo "You must set QPID_ROOT" ; fi
-
-pathmunge $QPID_ROOT/cpp/tests
-# pathmunge $QPID_ROOT/cpp/build/*/bin
-# pathmunge $QPID_ROOT/cpp/build/*/test
-
-export QPID_HOME=${QPID_HOME:-$QPID_ROOT/java/build}
-pathmunge $QPID_HOME/bin
-
-
diff --git a/cpp/tests/run-python-tests b/cpp/tests/run-python-tests
index 57be07ec1c..e69de29bb2 100755
--- a/cpp/tests/run-python-tests
+++ b/cpp/tests/run-python-tests
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-set -e
-log=`pwd`/qpidd.log
-# Start the daemon, recording its PID.
-../src/qpidd > $log 2>&1 & pid=$!
-
-# Arrange to kill the daemon upon any type of termination.
-trap 'status=$?; kill $pid; exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-# Run the tests.
-cd ../../python && ./run-tests -v -I cpp_failing.txt
-
-rm -f $log
diff --git a/cpp/tests/run-system-tests b/cpp/tests/run-system-tests
index 5aa0f9a409..7e3223debe 100755
--- a/cpp/tests/run-system-tests
+++ b/cpp/tests/run-system-tests
@@ -6,7 +6,7 @@ log=`pwd`/qpidd.log
../src/qpidd > $log 2>&1 & pid=$!
# Arrange to kill the daemon upon any type of termination.
-trap 'status=$?; kill $pid; exit $status' 0
+trap 'status=$?; kill $pid; rm -f test.out; exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
# Run C++ client tests.
@@ -24,14 +24,18 @@ run_test() {
}
run_test ./client_test
-run_test ./topictest -l2 -m2 -b1
+run_test `dirname $0`/topictest -s2 -m2 -b1
+
+# FIXME aconway 2007-01-08: Re-enable python tests when the brach
+# is functional again.
+echo "WARNING: PYTHON TESTS DISABLED TILL BRANCH IS FUNCTIONAL"
# Run the python tests.
-if test -d ../../python ; then
- cd ../../python && ./run-tests -v -I cpp_failing.txt
-else
- echo Warning: python tests not found.
-fi
+# if test -d ../../python ; then
+# cd ../../python && ./run-tests -v -I cpp_failing.txt
+# else
+# echo Warning: python tests not found.
+# fi
# TODO aconway 2006-12-13: run the other client tests.
diff --git a/cpp/tests/topic_publisher.cpp b/cpp/tests/topic_publisher.cpp
index b95abd9d66..6d17b7034f 100644
--- a/cpp/tests/topic_publisher.cpp
+++ b/cpp/tests/topic_publisher.cpp
@@ -138,13 +138,15 @@ int main(int argc, char** argv){
int64_t sum(0);
for(int i = 0; i < batchSize; i++){
if(i > 0 && args.getDelay()) sleep(args.getDelay());
- Time time = publisher.publish(
- args.getMessages(), args.getSubscribers(), args.getSize());
- if(!max || time > max) max = time;
- if(!min || time < min) min = time;
- sum += time;
+ int64_t msecs =
+ publisher.publish(args.getMessages(),
+ args.getSubscribers(),
+ args.getSize()) / TIME_MSEC;
+ if(!max || msecs > max) max = msecs;
+ if(!min || msecs < min) min = msecs;
+ sum += msecs;
std::cout << "Completed " << (i+1) << " of " << batchSize
- << " in " << time/TIME_MSEC << "ms" << std::endl;
+ << " in " << msecs << "ms" << std::endl;
}
publisher.terminate();
int64_t avg = sum / batchSize;
diff --git a/cpp/tests/topicall b/cpp/tests/topicall
deleted file mode 100755
index bde04a5b30..0000000000
--- a/cpp/tests/topicall
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-# Do 3 runs of topictests for C++ and Java brokers with reduced output.
-
-. `dirname $0`/env
-
-# Run a short topictest to warm up the broker and iron out startup effects.
-flush() {
- topic_listener >/dev/null 2>&1 &
- topic_publisher >/dev/null 2>&1
-}
-
-echo Java broker
-broker j ; flush
-topictest c | tail -n1
-topictest c | tail -n1
-topictest c | tail -n1
-
-echo C++ broker
-broker c ; flush
-topictest c | tail -n1
-topictest c | tail -n1
-topictest c | tail -n1
-
-# Don't bother with java clients we know they're slower.
-
diff --git a/cpp/tests/topictest b/cpp/tests/topictest
index 792f063bea..d68a8c81da 100755
--- a/cpp/tests/topictest
+++ b/cpp/tests/topictest
@@ -1,42 +1,41 @@
#!/bin/bash
-# Run the c++ or java topic test
+# Run the C++ topic test
-. `dirname $0`/env
-
-# Edit parameters here:
-
-# Big test:
-# LISTENERS=10
-# MESSAGES=10000
-# BATCHES=20
-
-LISTENERS=10
+# Defaults
+SUBSCRIBERS=10
MESSAGES=2000
BATCHES=10
-cppcmds() {
- LISTEN_CMD=topic_listener
- PUBLISH_CMD="topic_publisher -messages $MESSAGES -batches $BATCHES -subscribers $LISTENERS"
-}
+while getopts "s:m:b:" opt ; do
+ case $opt in
+ s) SUBSCRIBERS=$OPTARG ;;
+ m) MESSAGES=$OPTARG ;;
+ b) BATCHES=$OPTARG ;;
+ ?)
+ echo "Usage: %0 [-s <subscribers>] [-m <messages.] [-b <batches>]"
+ exit 1
+ ;;
+ esac
+done
-javacmds() {
- DEF=-Damqj.logging.level="error"
- LISTEN_CMD="qpid-run $DEF org.apache.qpid.topic.Listener"
- PUBLISH_CMD="qpid-run $DEF org.apache.qpid.topic.Publisher -messages $MESSAGES -batch $BATCHES -clients $LISTENERS"
+subscribe() {
+ ID=$1
+ echo "subscriber $ID"
+ ./topic_listener > subscriber.$ID 2>&1 || {
+ echo "SUBSCRIBER %ID FAILED: " ;
+ cat subscriber.$ID
+ }
+ rm subscriber.$ID
}
-case $1 in
- c) cppcmds ;;
- j) javacmds ;;
- *) cppcmds ;;
-esac
+publish() {
+ ./topic_publisher -messages $MESSAGES -batches $BATCHES -subscribers $SUBSCRIBERS
+}
-for ((i=$LISTENERS ; i--; )); do
- $LISTEN_CMD > /dev/null 2>&1 &
+for ((i=$SUBSCRIBERS ; i--; )); do
+ subscribe $i &
done
sleep 1
-echo $PUBLISH_CMD $OPTIONS
-
STATS=~/bin/topictest.times
echo "---- topictest `date`" >> $STATS
-$PUBLISH_CMD $OPTIONS | tee -a $STATS
+publish | tee -a $STATS