Skip to content

Commit e89681e

Browse files
authored
Run tests on multiple Ubuntu releases (#71)
Ubuntu 14.04 is becoming too old, and misses changes and breakage from newer system libraries, like issue #69. Move to building and testing in Launchpad buildd chroots for a given Ubuntu release and architecture. Add Travis configuration to use this for the current LTS, the current stable, and the current devel series.
1 parent b1fe383 commit e89681e

File tree

2 files changed

+63
-29
lines changed

2 files changed

+63
-29
lines changed

.travis.yml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,11 @@
11
dist: trusty
2-
sudo: false
32
language: c
4-
addons:
5-
apt:
6-
packages:
7-
- pkg-config
8-
- valac
9-
- libglib2.0-dev
10-
- libudev-dev
11-
- libgudev-1.0-dev
12-
- python3-gi
13-
- gobject-introspection
14-
- libgirepository1.0-dev
15-
- gir1.2-glib-2.0
16-
- gir1.2-gudev-1.0
17-
- gtk-doc-tools
18-
- udev
19-
- xserver-xorg-video-dummy
20-
- xserver-xorg-input-evdev
21-
- xserver-xorg-input-synaptics
22-
- xinput
23-
- usbutils
24-
- gphoto2
25-
- lcov
26-
- valgrind
27-
script:
28-
- ./autogen.sh
29-
- make -j4
30-
- make check-valgrind
31-
- make -j4 distcheck
3+
sudo: true
4+
script: tests/run-ubuntu-chroot
5+
env:
6+
- RELEASE=
7+
- RELEASE=artful
8+
- RELEASE=xenial
9+
cache:
10+
directories:
11+
- /tmp/cache

tests/run-ubuntu-chroot

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
echo ${ARCH:=amd64}
5+
6+
if [ -z "${RELEASE:-}" ]; then
7+
# determine latest release, usually devel (see https://launchpad.net/+apidoc)
8+
rel=$(curl --silent https://api.launchpad.net/devel/ubuntu/current_series_link | sed 's/^"//; s/"$//')
9+
RELEASE=${rel##*/}
10+
fi
11+
12+
mkdir -p ${CACHE:=/tmp/cache/$RELEASE}
13+
14+
# get LP chroot
15+
CHROOT_URL=$(curl --silent https://api.launchpad.net/1.0/ubuntu/$RELEASE/$ARCH | grep -o 'http://[^ "]*chroot-ubuntu-[^ "]*')
16+
CHROOT_TAR="$CACHE/$(basename $CHROOT_URL)"
17+
[ -e "$CHROOT_TAR" ] || curl -o "$CHROOT_TAR" "$CHROOT_URL"
18+
19+
# prepare chroot
20+
BUILDDIR=$(mktemp -d)
21+
trap "sudo rm -rf $BUILDDIR" EXIT INT QUIT PIPE
22+
sudo tar -C "$BUILDDIR" -xf "$CHROOT_TAR"
23+
CHROOT="$BUILDDIR/chroot-autobuild"
24+
sudo cp /etc/resolv.conf "$CHROOT/etc/resolv.conf"
25+
26+
# copy code checkout into chroot
27+
sudo cp -a . "$CHROOT/build/src"
28+
29+
sudo chroot "$CHROOT" << EOF
30+
mount -t proc proc /proc
31+
mount -t devtmpfs devtmpfs /dev
32+
mount -t devpts devpts /dev/pts
33+
mount -t sysfs sysfs /sys
34+
trap "umount /proc /dev/pts /dev /sys" EXIT INT QUIT PIPE
35+
set -ex
36+
# install build deps
37+
cat <<EOU > /etc/apt/sources.list
38+
deb http://archive.ubuntu.com/ubuntu ${RELEASE} main universe
39+
deb http://archive.ubuntu.com/ubuntu ${RELEASE}-updates main universe
40+
EOU
41+
apt-get update
42+
apt-get install -y pkg-config dh-autoreconf valac libglib2.0-dev libudev-dev libgudev-1.0-dev python3-gi gobject-introspection libgirepository1.0-dev gir1.2-glib-2.0 gir1.2-gudev-1.0 gtk-doc-tools udev xserver-xorg-video-dummy xserver-xorg-input-evdev xserver-xorg-input-synaptics xinput usbutils gphoto2 valgrind
43+
44+
# run build and tests as user
45+
chown -R buildd:buildd /build
46+
su - buildd <<EOU
47+
set -ex
48+
cd /build/src
49+
./autogen.sh
50+
make -j4
51+
make check-valgrind
52+
make -j4 distcheck
53+
EOU
54+
EOF

0 commit comments

Comments
 (0)