From ce2746a376abfa750719e4190ce1a7d41ec2a68b Mon Sep 17 00:00:00 2001 From: Mateus Caruccio Date: Thu, 9 Feb 2012 20:31:29 -0200 Subject: [PATCH] better test scripts --- fapws/mainloop.c | 2 ++ sample/push/get.sh | 14 +++++++++++--- sample/push/getall.sh | 2 +- sample/push/getfirst.sh | 4 ++-- sample/push/getlast.sh | 4 ++-- sample/push/post.sh | 7 +++++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fapws/mainloop.c b/fapws/mainloop.c index 5ef5837..155b6d1 100644 --- a/fapws/mainloop.c +++ b/fapws/mainloop.c @@ -95,6 +95,8 @@ void close_cb(struct ev_loop *loop, struct ev_io *w, int revents) LDEBUG(">> ENTER close_cb cli=%p", cli); unregister_client(cli); close_connection(cli); + ev_io_stop(EV_A_ &cli->ev_write); + ev_io_stop(EV_A_ &cli->ev_read); ev_io_stop(EV_A_ w); LDEBUG("<< EXIT close_cb cli=%p", cli); } diff --git a/sample/push/get.sh b/sample/push/get.sh index 7fbdc2e..184d538 100755 --- a/sample/push/get.sh +++ b/sample/push/get.sh @@ -1,6 +1,14 @@ +#!/bin/bash -e -channel='ch_teste' id=${1:-1} +channel=${2:-'ch_teste'} +url="http://localhost:8080/broadcast/sub?ch=$channel&m=$id&s=M" +c=${3:-1} -curl -m 600 -v "http://localhost:8080/broadcast/sub?ch=$channel&m=$id&s=M" -#ab -c50 -n50 -t 600 "http://localhost:8080/broadcast/sub?ch=$channel&m=$id&s=M" +for ((i=0; i<$c; i++)) +do + curl -m 600 -v "$url" & +done + +wait +#ab -c10 -n50 -t 600 "$url" diff --git a/sample/push/getall.sh b/sample/push/getall.sh index 70a8fc1..9080bdb 100755 --- a/sample/push/getall.sh +++ b/sample/push/getall.sh @@ -1,4 +1,4 @@ -channel='ch_teste' +channel="${1:-ch_teste}" curl -v "http://localhost:8080/broadcast/sub?ch=$channel&s=A" diff --git a/sample/push/getfirst.sh b/sample/push/getfirst.sh index fff248b..4c2f426 100755 --- a/sample/push/getfirst.sh +++ b/sample/push/getfirst.sh @@ -1,5 +1,5 @@ -channel='ch_teste' -cnt=${1:-3} +channel="${1:-ch_teste}" +cnt=${2:-3} curl -v "http://localhost:8080/broadcast/sub?ch=$channel&m=$cnt&s=F" diff --git a/sample/push/getlast.sh b/sample/push/getlast.sh index e7ab79d..2d65c4c 100755 --- a/sample/push/getlast.sh +++ b/sample/push/getlast.sh @@ -1,5 +1,5 @@ -channel='ch_teste' -cnt=${1:-3} +channel="${1:-ch_teste}" +cnt=${2:-3} curl -v "http://localhost:8080/broadcast/sub?ch=$channel&m=$cnt&s=L" diff --git a/sample/push/post.sh b/sample/push/post.sh index ad135f3..831626c 100755 --- a/sample/push/post.sh +++ b/sample/push/post.sh @@ -1,7 +1,8 @@ date=`date +%s` -channel='ch_teste' id=${1:-1} +channel=${2:-'ch_teste'} +to=${3:-60} content="This is Spartaaaaaaa id=$id!!!" post_data=" { @@ -14,4 +15,6 @@ post_data=" \"dtCreated\":\"$date\" }" -curl -v "http://localhost:8080/broadcast/pub" -d "ch=$channel&m=$id&t=$date&to=60&rt_message=$post_data" +post_data="*** PAYLOAD $id/$channel ***" + +curl -v "http://localhost:8080/broadcast/pub" -d "ch=$channel&m=$id&t=$date&to=$to&rt_message=$post_data"