Debian Codegraph @

tests/CI/buildAsterisk.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 CIDIR=$(dirnamescip-shell system . . dirname. $(readlinkscip-shell system . . readlink. -fn $0))
4 COVERAGE=0
5 REF_DEBUG=0
6 DISABLE_BINARY_MODULES=0
7 NO_CONFIGURE=0
8 NO_MENUSELECT=0
9 NO_MAKE=0
10 NO_ALEMBIC=0
11 NO_DEV_MODE=0
12 source $CIDIR/ci.functions
13
14 set -e
15
16 if [scip-shell system . . `[`. -z $BRANCH_NAME ]; then
17 BRANCH_NAME=$(gitscip-shell system . . git. config -f .gitreview --get gerrit.defaultbranch)
18 fi
19
20 if [[ "$BRANCH_NAME" =~ devel(opment)?/([0-9]+)/.+ ]] ; then
21 export MAINLINE_BRANCH="${BASH_REMATCH[2]}"
22 fi
23
24 gen_catsscip-shell shell shell-project 0.0.0 gen_cats().() {
25 set +x
26 action=$1
27 shift
28 cats=$@
29
30 for x in $cats ; do
31 echoscip-shell system . . echo. " --${action}-category ${x}"
32 done
33 }
34
35 gen_modsscip-shell shell shell-project 0.0.0 gen_mods().() {
36 set +x
37 action=$1
38 shift
39 mods=$@
40
41 for x in $mods ; do
42 echoscip-shell system . . echo. " --${action} ${x}"
43 done
44 }
45
46 run_alembicscip-shell shell shell-project 0.0.0 run_alembic().() {
47 pushd contrib/ast-db-manage >/dev/nullscip-shell filesystem . . `/dev/null`.
48 runner alembic $@
49 RC=$?
50 popd > /dev/nullscip-shell filesystem . . `/dev/null`.
51 return $RC
52 }
53
54 [scip-shell system . . `[`. x"$OUTPUT_DIR" != x ] && mkdirscip-shell system . . mkdir. -p "$OUTPUT_DIR" 2> /dev/nullscip-shell filesystem . . `/dev/null`.
55
56 if [scip-shell system . . `[`. -z $TESTED_ONLY ]; then
57 # Skip building untested modules by default if coverage is enabled.
58 TESTED_ONLY=$COVERAGE
59 fi
60
61 if [scip-shell system . . `[`. -z $LCOV_DIR ]; then
62 LCOV_DIR="${OUTPUT_DIR:+${OUTPUT_DIR}/}lcov"
63 fi
64
65 if [scip-shell system . . `[`. x"$CACHE_DIR" != x ] ; then
66 mkdirscip-shell system . . mkdir. -p $CACHE_DIR/sounds $CACHE_DIR/externals 2> /dev/nullscip-shell filesystem . . `/dev/null`.
67 fi
68
69 if [scip-shell system . . `[`. ${CCACHE_DISABLE:-0} -ne 1 ] ; then
70 if [scip-shell system . . `[`. x"$CACHE_DIR" != x ] ; then
71 mkdirscip-shell system . . mkdir. -p $CACHE_DIR/ccache
72 export CCACHE_UMASK=002
73 export CCACHE_DIR=$CACHE_DIR/ccache
74 fi
75 case ":${PATH:-}:" in
76 *:/usr/lib*/ccache:*)
77 echoscip-shell system . . echo. "Enabling ccache at $CCACHE_DIR"
78 ;;
79 *)
80 if [scip-shell system . . `[`. -d /usr/lib64/ccachescip-shell filesystem . . `/usr/lib64/ccache`. ] ; then
81 echoscip-shell system . . echo. "Enabling ccache at /usr/lib64/ccache with $CCACHE_DIR"
82 export PATH="/usr/lib64/ccache${PATH:+:$PATH}"
83 elif [scip-shell system . . `[`. -d /usr/lib/ccachescip-shell filesystem . . `/usr/lib/ccache`. ] ; then
84 echoscip-shell system . . echo. "Enabling ccache at /usr/lib/ccache with $CCACHE_DIR"
85 export PATH="/usr/lib/ccache${PATH:+:$PATH}"
86 fi
87 ;;
88 esac
89 fi
90
91 runner ccache -s
92 runner ulimit -a
93
94 MAKE=`whichscip-shell system . . which. make`
95 PKGCONFIG=`whichscip-shell system . . which. pkg-config`
96 _libdir=`${CIDIR}/findLibdir.sh`
97
98 _version=$(./build_tools/make_version .)
99 for var in BRANCH_NAME MAINLINE_BRANCH OUTPUT_DIR CACHE_DIR CCACHE_DISABLE CCACHE_DIR _libdir _version ; do
100 declare -p $var || :
101 done
102
103 common_config_args="--prefix=/usr ${_libdir:+--libdir=${_libdir}} --sysconfdir=/etc --with-pjproject-bundled"
104 $PKGCONFIG 'jansson >= 2.11' || common_config_args+=" --with-jansson-bundled"
105 common_config_args+=" ${CACHE_DIR:+--with-sounds-cache=${CACHE_DIR}/sounds --with-externals-cache=${CACHE_DIR}/externals}"
106 if [scip-shell system . . `[`. $NO_DEV_MODE -eq 0 ] ; then
107 common_config_args+=" --enable-dev-mode"
108 fi
109 if [scip-shell system . . `[`. $COVERAGE -eq 1 ] ; then
110 common_config_args+=" --enable-coverage"
111 fi
112 if [scip-shell system . . `[`. "$BRANCH_NAME" == "master" -o $DISABLE_BINARY_MODULES -eq 1 ] ; then
113 common_config_args+=" --disable-binary-modules"
114 fi
115
116 export WGET_EXTRA_ARGS="--quiet"
117
118 if [scip-shell system . . `[`. $NO_CONFIGURE -eq 0 ] ; then
119 runner ./configure ${common_config_args} > ${OUTPUT_DIR:+${OUTPUT_DIR}/}configure.txt
120 fi
121
122 if [scip-shell system . . `[`. $NO_MENUSELECT -eq 0 ] ; then
123 runner ${MAKE} menuselect.makeopts
124
125 runner menuselect/menuselect `gen_modsscip-shell shell shell-project 0.0.0 gen_mods(). enable DONT_OPTIMIZE BETTER_BACKTRACES` menuselect.makeopts
126 if [scip-shell system . . `[`. $NO_DEV_MODE -eq 0 ] ; then
127 runner menuselect/menuselect `gen_modsscip-shell shell shell-project 0.0.0 gen_mods(). enable MALLOC_DEBUG DO_CRASH TEST_FRAMEWORK` menuselect.makeopts
128 fi
129 runner menuselect/menuselect `gen_modsscip-shell shell shell-project 0.0.0 gen_mods(). disable COMPILE_DOUBLE BUILD_NATIVE` menuselect.makeopts
130 if [scip-shell system . . `[`. $REF_DEBUG -eq 1 ] ; then
131 runner menuselect/menuselect --enable REF_DEBUG menuselect.makeopts
132 fi
133
134 cat_enables=""
135
136 if [[ ! "${BRANCH_NAME}" =~ ^certified ]] ; then
137 cat_enables+=" MENUSELECT_BRIDGES MENUSELECT_CEL MENUSELECT_CDR"
138 cat_enables+=" MENUSELECT_CHANNELS MENUSELECT_CODECS MENUSELECT_FORMATS MENUSELECT_FUNCS"
139 cat_enables+=" MENUSELECT_PBX MENUSELECT_RES MENUSELECT_UTILS"
140 fi
141
142 if [scip-shell system . . `[`. $NO_DEV_MODE -eq 0 ] ; then
143 cat_enables+=" MENUSELECT_TESTS"
144 fi
145 runner menuselect/menuselect `gen_catsscip-shell shell shell-project 0.0.0 gen_cats(). enable $cat_enables` menuselect.makeopts
146
147 mod_disables="res_digium_phone"
148 if [scip-shell system . . `[`. $TESTED_ONLY -eq 1 ] ; then
149 # These modules are not tested at all. They are loaded but nothing is ever done
150 # with them, no testsuite tests depend on them.
151 mod_disables+=" app_adsiprog app_alarmreceiver app_celgenuserevent app_db app_dictate"
152 mod_disables+=" app_dumpchan app_externalivr app_festival app_getcpeid"
153 mod_disables+=" app_jack app_milliwatt app_minivm app_morsecode app_mp3 app_privacy"
154 mod_disables+=" app_readexten app_sms app_speech_utils app_test app_waitforring"
155 mod_disables+=" app_waitforsilence app_waituntil app_zapateller"
156 mod_disables+=" cdr_adaptive_odbc cdr_custom cdr_manager cdr_odbc cdr_pgsql cdr_radius"
157 mod_disables+=" cdr_tds"
158 mod_disables+=" cel_odbc cel_pgsql cel_radius cel_sqlite3_custom cel_tds"
159 mod_disables+=" chan_console chan_motif chan_rtp chan_unistim"
160 mod_disables+=" func_frame_trace func_pitchshift func_speex func_volume func_dialgroup"
161 mod_disables+=" func_periodic_hook func_sprintf func_enum func_extstate func_sysinfo func_iconv"
162 mod_disables+=" func_callcompletion func_version func_rand func_sha1 func_module func_md5"
163 mod_disables+=" pbx_dundi pbx_loopback"
164 mod_disables+=" res_ael_share res_calendar res_config_ldap res_config_pgsql res_corosync"
165 mod_disables+=" res_http_post res_rtp_multicast res_snmp res_xmpp"
166 fi
167
168 runner menuselect/menuselect `gen_modsscip-shell shell shell-project 0.0.0 gen_mods(). disable $mod_disables` menuselect.makeopts
169
170 mod_enables="app_voicemail app_directory"
171 mod_enables+=" res_mwi_external res_ari_mailboxes res_mwi_external_ami res_stasis_mailbox"
172 mod_enables+=" CORE-SOUNDS-EN-GSM MOH-OPSOUND-GSM EXTRA-SOUNDS-EN-GSM"
173 runner menuselect/menuselect `gen_modsscip-shell shell shell-project 0.0.0 gen_mods(). enable $mod_enables` menuselect.makeopts
174 fi
175
176 if [scip-shell system . . `[`. $NO_MAKE -eq 0 ] ; then
177 runner ${MAKE} -j8 full || runner ${MAKE} -j1 NOISY_BUILD=yes full
178 fi
179
180 runner rm -f ${LCOV_DIR}/*.info
181 if [scip-shell system . . `[`. $COVERAGE -eq 1 ] ; then
182 runner mkdir -p ${LCOV_DIR}
183
184 # Zero counter data
185 runner lcov --quiet --directory . --zerocounters
186
187 # Branch coverage is not supported by --initial. Disable to suppresses a notice
188 # printed if it was enabled in lcovrc.
189 # This initial capture ensures any module which was built but never loaded is
190 # reported with 0% coverage for all sources.
191 runner lcov --quiet --directory . --no-external --capture --initial --rc lcov_branch_coverage=0 \
192 --output-file ${LCOV_DIR}/initial.info
193 fi
194
195 if [scip-shell system . . `[`. $NO_ALEMBIC -eq 0 ] ; then
196 ALEMBIC=$(whichscip-shell system . . which. alembic 2>/dev/nullscip-shell filesystem . . `/dev/null`. || : )
197 if [scip-shell system . . `[`. x"$ALEMBIC" = x ] ; then
198 >&2 echoscip-shell system . . echo. "Alembic not installed"
199 exit 1
200 fi
201
202 findscip-shell system . . find. contrib/ast-db-manage -name *.pyc -delete
203 out=$(run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c config.ini.sample branches)
204 if [scip-shell system . . `[`. "x$out" != "x" ] ; then
205 >&2 echoscip-shell system . . echo. "Alembic branches were found for config"
206 >&2 echoscip-shell system . . echo. $out
207 exit 1
208 fi
209 run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c config.ini.sample upgrade head --sql > "${OUTPUT_DIR:+${OUTPUT_DIR}/}alembic-config.sql" || exit 1
210 echoscip-shell system . . echo. "Alembic for 'config' OK"
211
212 out=$(run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c cdr.ini.sample branches)
213 if [scip-shell system . . `[`. "x$out" != "x" ] ; then
214 >&2 echoscip-shell system . . echo. "Alembic branches were found for cdr"
215 >&2 echoscip-shell system . . echo. $out
216 exit 1
217 fi
218 run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c cdr.ini.sample upgrade head --sql > "${OUTPUT_DIR:+${OUTPUT_DIR}/}alembic-cdr.sql" || exit 1
219 echoscip-shell system . . echo. "Alembic for 'cdr' OK"
220
221 out=$(run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c voicemail.ini.sample branches)
222 if [scip-shell system . . `[`. "x$out" != "x" ] ; then
223 >&2 echoscip-shell system . . echo. "Alembic branches were found for voicemail"
224 >&2 echoscip-shell system . . echo. $out
225 exit 1
226 fi
227 run_alembicscip-shell shell shell-project 0.0.0 run_alembic(). -c voicemail.ini.sample upgrade head --sql > "${OUTPUT_DIR:+${OUTPUT_DIR}/}alembic-voicemail.sql" || exit 1
228 echoscip-shell system . . echo. "Alembic for 'voicemail' OK"
229 fi
230
231 if [scip-shell system . . `[`. -f "doc/core-en_US.xml" ] ; then
232 runner ${MAKE} validate-docs || ${MAKE} NOISY_BUILD=yes validate-docs
233 fi