summaryrefslogtreecommitdiffstats
path: root/coverage
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-07-24 12:53:15 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2018-07-27 17:44:07 +0200
commit4772c5626204f6ab0e26b938f49a6719fb10f88d (patch)
treeaa14c94506e6edbdb139653157b56c9a75d2eb17 /coverage
parent4bbad5bf527c8310c1f076a5cdf512d4385f8b76 (diff)
coverage: Improve coverage test
The test now raise an overall coverage rate: lines......: 75.4% (8356 of 11080 lines) functions..: 80.4% (1094 of 1360 functions) Also Improve the documentation and improve parts of code. Change-Id: Ic2b8bc2f85d4181aa0b358a953f95cb105a0eed9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'coverage')
-rw-r--r--coverage/.gitignore8
-rw-r--r--coverage/bin/Makefile5
l---------coverage/ldpath/strong/hellov2.so1
-rwxr-xr-xcoverage/scripts/00-trace.sh3
-rwxr-xr-xcoverage/scripts/01-http.sh1
-rwxr-xr-xcoverage/scripts/02-hello.sh14
-rwxr-xr-x[-rw-r--r--]coverage/scripts/07-inet.sh0
-rwxr-xr-xcoverage/scripts/run-test.sh61
8 files changed, 80 insertions, 13 deletions
diff --git a/coverage/.gitignore b/coverage/.gitignore
index 69f6ea4f..531f1a98 100644
--- a/coverage/.gitignore
+++ b/coverage/.gitignore
@@ -8,7 +8,7 @@ bin/afb-daemon-cov
bin/test-apiset
bin/test-session
bin/test-wrap-json
-*.o
-*.so
-*.gcda
-*.gcno
+bin/*.o
+bin/*.so
+bin/*.gcda
+bin/*.gcno
diff --git a/coverage/bin/Makefile b/coverage/bin/Makefile
index f9d561ed..ef8b68e8 100644
--- a/coverage/bin/Makefile
+++ b/coverage/bin/Makefile
@@ -62,11 +62,10 @@ cflags = $(ccflags) $(ldflags)
defs = -DAGL_DEVEL \
-DWITH_MONITORING_OPTION \
- -DWITH_SUPERVISION \
-DAFB_VERSION=\"cov\" \
-DBINDING_INSTALL_DIR=\"$(shell pwd)/fake\"
-afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-' )
+afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|/fdev-epoll.c|/afb-ws-client.c' )
afb_lib_obj = $(patsubst $(srcdir)/%.c,%.o,$(afb_lib_src))
afb_lib = afb-lib.a
afb_lib_defs = $(defs)
@@ -74,7 +73,7 @@ afb_lib_defs = $(defs)
afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_obj)
afb_daemon_defs = $(afb_lib_defs)
-afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(afb_lib_src)
+afb_client_srcs = $(srcdir)/main-afb-client-demo.c $(srcdir)/afb-ws-client.c $(afb_lib_src)
afb_client_defs = $(defs)
tst_defs = $(defs)
diff --git a/coverage/ldpath/strong/hellov2.so b/coverage/ldpath/strong/hellov2.so
new file mode 120000
index 00000000..f60e708b
--- /dev/null
+++ b/coverage/ldpath/strong/hellov2.so
@@ -0,0 +1 @@
+../../bin/hellov2.so \ No newline at end of file
diff --git a/coverage/scripts/00-trace.sh b/coverage/scripts/00-trace.sh
index 27edc5b1..247be611 100755
--- a/coverage/scripts/00-trace.sh
+++ b/coverage/scripts/00-trace.sh
@@ -2,6 +2,7 @@
$R/bin/afb-client -k $WSURL <<EOC &
monitor trace {"add":{"tag":"fun","api":"*","request":"*","event":"*","session":"*","global":"*"}}
-monitor trace {"add":{"tag":"T","api":"*","request":"*","event":"*","session":"*","global":"*"}}
+monitor trace {"add":{"tag":"T","api":"!(monitor)","request":"*","event":"*","session":"*","global":"*"}}
+monitor trace {"add":{"tag":"T","api":"monitor","request":"none"}}
monitor trace {"drop":{"tag":"fun"}}
EOC
diff --git a/coverage/scripts/01-http.sh b/coverage/scripts/01-http.sh
index 9ffd640f..cb69595e 100755
--- a/coverage/scripts/01-http.sh
+++ b/coverage/scripts/01-http.sh
@@ -5,6 +5,7 @@ curl -s -o /dev/null $URL/index.html
curl -s -o /dev/null $URL/marrus-orthocanna.jpg
curl -s -o /dev/null $URL/test.js
curl -s -o /dev/null $URL/icons/marrus-orthocanna.jpg
+curl -s -o /dev/null $URL/opa/item/extra/index.html
curl -s -o /dev/null $URL/fake-file.html
diff --git a/coverage/scripts/02-hello.sh b/coverage/scripts/02-hello.sh
index 9e3a9b08..de6e2de4 100755
--- a/coverage/scripts/02-hello.sh
+++ b/coverage/scripts/02-hello.sh
@@ -38,9 +38,22 @@ hello eventdel {"tag":"ev2"}
hello hasperm {"perm":"some-permissison"}
hello appid true
hello uid true
+hello reftok true
+hello has_loa-1
+hello has_loa-2
+hello has_loa-3
hello set-loa 1
+hello has_loa-1
+hello has_loa-2
+hello has_loa-3
hello set-loa 3
+hello has_loa-1
+hello has_loa-2
+hello has_loa-3
hello close true
+hello has_loa-1
+hello has_loa-2
+hello has_loa-3
hello setctx "some-text-0"
hello setctxif "some-text-1"
hello getctx
@@ -89,6 +102,7 @@ extra ping {"c":[1,2,3]}
extra query {"c":[1,2,3]}
extra blablabla {"c":[1,2,3]}
extra api {"action":"addverb","verb":"ping"}
+extra call {"api":"hello","verb":"eventunsub","args":{"tag":"EVENT"}}
extra ping {"c":[1,2,3]}
hello api {"action":"destroy","api":"extra"}
extra ping {"c":[1,2,3]}
diff --git a/coverage/scripts/07-inet.sh b/coverage/scripts/07-inet.sh
index f4e8a297..f4e8a297 100644..100755
--- a/coverage/scripts/07-inet.sh
+++ b/coverage/scripts/07-inet.sh
diff --git a/coverage/scripts/run-test.sh b/coverage/scripts/run-test.sh
index caaec79f..5d1b9a96 100755
--- a/coverage/scripts/run-test.sh
+++ b/coverage/scripts/run-test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
export R=$(realpath $(dirname $0)/..)
export PATH="$R/bin:$R/scripts:$PATH"
@@ -45,10 +45,26 @@ mk $R/bin/afb-daemon-cov --no-ldpath --traceapi fake
mk $R/bin/afb-daemon-cov --traceditf all --tracesvc all --log error,alarm
-LISTEN_FDNAMES=toto,demat LISTEN_FDS=5 mk $R/bin/afb-daemon-cov --no-ldpath --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
+mk $R/bin/afb-daemon-cov --call noapi/noverb:false
+
+mk $R/bin/afb-daemon-cov --call not-a-call
+
+LISTEN_FDNAMES=toto,demat LISTEN_FDS=5
+typeset -x LISTEN_FDNAMES LISTEN_FDS
+mk $R/bin/afb-daemon-cov --no-ldpath --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
+typeset +x LISTEN_FDNAMES LISTEN_FDS
mk $R/bin/afb-daemon-cov --weak-ldpaths $R/ldpath/weak --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
+AFB_DEBUG_BREAK=zero,one,two,main-start AFB_DEBUG_WAIT="here I am"
+typeset -x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
+mk $R/bin/afb-daemon-cov --rootdir $R/i-will-never-exist
+typeset +x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
+
+mk $R/bin/afb-daemon-cov --workdir=/etc/you/should/not/be/able/to/create/me
+
+mk $R/bin/afb-daemon-cov --exec $R/it-doesn-t-exist
+
##########################################################
# test of the bench
##########################################################
@@ -85,7 +101,7 @@ $R/bin/afb-daemon-cov \
--name binder-cov \
--port 8888 \
--roothttp $R/www \
- --rootbase /opx \
+ --rootbase /opa \
--rootapi /api \
--alias /icons:$R/www \
--apitimeout 90 \
@@ -104,13 +120,48 @@ $R/bin/afb-daemon-cov \
--traceapi all \
--traceses all \
--traceevt all \
+ --traceglob none \
--monitoring \
--call demat/ping:true \
+ --call hello/ping:false \
--ws-server unix:$R/apis/ws/hello \
--ws-server unix:$R/apis/ws/salut \
- --ws-server localhost:9595/salut \
- --ws-client localhost:9595/salut2 \
--exec $R/scripts/run-parts.sh @p @t
+##########################################################
+# true life test
+##########################################################
+mk \
+valgrind \
+ --log-file=$R/valgrind.out \
+ --trace-children=no \
+ --track-fds=yes \
+ --leak-check=full \
+ --show-leak-kinds=all \
+ --num-callers=50 \
+$R/bin/afb-daemon-cov \
+ --quiet \
+ --quiet \
+ --foreground \
+ --roothttp $R/www \
+ --alias /icons:$R/www \
+ --workdir . \
+ --uploaddir . \
+ --rootdir . \
+ --ldpaths $R/ldpath/strong \
+ --binding $R/bin/demat.so \
+ --auto-api $R/apis/auto \
+ --random-token \
+ --ws-server unix:$R/apis/ws/hello \
+ --ws-server unix:$R/apis/ws/salut \
+ --ws-server localhost:9595/salut \
+ --exec \
+ afb-daemon \
+ --auto-api $R/apis/auto \
+ --auto-api $R/apis/ws \
+ --ws-client localhost:@p/salut2 \
+ $R/scripts/run-parts.sh @@p @@t
+
exit 0
+