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