Skip to content

Commit dc597a8

Browse files
committed
Run Ubuntu tests in container
This simplifies them a lot and makes them more consistent with the Alpine/CentOS tests.
1 parent fa7f228 commit dc597a8

File tree

3 files changed

+61
-92
lines changed

3 files changed

+61
-92
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ sudo: true
44
services:
55
- docker
66
env:
7-
- TEST=tests/run-ubuntu-chroot RELEASE=
8-
- TEST=tests/run-ubuntu-chroot RELEASE=bionic
9-
- TEST=tests/run-ubuntu-chroot RELEASE=bionic ARCH=i386
10-
- TEST=tests/run-ubuntu-chroot RELEASE=xenial
7+
- TEST=tests/run-ubuntu RELEASE=devel
8+
- TEST=tests/run-ubuntu RELEASE=rolling
9+
- TEST=tests/run-ubuntu RELEASE=latest
10+
- TEST=tests/run-ubuntu RELEASE=latest ARCH=i386
1111
- TEST=tests/run-alpine RELEASE=latest
1212
- TEST=tests/run-centos RELEASE=7
1313
script: $TEST
@@ -22,4 +22,4 @@ deploy:
2222
skip_cleanup: true
2323
on:
2424
tags: true
25-
condition: -z "$RELEASE"
25+
condition: "$RELEASE = rolling"

tests/run-ubuntu

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
# keep container around if $DEBUG is set
5+
[ -n "${DEBUG:-}" ] || OPTS="--rm"
6+
7+
if type podman >/dev/null 2>&1; then
8+
RUNC=podman
9+
else
10+
RUNC="sudo docker"
11+
fi
12+
13+
$RUNC run --interactive ${OPTS:-} --volume `pwd`:/source ${ARCH:-amd64}/ubuntu:${RELEASE:-rolling} /bin/sh << EOF
14+
set -ex
15+
16+
# go-faster apt
17+
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
18+
19+
# upgrade
20+
export DEBIAN_FRONTEND=noninteractive
21+
apt-get update
22+
apt-get install -y eatmydata
23+
eatmydata apt-get -y --purge dist-upgrade
24+
25+
# install build dependencies
26+
eatmydata apt-get install -y --no-install-recommends pkg-config dh-autoreconf autoconf-archive 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
27+
28+
# run build as user
29+
useradd build
30+
su -s /bin/sh - build << EOG
31+
set -ex
32+
cp -r /source /tmp
33+
cd /tmp/source
34+
./autogen.sh --prefix=/usr
35+
make -j$(nproc)
36+
make check-valgrind
37+
make -j$(nproc) distcheck
38+
EOG
39+
40+
# install and run check-installed
41+
make -C /tmp/source install
42+
ldconfig
43+
su -c 'make -C /tmp/source check-installed' - build
44+
45+
# check build without assertions
46+
su - build <<EOG
47+
set -ex
48+
cd /tmp/source
49+
make distclean
50+
./autogen.sh --prefix=/usr CPPFLAGS=-DNDEBUG
51+
make -j$(nproc) check
52+
EOG
53+
54+
# copy release tarball to outside
55+
cp /tmp/source/umockdev-*.tar.xz /source
56+
EOF

tests/run-ubuntu-chroot

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)