summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-01-23 20:08:46 +0000
committerAlan Conway <aconway@apache.org>2008-01-23 20:08:46 +0000
commitb6ffa2d63ecb0e45acabaf59d2baa3fa9ea2c270 (patch)
treefe251937aef0b4cb9a7e17e3b9b1d78296c162b7
parentbdecc9d9952d735b0fe6e00c90b11f5c8f542c32 (diff)
downloadqpid-python-b6ffa2d63ecb0e45acabaf59d2baa3fa9ea2c270.tar.gz
Fixed bug in verify - was not properly killing ./server process in
request-response example. Streamlined example scripts a little. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@614646 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/examples/examples/direct/verify.in9
-rw-r--r--qpid/cpp/examples/examples/fanout/verify.in9
-rw-r--r--qpid/cpp/examples/examples/pub-sub/verify.in8
-rw-r--r--qpid/cpp/examples/examples/request-response/verify.in7
-rwxr-xr-xqpid/cpp/examples/verify63
5 files changed, 45 insertions, 51 deletions
diff --git a/qpid/cpp/examples/examples/direct/verify.in b/qpid/cpp/examples/examples/direct/verify.in
index 558062cee2..afe36335c7 100644
--- a/qpid/cpp/examples/examples/direct/verify.in
+++ b/qpid/cpp/examples/examples/direct/verify.in
@@ -1,8 +1,6 @@
-==== ./declare_queues
-====
-==== ./direct_producer
-====
-==== ./listener
+==== ./declare_queues.out
+==== ./direct_producer.out
+==== ./listener.out
Activating listener for: listener_destination
Message: Message 0
Message: Message 1
@@ -16,4 +14,3 @@ Message: Message 8
Message: Message 9
Message: That's all, folks!
Shutting down listener for listener_destination
-====
diff --git a/qpid/cpp/examples/examples/fanout/verify.in b/qpid/cpp/examples/examples/fanout/verify.in
index 44154d2b52..9d1c1445e1 100644
--- a/qpid/cpp/examples/examples/fanout/verify.in
+++ b/qpid/cpp/examples/examples/fanout/verify.in
@@ -1,8 +1,6 @@
-==== ./declare_queues
-====
-==== ./fanout_producer
-====
-==== ./listener
+==== ./declare_queues.out
+==== ./fanout_producer.out
+==== ./listener.out
Activating listener for: listener_destination
Message: Message 0
Message: Message 1
@@ -16,4 +14,3 @@ Message: Message 8
Message: Message 9
Message: That's all, folks!
Shutting down listener for listener_destination
-====
diff --git a/qpid/cpp/examples/examples/pub-sub/verify.in b/qpid/cpp/examples/examples/pub-sub/verify.in
index 0a36b8c5ee..ac51038a1b 100644
--- a/qpid/cpp/examples/examples/pub-sub/verify.in
+++ b/qpid/cpp/examples/examples/pub-sub/verify.in
@@ -1,7 +1,5 @@
-==== ./topic_publisher
-====
-==== remove_uuid topic_listener.out | sort
-====
+==== ./topic_publisher.out
+==== topic_listener.out | remove_uuid | sort
Declaring queue: europe
Declaring queue: news
Declaring queue: usa
@@ -59,5 +57,3 @@ Subscribing to queue europe
Subscribing to queue news
Subscribing to queue usa
Subscribing to queue weather
-==== ./topic_listener
-====
diff --git a/qpid/cpp/examples/examples/request-response/verify.in b/qpid/cpp/examples/examples/request-response/verify.in
index fb12502a48..3767fb3f43 100644
--- a/qpid/cpp/examples/examples/request-response/verify.in
+++ b/qpid/cpp/examples/examples/request-response/verify.in
@@ -1,4 +1,4 @@
-==== ./client
+==== ./client.out | remove_uuid
Activating response queue listener for: client
Request: Twas brillig, and the slithy toves
Request: Did gire and gymble in the wabe.
@@ -10,13 +10,10 @@ Response: DID GIRE AND GYMBLE IN THE WABE.
Response: ALL MIMSY WERE THE BOROGROVES,
Response: AND THE MOME RATHS OUTGRABE.
Shutting down listener for client
-====
-==== remove_uuid server.out
-==== ./server
+==== server.out | remove_uuid
Activating request queue listener for: request
Waiting for requests
Request: Twas brillig, and the slithy toves (client)
Request: Did gire and gymble in the wabe. (client)
Request: All mimsy were the borogroves, (client)
Request: And the mome raths outgrabe. (client)
-====
diff --git a/qpid/cpp/examples/verify b/qpid/cpp/examples/verify
index 35c9acae88..f3596d5451 100755
--- a/qpid/cpp/examples/verify
+++ b/qpid/cpp/examples/verify
@@ -14,16 +14,32 @@ fi
ARGS="${QPID_HOST:-localhost} $QPID_PORT"
-title() { echo ==== $*; eval "$*"; echo ====; }
-run() { echo ==== $*; eval "$* $ARGS"; echo ====; }
+
+client() { "$@" $ARGS > $1.out; }
+clients() { for cmd in "$@"; do client $cmd; done; }
waitfor() { until grep -a -l "$2" $1 >/dev/null 2>&1 ; do sleep 1 ; done ; }
+background() {
+ pattern=$1; shift
+ "$@" > $1.out &
+ waitfor $1.out $pattern
+}
+
+outputs() {
+ wait 2> /dev/null # Wait for all backgroud processes to complete
+ for f in "$@"; do
+ { echo "==== $f"; eval "cat $f"; } >> verify.out ;
+ done
+}
+
verify() {
- ex=`basename $PWD`
- diff -ac verify.out $SRC/$ex/verify.in || {
- echo "FAIL: $ex " ; RET=1 ; return 1;
- }
+ dir=$1
+ func=`echo $dir | tr - _`
+ cd $dir || return 1
+ rm -f *.out
+ { $func && diff -ac verify.out $SRC/$dir/verify.in ; } || return 1
+ rm -f *.out
}
HEX="[a-fA-F0-9]"
@@ -34,42 +50,33 @@ remove_uuid() {
# Scripts for each example
direct() {
- run ./declare_queues > verify.out
- run ./direct_producer >> verify.out
- run ./listener >> verify.out
+ clients ./declare_queues ./direct_producer ./listener
+ outputs ./declare_queues.out ./direct_producer.out ./listener.out
}
fanout() {
- run ./declare_queues > verify.out
- run ./fanout_producer >>verify.out
- run ./listener >>verify.out
+ clients ./declare_queues ./fanout_producer ./listener
+ outputs ./declare_queues.out ./fanout_producer.out ./listener.out
}
pub_sub() {
- run ./topic_listener | tee topic_listener.out > topic_listener.wait &
- waitfor topic_listener.wait "Listening"
- run ./topic_publisher > verify.out
- wait 2> /dev/null
- title "remove_uuid topic_listener.out | sort" >> verify.out
+ background "Listening" ./topic_listener
+ clients ./topic_publisher
+ outputs ./topic_publisher.out "topic_listener.out | remove_uuid | sort"
}
request_response() {
- run ./server | tee server.out > server.wait &
- waitfor server.wait "Waiting"
- run ./client | remove_uuid > verify.out
- kill %%
- wait 2> /dev/null
- title "remove_uuid server.out" >> verify.out
+ background "Waiting" ./server
+ clients ./client
+ kill %% # Must kill the server.
+ outputs "./client.out | remove_uuid" " server.out | remove_uuid"
}
-# FIXME aconway 2007-12-14: put back pub-sub and persistence when fixed.
-
# Main
EXAMPLES=${*:-direct fanout pub-sub request-response}
for ex in $EXAMPLES ; do
- func=`echo $ex | tr - _`
- echo "Verifing $ex"
- ( cd $ex && $func && verify && rm -f *.out *.wait)
+ if ( verify $ex; ) then echo "PASS: $ex"; else
+ echo "FAIL: $ex"; RET=1; fi
done
exit $RET