5d1b9a963cfc55b7edba03bccda79037ef586fa8
[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         --call demat/ping:true \
126         --call hello/ping:false \
127         --ws-server unix:$R/apis/ws/hello \
128         --ws-server unix:$R/apis/ws/salut \
129         --exec $R/scripts/run-parts.sh @p @t
130
131 ##########################################################
132 # true life test
133 ##########################################################
134 mk \
135 valgrind \
136         --log-file=$R/valgrind.out \
137         --trace-children=no \
138         --track-fds=yes \
139         --leak-check=full \
140         --show-leak-kinds=all \
141         --num-callers=50 \
142 $R/bin/afb-daemon-cov \
143         --quiet \
144         --quiet \
145         --foreground \
146         --roothttp $R/www \
147         --alias /icons:$R/www \
148         --workdir . \
149         --uploaddir . \
150         --rootdir . \
151         --ldpaths $R/ldpath/strong \
152         --binding $R/bin/demat.so \
153         --auto-api $R/apis/auto \
154         --random-token \
155         --ws-server unix:$R/apis/ws/hello \
156         --ws-server unix:$R/apis/ws/salut \
157         --ws-server localhost:9595/salut \
158         --exec \
159             afb-daemon \
160                 --auto-api $R/apis/auto \
161                 --auto-api $R/apis/ws \
162                 --ws-client localhost:@p/salut2 \
163                 $R/scripts/run-parts.sh @@p @@t
164
165 exit 0
166
167