be08365450f0ea10d0d4535d4aba3588b887500e
[src/app-framework-binder.git] / coverage / scripts / run-test.sh
1 #!/bin/bash
2
3 export R=$(realpath $(dirname $0)/..)
4 export PATH="$R/bin:$R/scripts:$PATH"
5
6 cd $R/bin
7
8 lcov -c -i -d $R/bin -o $R/lcov-out.info
9
10 mk() {
11         echo
12         echo "*******************************************************************"
13         echo "** $*"
14         echo "*******************************************************************"
15         lcov -c -i -d $R/bin -o $R/fake.info
16         "$@"
17         lcov -c -d $R/bin -o $R/tmp.info
18         mv $R/lcov-out.info $R/previous.info
19         lcov -a $R/tmp.info -a $R/previous.info -o $R/lcov-out.info
20         rm $R/previous.info $R/fake.info  $R/tmp.info
21 }
22
23 mkdir /tmp/ldpaths
24 export AFB_LDPATHS=/tmp/ldpaths
25 export AFB_TRACEAPI=no
26
27 ##########################################################
28 # test to check options
29 ##########################################################
30 mk $R/bin/afb-daemon-cov --help
31
32 mk $R/bin/afb-daemon-cov --version
33
34 mk $R/bin/afb-daemon-cov --no-httpd --fake-option
35
36 mk $R/bin/afb-daemon-cov --daemon --session-max
37
38 mk $R/bin/afb-daemon-cov --ws-client fake --session-max toto
39
40 mk $R/bin/afb-daemon-cov --foreground --port -55
41
42 mk $R/bin/afb-daemon-cov --foreground --port 9999999
43
44 mk $R/bin/afb-daemon-cov --no-ldpath --traceapi fake
45
46 mk $R/bin/afb-daemon-cov --traceditf all --tracesvc all --log error,alarm
47
48 mk $R/bin/afb-daemon-cov --call noapi/noverb:false
49
50 mk $R/bin/afb-daemon-cov --call not-a-call
51
52 LISTEN_FDNAMES=toto,demat LISTEN_FDS=5
53 typeset -x LISTEN_FDNAMES LISTEN_FDS
54 mk $R/bin/afb-daemon-cov --no-ldpath --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
55 typeset +x LISTEN_FDNAMES LISTEN_FDS
56
57 mk $R/bin/afb-daemon-cov --weak-ldpaths $R/ldpath/weak --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
58
59 AFB_DEBUG_BREAK=zero,one,two,main-start  AFB_DEBUG_WAIT="here I am"
60 typeset -x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
61 mk $R/bin/afb-daemon-cov --rootdir $R/i-will-never-exist
62 typeset +x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
63
64 mk $R/bin/afb-daemon-cov --workdir=/etc/you/should/not/be/able/to/create/me
65
66 mk $R/bin/afb-daemon-cov --exec $R/it-doesn-t-exist
67
68 ##########################################################
69 # test of the bench
70 ##########################################################
71 mk $R/bin/test-apiset
72
73 mk $R/bin/test-session
74
75 mk $R/bin/test-wrap-json
76
77 ##########################################################
78 # true life test
79 ##########################################################
80 mk \
81 valgrind \
82         --log-file=$R/valgrind.out \
83         --trace-children=no \
84         --track-fds=yes \
85         --leak-check=full \
86         --show-leak-kinds=all \
87         --num-callers=50 \
88 $R/bin/afb-daemon-cov \
89         --verbose \
90         --verbose \
91         --verbose \
92         --verbose \
93         --quiet \
94         --quiet \
95         --quiet \
96         --quiet \
97         --quiet \
98         --quiet \
99         --log error,warning,notice,info,debug,critical,alert-error,warning,notice,info,debug,critical,alert+error,warning,notice,info,debug,critical,alert \
100         --foreground \
101         --name binder-cov \
102         --port 8888 \
103         --roothttp $R/www \
104         --rootbase /opa \
105         --rootapi /api \
106         --alias /icons:$R/www \
107         --apitimeout 90 \
108         --cntxtimeout 3600 \
109         --cache-eol 200 \
110         --workdir . \
111         --uploaddir . \
112         --rootdir . \
113         --ldpaths $R/ldpath/strong \
114         --binding $R/bin/demat.so \
115         --auto-api $R/apis/auto \
116         --token HELLO \
117         --random-token \
118         --session-max 1000 \
119         --tracereq all \
120         --traceapi all \
121         --traceses all \
122         --traceevt all \
123         --traceglob none \
124         --monitoring \
125         --set hello/key:a-kind-of-text \
126         --call demat/ping:true \
127         --call hello/ping:false \
128         --ws-server unix:$R/apis/ws/hello \
129         --ws-server unix:$R/apis/ws/salut \
130         --exec $R/scripts/run-parts.sh @p @t
131
132 ##########################################################
133 # true life test
134 ##########################################################
135 mk \
136 valgrind \
137         --log-file=$R/valgrind.out \
138         --trace-children=no \
139         --track-fds=yes \
140         --leak-check=full \
141         --show-leak-kinds=all \
142         --num-callers=50 \
143 $R/bin/afb-daemon-cov \
144         --quiet \
145         --quiet \
146         --foreground \
147         --roothttp $R/www \
148         --alias /icons:$R/www \
149         --workdir . \
150         --uploaddir . \
151         --rootdir . \
152         --ldpaths $R/ldpath/strong \
153         --binding $R/bin/demat.so \
154         --auto-api $R/apis/auto \
155         --random-token \
156         --ws-server unix:$R/apis/ws/hello \
157         --ws-server unix:$R/apis/ws/salut \
158         --ws-server localhost:9595/salut \
159         --exec \
160             afb-daemon \
161                 --auto-api $R/apis/auto \
162                 --auto-api $R/apis/ws \
163                 --ws-client localhost:@p/salut2 \
164                 $R/scripts/run-parts.sh @@p @@t
165
166 exit 0
167
168