qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r614646 - in /incubator/qpid/trunk/qpid/cpp/examples: examples/direct/verify.in examples/fanout/verify.in examples/pub-sub/verify.in examples/request-response/verify.in verify
Date Wed, 23 Jan 2008 20:08:46 GMT
Author: aconway
Date: Wed Jan 23 12:08:46 2008
New Revision: 614646

URL: http://svn.apache.org/viewvc?rev=614646&view=rev
Log:

Fixed bug in verify - was not properly killing ./server process in
request-response example. Streamlined example scripts a little.

Modified:
    incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/examples/pub-sub/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in
    incubator/qpid/trunk/qpid/cpp/examples/verify

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in?rev=614646&r1=614645&r2=614646&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/direct/verify.in Wed Jan 23 12:08:46 2008
@@ -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 9
 Message: That's all, folks!
 Shutting down listener for listener_destination
-====

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in?rev=614646&r1=614645&r2=614646&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/fanout/verify.in Wed Jan 23 12:08:46 2008
@@ -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 9
 Message: That's all, folks!
 Shutting down listener for listener_destination
-====

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/pub-sub/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/pub-sub/verify.in?rev=614646&r1=614645&r2=614646&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/pub-sub/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/pub-sub/verify.in Wed Jan 23 12:08:46
2008
@@ -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 news
 Subscribing to queue usa
 Subscribing to queue weather
-==== ./topic_listener
-====

Modified: incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in?rev=614646&r1=614645&r2=614646&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/examples/request-response/verify.in Wed Jan 23
12:08:46 2008
@@ -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: 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)
-====

Modified: incubator/qpid/trunk/qpid/cpp/examples/verify
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/examples/verify?rev=614646&r1=614645&r2=614646&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/examples/verify (original)
+++ incubator/qpid/trunk/qpid/cpp/examples/verify Wed Jan 23 12:08:46 2008
@@ -14,16 +14,32 @@
 
 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 @@
 # 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



Mime
View raw message