Skip to content

Commit

Permalink
Run Ubuntu tests in container
Browse files Browse the repository at this point in the history
This simplifies them a lot and makes them more consistent with the
Alpine/CentOS tests.
  • Loading branch information
martinpitt committed Aug 28, 2019
1 parent fa7f228 commit dc597a8
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 92 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ sudo: true
services:
- docker
env:
- TEST=tests/run-ubuntu-chroot RELEASE=
- TEST=tests/run-ubuntu-chroot RELEASE=bionic
- TEST=tests/run-ubuntu-chroot RELEASE=bionic ARCH=i386
- TEST=tests/run-ubuntu-chroot RELEASE=xenial
- TEST=tests/run-ubuntu RELEASE=devel
- TEST=tests/run-ubuntu RELEASE=rolling
- TEST=tests/run-ubuntu RELEASE=latest
- TEST=tests/run-ubuntu RELEASE=latest ARCH=i386
- TEST=tests/run-alpine RELEASE=latest
- TEST=tests/run-centos RELEASE=7
script: $TEST
Expand All @@ -22,4 +22,4 @@ deploy:
skip_cleanup: true
on:
tags: true
condition: -z "$RELEASE"
condition: "$RELEASE = rolling"
56 changes: 56 additions & 0 deletions tests/run-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/sh
set -eu

# keep container around if $DEBUG is set
[ -n "${DEBUG:-}" ] || OPTS="--rm"

if type podman >/dev/null 2>&1; then
RUNC=podman
else
RUNC="sudo docker"
fi

$RUNC run --interactive ${OPTS:-} --volume `pwd`:/source ${ARCH:-amd64}/ubuntu:${RELEASE:-rolling} /bin/sh << EOF
set -ex
# go-faster apt
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
# upgrade
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y eatmydata
eatmydata apt-get -y --purge dist-upgrade
# install build dependencies
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
# run build as user
useradd build
su -s /bin/sh - build << EOG
set -ex
cp -r /source /tmp
cd /tmp/source
./autogen.sh --prefix=/usr
make -j$(nproc)
make check-valgrind
make -j$(nproc) distcheck
EOG
# install and run check-installed
make -C /tmp/source install
ldconfig
su -c 'make -C /tmp/source check-installed' - build
# check build without assertions
su - build <<EOG
set -ex
cd /tmp/source
make distclean
./autogen.sh --prefix=/usr CPPFLAGS=-DNDEBUG
make -j$(nproc) check
EOG
# copy release tarball to outside
cp /tmp/source/umockdev-*.tar.xz /source
EOF
87 changes: 0 additions & 87 deletions tests/run-ubuntu-chroot

This file was deleted.

0 comments on commit dc597a8

Please sign in to comment.