coverage: Add coverage test 23/14623/1 5.99.1 flounder/5.99.1 flounder_5.99.1
authorJosé Bollo <jose.bollo@iot.bzh>
Fri, 22 Jun 2018 16:30:43 +0000 (18:30 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Fri, 22 Jun 2018 16:30:43 +0000 (18:30 +0200)
This is a first version of the coverage tests.

Change-Id: Iec2feaba12c369b2ff5fb82e246fa0cad87813f5
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
22 files changed:
coverage/apis/auto/saha [new symlink]
coverage/apis/auto/x-hello [new symlink]
coverage/apis/auto/x-salut [new symlink]
coverage/bin/bug.c [new file with mode: 0644]
coverage/ldpath/weak/noise1 [new file with mode: 0644]
coverage/ldpath/weak/noise2 [new file with mode: 0644]
coverage/ldpath/weak/noise3 [new symlink]
coverage/ldpath/weak/noise4 [new symlink]
coverage/ldpath/weak/sub/noise1 [new file with mode: 0644]
coverage/ldpath/weak/sub/noise2/noise [new file with mode: 0644]
coverage/ldpath/weak/sub/noise3 [new symlink]
coverage/ldpath/weak/sub/noise4 [new symlink]
coverage/scripts/00-trace.sh [new file with mode: 0755]
coverage/scripts/01-http.sh [new file with mode: 0755]
coverage/scripts/02-hello.sh [new file with mode: 0755]
coverage/scripts/03-x-hello.sh [new file with mode: 0755]
coverage/scripts/04-monitor.sh [new file with mode: 0755]
coverage/scripts/run-parts.sh [new file with mode: 0755]
coverage/scripts/run-test.sh [new file with mode: 0755]
coverage/www/index.html [new file with mode: 0644]
coverage/www/marrus-orthocanna.jpg [new file with mode: 0644]
coverage/www/test.js [new file with mode: 0644]

diff --git a/coverage/apis/auto/saha b/coverage/apis/auto/saha
new file mode 120000 (symlink)
index 0000000..403904c
--- /dev/null
@@ -0,0 +1 @@
+../../bin/saha.so
\ No newline at end of file
diff --git a/coverage/apis/auto/x-hello b/coverage/apis/auto/x-hello
new file mode 120000 (symlink)
index 0000000..77b3cf6
--- /dev/null
@@ -0,0 +1 @@
+../ws/hello
\ No newline at end of file
diff --git a/coverage/apis/auto/x-salut b/coverage/apis/auto/x-salut
new file mode 120000 (symlink)
index 0000000..0e28e43
--- /dev/null
@@ -0,0 +1 @@
+../ws/salut
\ No newline at end of file
diff --git a/coverage/bin/bug.c b/coverage/bin/bug.c
new file mode 100644 (file)
index 0000000..ddebdef
--- /dev/null
@@ -0,0 +1,6 @@
+#define AFB_BINDING_VERSION 3
+#include <afb/afb-binding.h>
+int afbBindingEntry(afb_api_t api)
+{
+       return ((int(*)())(intptr_t)0)();
+}
diff --git a/coverage/ldpath/weak/noise1 b/coverage/ldpath/weak/noise1
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/coverage/ldpath/weak/noise2 b/coverage/ldpath/weak/noise2
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/coverage/ldpath/weak/noise3 b/coverage/ldpath/weak/noise3
new file mode 120000 (symlink)
index 0000000..3302790
--- /dev/null
@@ -0,0 +1 @@
+noise5
\ No newline at end of file
diff --git a/coverage/ldpath/weak/noise4 b/coverage/ldpath/weak/noise4
new file mode 120000 (symlink)
index 0000000..b276fe1
--- /dev/null
@@ -0,0 +1 @@
+noise1
\ No newline at end of file
diff --git a/coverage/ldpath/weak/sub/noise1 b/coverage/ldpath/weak/sub/noise1
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/coverage/ldpath/weak/sub/noise2/noise b/coverage/ldpath/weak/sub/noise2/noise
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/coverage/ldpath/weak/sub/noise3 b/coverage/ldpath/weak/sub/noise3
new file mode 120000 (symlink)
index 0000000..3302790
--- /dev/null
@@ -0,0 +1 @@
+noise5
\ No newline at end of file
diff --git a/coverage/ldpath/weak/sub/noise4 b/coverage/ldpath/weak/sub/noise4
new file mode 120000 (symlink)
index 0000000..b276fe1
--- /dev/null
@@ -0,0 +1 @@
+noise1
\ No newline at end of file
diff --git a/coverage/scripts/00-trace.sh b/coverage/scripts/00-trace.sh
new file mode 100755 (executable)
index 0000000..34a19bb
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+$R/bin/afb-client -k $WSURL monitor trace '{"add":{"api":"*","request":"*","event":"*","session":"*","global":"*"}}' &
+
diff --git a/coverage/scripts/01-http.sh b/coverage/scripts/01-http.sh
new file mode 100755 (executable)
index 0000000..191318c
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+
+curl $URL/index.html
+curl $URL/marrus-orthocanna.jpg
+curl $URL/test.js
+curl $URL/icons/marrus-orthocanna.jpg
+
+curl $URL/fake-file.html
+
+curl "$URL/api/salut/ping?arg1=null&arg1=%22a+string%22"
+curl "$URL/api/hello/ping" \
+       -F image=@$R/www/marrus-orthocanna.jpg \
+       -F name=test
+curl -X POST "$URL/api/hello/ping" \
+       --header 'content-type: application/json' \
+       --data-binary '[null,3,{"hello":false,"salut":4.5},true]'
diff --git a/coverage/scripts/02-hello.sh b/coverage/scripts/02-hello.sh
new file mode 100755 (executable)
index 0000000..fbbb307
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+$R/bin/afb-client -s -e $WSURL <<EOC
+hello ping true
+HELLO PING false
+hello pIngNull true
+hello PingBug true
+hello PiNgJsOn {"well":"formed","json":[1,2,3,4.5,true,false,null,"oups"]}
+hello subcall {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}
+hello subcall {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+hello subcallsync {"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}
+hello subcallsync {"api":"hello","verb":"subcall","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+hello subcall {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+hello subcallsync {"api":"hello","verb":"subcallsync","args":{"api":"hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+hello eventadd {"tag":"ev1","name":"event-A"}
+hello eventadd {"tag":"ev2","name":"event-B"}
+hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
+hello eventpush {"tag":"ev2","data":{"item":0}}
+hello eventsub {"tag":"ev2"}
+hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
+hello eventpush {"tag":"ev2","data":{"item":0}}
+hello eventsub {"tag":"ev1"}
+hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}
+hello subcall {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
+hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"hello"]}}
+hello subcallsync {"api":"hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
+hello eventunsub {"tag":"ev2"}
+hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
+hello eventpush {"tag":"ev2","data":{"item":0}}
+hello eventdel {"tag":"ev1"}
+hello eventpush {"tag":"ev1","data":[1,2,"hello"]}
+hello eventpush {"tag":"ev2","data":{"item":0}}
+hello broadcast {"name":"xev","data":"true"}
+hello broadcast {"tag":"ev2","data":"true"}
+hello eventdel {"tag":"ev2"}
+hello hasperm {"perm":"some-permissison"}
+hello appid true
+hello uid true
+hello set-loa 1
+hello set-loa 3
+hello close true
+hello setctx "some-text-0"
+hello setctxif "some-text-1"
+hello getctx 
+hello setctx "some-text-2"
+hello getctx
+#------------------------
+# TODO bug to be fixed!
+#hello info
+#hello verbose {"level":2,"message":"hello"}
+#------------------------
+EOC
+
diff --git a/coverage/scripts/03-x-hello.sh b/coverage/scripts/03-x-hello.sh
new file mode 100755 (executable)
index 0000000..9d3726e
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+$R/bin/afb-client -s -e $WSURL <<EOC
+x-hello ping true
+x-HELLO PING false
+x-hello pIngNull true
+x-hello PingBug true
+x-hello PiNgJsOn {"well":"formed","json":[1,2,3,4.5,true,false,null,"oups"]}
+x-hello subcall {"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}
+x-hello subcall {"api":"x-hello","verb":"subcall","args":{"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+x-hello subcallsync {"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}
+x-hello subcallsync {"api":"x-hello","verb":"subcall","args":{"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+x-hello subcall {"api":"x-hello","verb":"subcallsync","args":{"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+x-hello subcallsync {"api":"x-hello","verb":"subcallsync","args":{"api":"x-hello","verb":"pingjson","args":[{"key1":"value1"}]}}
+x-hello eventadd {"tag":"ev1","name":"event-A"}
+x-hello eventadd {"tag":"ev2","name":"event-B"}
+x-hello eventpush {"tag":"ev1","data":[1,2,"x-hello"]}
+x-hello eventpush {"tag":"ev2","data":{"item":0}}
+x-hello eventsub {"tag":"ev2"}
+x-hello eventpush {"tag":"ev1","data":[1,2,"x-hello"]}
+x-hello eventpush {"tag":"ev2","data":{"item":0}}
+x-hello eventsub {"tag":"ev1"}
+x-hello subcall {"api":"x-hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"x-hello"]}}
+x-hello subcall {"api":"x-hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
+x-hello subcallsync {"api":"x-hello","verb":"eventpush","args":{"tag":"ev1","data":[1,2,"x-hello"]}}
+x-hello subcallsync {"api":"x-hello","verb":"eventpush","args":{"tag":"ev2","data":{"item":0}}}
+x-hello eventunsub {"tag":"ev2"}
+x-hello eventpush {"tag":"ev1","data":[1,2,"x-hello"]}
+x-hello eventpush {"tag":"ev2","data":{"item":0}}
+x-hello eventdel {"tag":"ev1"}
+x-hello eventpush {"tag":"ev1","data":[1,2,"x-hello"]}
+x-hello eventpush {"tag":"ev2","data":{"item":0}}
+x-hello eventdel {"tag":"ev2"}
+EOC
+
diff --git a/coverage/scripts/04-monitor.sh b/coverage/scripts/04-monitor.sh
new file mode 100755 (executable)
index 0000000..cc9453f
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+$R/bin/afb-client -s -e $WSURL <<EOC
+monitor get {"verbosity":true}
+monitor get {"apis":true}
+monitor set {"verbosity":"debug"}
+monitor session {"refresh-token":false}
+monitor session {"refresh-token":true}
+EOC
+
diff --git a/coverage/scripts/run-parts.sh b/coverage/scripts/run-parts.sh
new file mode 100755 (executable)
index 0000000..a34bf8d
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+export PORT=$1
+export TOKEN=$2
+export URL=localhost:$PORT
+export WSURL="$URL/api?token=$TOKEN"
+export R=$(realpath $(dirname $0)/..)
+
+ls $R/scripts/[0-9][0-9]-*.sh |
+sort -n |
+while read x
+do
+       echo
+       echo
+       echo
+       echo
+       echo
+       echo
+       echo ===========================================================================
+       echo ===========================================================================
+       echo ==
+       echo == $(basename $x)
+       echo ==
+       echo ===========================================================================
+       $x
+done
diff --git a/coverage/scripts/run-test.sh b/coverage/scripts/run-test.sh
new file mode 100755 (executable)
index 0000000..ef280b6
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+export R=$(realpath $(dirname $0)/..)
+export PATH="$R/bin:$R/scripts:$PATH"
+
+$R/bin/afb-daemon-cov --help > /dev/null
+
+$R/bin/afb-daemon-cov --version > /dev/null
+
+$R/bin/afb-daemon-cov --fake-option > /dev/null
+
+$R/bin/afb-daemon-cov \
+       --verbose \
+       --verbose \
+       --verbose \
+       --verbose \
+       --quiet \
+       --quiet \
+       --quiet \
+       --quiet \
+       --quiet \
+       --quiet \
+       --log error,warning,notice,info,debug,critical,alert-error,warning,notice,info,debug,critical,alert+error,warning,notice,info,debug,critical,alert \
+       --foreground \
+       --name binder-cov \
+       --roothttp $R/www \
+       --rootbase /opx \
+       --rootapi /api \
+       --alias /icons:$R/www \
+       --apitimeout 90 \
+       --cntxtimeout 3600 \
+       --cache-eol 200 \
+       --workdir . \
+       --uploaddir . \
+       --rootdir . \
+       --ldpaths $R/ldpath/strong \
+       --binding $R/bin/demat.so \
+       --weak-ldpaths $R/ldpath/weak \
+       --auto-api $R/apis/auto \
+       --token HELLO \
+       --random-token \
+       --session-max 1000 \
+       --tracereq all \
+       --traceapi all \
+       --traceses all \
+       --traceevt all \
+       --call demat/ping:true \
+       --ws-server unix:$R/apis/ws/hello \
+       --ws-server unix:$R/apis/ws/salut \
+       --exec $R/scripts/run-parts.sh @p @t
+
+exit 0
+
diff --git a/coverage/www/index.html b/coverage/www/index.html
new file mode 100644 (file)
index 0000000..60722fe
--- /dev/null
@@ -0,0 +1,4 @@
+<html>
+<body>
+<img src="marrus-orthocanna.jpg">test</img>
+<script src="test.js"></script>
diff --git a/coverage/www/marrus-orthocanna.jpg b/coverage/www/marrus-orthocanna.jpg
new file mode 100644 (file)
index 0000000..82fb038
Binary files /dev/null and b/coverage/www/marrus-orthocanna.jpg differ
diff --git a/coverage/www/test.js b/coverage/www/test.js
new file mode 100644 (file)
index 0000000..e69de29