u16id: Add maps for identifiers id of 16 bits
[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 vg() {
11         if [[ -z "$NOVALGRIND" ]]; then
12                 valgrind "$@"
13         else
14                 while :; do
15                         case "$1" in
16                         --*) shift;;
17                         *) break;;
18                         esac
19                 done
20                 "$@"
21         fi
22 }
23
24 mkbefore() {
25         echo
26         echo "*******************************************************************"
27         echo "** $*"
28         echo "*******************************************************************"
29         lcov -c -i -d $R/bin -o $R/fake.info
30 }
31
32 mkafter() {
33         lcov -c -d $R/bin -o $R/tmp.info
34         mv $R/lcov-out.info $R/previous.info
35         lcov -a $R/tmp.info -a $R/previous.info -o $R/lcov-out.info
36         rm $R/previous.info $R/fake.info  $R/tmp.info
37 }
38
39 mk() {
40         mkbefore "$@"
41         "$@"
42         mkafter "$@"
43 }
44
45 mkdbgwait() {
46         mkbefore "$@"
47         "$@" &
48         sleep 1
49         kill -INT %%
50         sleep 1
51         mkafter "$@"
52 }
53
54 mkdir /tmp/ldpaths
55 export AFB_LDPATHS=/tmp/ldpaths
56 export AFB_TRACEAPI=no
57
58 echo '
59 ##########################################################
60 # test to check options
61 ##########################################################
62 '
63 mk $R/bin/afb-daemon-cov --help
64
65 mk $R/bin/afb-daemon-cov --version
66
67 mk $R/bin/afb-daemon-cov --no-httpd --fake-option
68
69 mk $R/bin/afb-daemon-cov --daemon --session-max
70
71 mk $R/bin/afb-daemon-cov --ws-client fake --session-max toto
72
73 mk $R/bin/afb-daemon-cov --foreground --port -55
74
75 mk $R/bin/afb-daemon-cov --foreground --port 9999999
76
77 mk $R/bin/afb-daemon-cov --no-ldpath --traceapi fake
78
79 mk $R/bin/afb-daemon-cov --traceditf all --tracesvc all --log error,alarm
80
81 mk $R/bin/afb-daemon-cov --call noapi/noverb:false
82
83 mk $R/bin/afb-daemon-cov --call not-a-call
84
85 LISTEN_FDNAMES=toto,demat LISTEN_FDS=5
86 typeset -x LISTEN_FDNAMES LISTEN_FDS
87 mk $R/bin/afb-daemon-cov --no-ldpath --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
88 typeset +x LISTEN_FDNAMES LISTEN_FDS
89
90 mk $R/bin/afb-daemon-cov --weak-ldpaths $R/ldpath/weak --binding $R/bin/demat.so --ws-server sd:demat --call "demat/exit:0"
91
92 AFB_DEBUG_BREAK=zero,one,two,main-start  AFB_DEBUG_WAIT="here I am,main-args"
93 typeset -x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
94 mkdbgwait $R/bin/afb-daemon-cov --rootdir $R/i-will-never-exist
95 typeset +x AFB_DEBUG_BREAK AFB_DEBUG_WAIT
96
97 mk $R/bin/afb-daemon-cov --workdir=/etc/you/should/not/be/able/to/create/me
98
99 mk $R/bin/afb-daemon-cov --exec $R/it-doesn-t-exist
100
101 echo '
102 ##########################################################
103 # test of the bench
104 ##########################################################
105 '
106 mk $R/bin/test-apiset
107
108 mk $R/bin/test-session
109
110 mk $R/bin/test-wrap-json
111
112 mk $R/bin/test-u16id
113
114 echo '
115 ##########################################################
116 # true life test: run parts as direct client
117 ##########################################################
118 '
119 mk \
120 vg \
121         --log-file=$R/valgrind.out \
122         --trace-children=no \
123         --track-fds=yes \
124         --leak-check=full \
125         --show-leak-kinds=all \
126         --num-callers=50 \
127 $R/bin/afb-daemon-cov \
128         --verbose \
129         --verbose \
130         --verbose \
131         --verbose \
132         --quiet \
133         --quiet \
134         --quiet \
135         --quiet \
136         --quiet \
137         --quiet \
138         --log error,warning,notice,info,debug,critical,alert-error,warning,notice,info,debug,critical,alert+error,warning,notice,info,debug,critical,alert \
139         --foreground \
140         --name binder-cov \
141         --port 8888 \
142         --roothttp $R/www \
143         --rootbase /opa \
144         --rootapi /api \
145         --alias /icons:$R/www \
146         --apitimeout 90 \
147         --cntxtimeout 3600 \
148         --cache-eol 200 \
149         --workdir . \
150         --uploaddir . \
151         --rootdir . \
152         --ldpaths $R/ldpath/strong \
153         --binding $R/bin/demat.so \
154         --auto-api $R/apis/auto \
155         --token HELLO \
156         --random-token \
157         --session-max 1000 \
158         --tracereq all \
159         --traceapi all \
160         --traceses all \
161         --traceevt all \
162         --traceglob none \
163         --monitoring \
164         --set hello/key:a-kind-of-text \
165         --call demat/ping:true \
166         --call hello/ping:false \
167         --ws-server unix:$R/apis/ws/hello \
168         --ws-server unix:$R/apis/ws/salut \
169         --exec $R/scripts/run-parts.sh @p @t
170
171 echo '
172 ##########################################################
173 # true life test: run parts as in-direct server
174 ##########################################################
175 '
176 mk \
177 vg \
178         --log-file=$R/valgrind.out \
179         --trace-children=no \
180         --track-fds=yes \
181         --leak-check=full \
182         --show-leak-kinds=all \
183         --num-callers=50 \
184 $R/bin/afb-daemon-cov \
185         --foreground \
186         --verbose \
187         --verbose \
188         --roothttp $R/www \
189         --alias /icons:$R/www \
190         --workdir . \
191         --uploaddir . \
192         --rootdir . \
193         --port 8888 \
194         --ldpaths $R/ldpath/strong \
195         --binding $R/bin/demat.so \
196         --auto-api $R/apis/auto \
197         --random-token \
198         --ws-server unix:$R/apis/ws/hello \
199         --ws-server unix:$R/apis/ws/salut \
200         --ws-server localhost:9595/salut \
201         --exec \
202             $R/bin/afb-daemon-nocov \
203                 --quiet \
204                 --quiet \
205                 --port 9999 \
206                 --auto-api $R/apis/auto \
207                 --auto-api $R/apis/ws \
208                 --ws-client localhost:9595/salut2 \
209                 --exec $R/scripts/run-parts.sh @@p @@t
210
211 echo '
212 ##########################################################
213 # true life test: run parts as in-direct client
214 ##########################################################
215 '
216 mk \
217 vg \
218         --log-file=$R/valgrind.out \
219         --trace-children=no \
220         --track-fds=yes \
221         --leak-check=full \
222         --show-leak-kinds=all \
223         --num-callers=50 \
224 $R/bin/afb-daemon-nocov \
225         --quiet \
226         --quiet \
227         --foreground \
228         --roothttp $R/www \
229         --alias /icons:$R/www \
230         --workdir . \
231         --uploaddir . \
232         --rootdir . \
233         --port 8888 \
234         --ldpaths $R/ldpath/strong \
235         --binding $R/bin/demat.so \
236         --auto-api $R/apis/auto \
237         --random-token \
238         --ws-server unix:$R/apis/ws/hello \
239         --ws-server unix:$R/apis/ws/salut \
240         --ws-server localhost:9595/salut \
241         --exec \
242             $R/bin/afb-daemon-cov \
243                 --port 9999 \
244                 --verbose \
245                 --verbose \
246                 --auto-api $R/apis/auto \
247                 --auto-api $R/apis/ws \
248                 --ws-client localhost:9595/salut2 \
249                 --exec $R/scripts/run-parts.sh @@p @@t
250
251 exit 0
252
253