3 # Copyright © 2015-2016 Collabora Ltd.
5 # Permission is hereby granted, free of charge, to any person
6 # obtaining a copy of this software and associated documentation files
7 # (the "Software"), to deal in the Software without restriction,
8 # including without limitation the rights to use, copy, modify, merge,
9 # publish, distribute, sublicense, and/or sell copies of the Software,
10 # and to permit persons to whom the Software is furnished to do so,
11 # subject to the following conditions:
13 # The above copyright notice and this permission notice shall be
14 # included in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 # Build system under test: autotools or cmake
32 : "${ci_buildsys:=autotools}"
35 # OS distribution in which we are testing
36 # Typical values: ubuntu, debian; maybe fedora in future
37 : "${ci_distro:=ubuntu}"
40 # If non-empty, this is the name of a Docker image. ci-install.sh will
41 # fetch it with "docker pull" and use it as a base for a new Docker image
42 # named "ci-image" in which we will do our testing.
44 # If empty, we test on "bare metal".
45 # Typical values: ubuntu:xenial, debian:jessie-slim
50 : "${ci_host:=native}"
53 # A number of parallel jobs, passed to make -j
57 # If yes, assume we can get root using sudo; if no, only use current user
61 # OS suite (release, branch) in which we are testing.
62 # Typical values for ci_distro=debian: sid, jessie
63 # Typical values for ci_distro=fedora might be 25, rawhide
64 : "${ci_suite:=xenial}"
67 # If yes, run tests; if no, just build
71 # If yes, test failures break the build; if no, they are reported but ignored
72 : "${ci_test_fatal:=yes}"
75 # One of debug, reduced, legacy, production
76 : "${ci_variant:=production}"
78 if [ -n "$ci_docker" ]; then
80 --env=ci_buildsys="${ci_buildsys}" \
82 --env=ci_host="${ci_host}" \
83 --env=ci_parallel="${ci_parallel}" \
85 --env=ci_test="${ci_test}" \
86 --env=ci_test_fatal="${ci_test_fatal}" \
87 --env=ci_variant="${ci_variant}" \
94 if [ "$ci_test_fatal" = yes ]; then
99 NOCONFIGURE=1 ./autogen.sh
102 mkdir ci-build-${ci_variant}-${ci_host}
103 cd ci-build-${ci_variant}-${ci_host}
105 make="make -j${ci_parallel} V=1 VERBOSE=1"
109 mirror=http://repo.msys2.org/mingw/${ci_host%%-*}
110 if [ "${ci_host%%-*}" = i686 ]; then
111 mingw="$(pwd)/mingw32"
113 mingw="$(pwd)/mingw64"
115 install -d "${mingw}"
116 export PKG_CONFIG_LIBDIR="${mingw}/lib/pkgconfig"
117 export PKG_CONFIG_PATH=
118 export PKG_CONFIG="pkg-config --define-variable=prefix=${mingw}"
129 wget ${mirror}/mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
130 tar -xvf mingw-w64-${ci_host%%-*}-${pkg}-any.pkg.tar.xz
136 case "$ci_buildsys" in
138 case "$ci_variant" in
140 # Full developer/debug build.
142 set "$@" --enable-developer --enable-tests
143 # Enable optional features that are off by default
148 set "$@" --enable-user-session
152 # The test coverage for OOM-safety is too
153 # verbose to be useful on travis-ci.
154 export DBUS_TEST_MALLOC_FAILURES=0
158 # A smaller configuration than normal, with
159 # various features disabled; this emulates
160 # an older system or one that does not have
161 # all the optional libraries.
163 # No LSMs (the production build has both)
164 set "$@" --disable-selinux --disable-apparmor
165 # No inotify (we will use dnotify)
166 set "$@" --disable-inotify
167 # No epoll or kqueue (we will use poll)
168 set "$@" --disable-epoll --disable-kqueue
169 # No special init system support
170 set "$@" --disable-launchd --disable-systemd
171 # No libaudit or valgrind
172 set "$@" --disable-libaudit --without-valgrind
173 # Disable optional features, some of which are on by
175 set "$@" --disable-stats
176 set "$@" --disable-user-session
181 # An unrealistically cut-down configuration,
182 # to check that it compiles and works.
184 # Disable native atomic operations on Unix
185 # (armv4, as used as the baseline for Debian
186 # armel, is one architecture that really
188 set "$@" dbus_cv_sync_sub_and_fetch=no
189 # No epoll, kqueue or poll (we will fall back
190 # to select, even on Unix where we would
191 # usually at least have poll)
192 set "$@" --disable-epoll --disable-kqueue
193 set "$@" CPPFLAGS=-DBROKEN_POLL=1
194 # Enable SELinux and AppArmor but not
195 # libaudit - that configuration has sometimes
197 set "$@" --enable-selinux --enable-apparmor
198 set "$@" --disable-libaudit --without-valgrind
199 # No directory monitoring at all
200 set "$@" --disable-inotify --disable-dnotify
201 # No special init system support
202 set "$@" --disable-launchd --disable-systemd
203 # No X11 autolaunching
204 set "$@" --disable-x11-autolaunch
205 # Re-enable the deprecated pam_console support to make
206 # sure it still builds
207 set "$@" --with-console-auth-dir=/var/run/console
208 # Leave stats, user-session, etc. at default settings
209 # to check that the defaults can compile on an old OS
220 set "$@" --build="$(build-aux/config.guess)"
221 set "$@" --host="${ci_host}"
222 set "$@" CFLAGS=-static-libgcc
223 set "$@" CXXFLAGS=-static-libgcc
224 # don't run tests yet, Wine needs Xvfb and
225 # more msys2 libraries
227 # don't "make install" system-wide
234 --enable-installed-tests \
235 --enable-maintainer-mode \
236 --enable-modular-tests \
240 [ "$ci_test" = no ] || ${make} check || maybe_fail_tests
241 cat test/test-suite.log || :
242 [ "$ci_test" = no ] || ${make} distcheck || maybe_fail_tests
244 ${make} install DESTDIR=$(pwd)/DESTDIR
245 ( cd DESTDIR && find . -ls )
248 (jessie|xenial|stretch)
249 # these are too old for maintainer-upload-docs
253 # assume Ubuntu 18.04 'bionic', Debian 10 'buster' or newer
254 ${make} -C doc dbus-docs.tar.xz
255 tar -C $(pwd)/DESTDIR -xf doc/dbus-docs.tar.xz
256 ( cd DESTDIR/dbus-docs && find . -ls )
260 if [ "$ci_sudo" = yes ] && [ "$ci_test" = yes ]; then
262 sudo env LD_LIBRARY_PATH=/usr/local/lib \
263 /usr/local/bin/dbus-uuidgen --ensure
264 LD_LIBRARY_PATH=/usr/local/lib ${make} installcheck || \
266 cat test/test-suite.log || :
268 # re-run them with gnome-desktop-testing
269 env LD_LIBRARY_PATH=/usr/local/lib \
270 gnome-desktop-testing-runner -d /usr/local/share dbus/ || \
273 # these tests benefit from being re-run as root, and one
274 # test needs a finite fd limit to be useful
275 sudo env LD_LIBRARY_PATH=/usr/local/lib \
276 bash -c 'ulimit -S -n 1024; ulimit -H -n 4096; exec "$@"' bash \
277 gnome-desktop-testing-runner -d /usr/local/share \
278 dbus/test-dbus-daemon_with_config.test \
279 dbus/test-uid-permissions_with_config.test || \
288 set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake"
289 set "$@" -D CMAKE_PREFIX_PATH="${mingw}"
290 set "$@" -D CMAKE_INCLUDE_PATH="${mingw}/include"
291 set "$@" -D CMAKE_LIBRARY_PATH="${mingw}/lib"
292 set "$@" -D EXPAT_LIBRARY="${mingw}/lib/libexpat.dll.a"
293 set "$@" -D GLIB2_LIBRARIES="${mingw}/lib/libglib-2.0.dll.a"
294 set "$@" -D GOBJECT_LIBRARIES="${mingw}/lib/libgobject-2.0.dll.a"
295 set "$@" -D GIO_LIBRARIES="${mingw}/lib/libgio-2.0.dll.a"
297 # don't run tests yet, Wine needs Xvfb and more
306 # The test coverage for OOM-safety is too verbose to be useful on
308 export DBUS_TEST_MALLOC_FAILURES=0
309 [ "$ci_test" = no ] || ctest -VV || maybe_fail_tests
310 ${make} install DESTDIR=$(pwd)/DESTDIR
311 ( cd DESTDIR && find . -ls)
315 # vim:set sw=4 sts=4 et: