summaryrefslogtreecommitdiffstats
path: root/stress-clients.sh
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-04-11 15:40:44 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-04-11 15:40:44 +0200
commit237cf9c6c05616c20726175406d0855a8d0d4233 (patch)
tree908acbd80357b1cd557b4e58779a6250f6ef6a07 /stress-clients.sh
parenta274ae1502b257511298bd6a01cf1b7b69ade468 (diff)
Refactor stress test
Stress test now has 2 parts: the server part and the client part. Change-Id: I24e46060a1a710381476157f4fb4e8ad32370a5e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'stress-clients.sh')
-rwxr-xr-xstress-clients.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/stress-clients.sh b/stress-clients.sh
new file mode 100755
index 00000000..a8cb955c
--- /dev/null
+++ b/stress-clients.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+ROOT=$(dirname $0)
+echo ROOT=$ROOT
+
+AFB=$ROOT/build/src/afb-daemon
+CLI=$ROOT/build/src/afb-client-demo
+HELLO=build/bindings/samples/helloWorld.so
+PORT=12345
+TEST=test
+TOKEN=knock-knock-knoc
+OUT=$ROOT/stress-out-clients
+
+rm $OUT*
+
+CMDS=
+add() {
+ CMDS="$CMDS
+$1"
+}
+
+add 'hello ping true'
+add 'HELLO PING false'
+add 'hello pIngNull true'
+#add 'hello PingBug true'
+add 'hello PiNgJsOn {"well":"formed","json":[1,2,3,4.5,true,false,null,"oups"]}'
+add 'hello subcall {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}'
+add 'hello subcall {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcallsync {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}'
+add 'hello subcallsync {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcall {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello subcallsync {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}'
+add 'hello eventadd {"tag":"ev1","name":"event-A"}'
+add 'hello eventadd {"tag":"ev2","name":"event-B"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventsub {"tag":"ev2"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventsub {"tag":"ev1"}'
+add 'hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}'
+add 'hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}'
+add 'hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}'
+add 'hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}'
+add 'hello eventunsub {"tag":"ev2"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventdel {"tag":"ev1"}'
+add 'hello eventpush {"tag":"ev1","data":[1,2,"hello"]}'
+add 'hello eventpush {"tag":"ev2","data":{"item":0}}'
+add 'hello eventdel {"tag":"ev2"}'
+
+r() {
+ while :; do echo "$CMDS"; done |
+ while read x; do echo $x; sleep 0.001; done |
+ $CLI "localhost:$PORT/api?token=$TOKEN" > $OUT.$1 2>&1 &
+# while read x; do echo $x; sleep 0.001; done |
+# strace -tt -f -o $OUT-strace.$1 $CLI "localhost:$PORT/api?token=$TOKEN" > $OUT.$1 2>&1 &
+}
+
+echo -n launch clients...
+for x in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do r $x; done
+echo done
+
+wait