Skip to contentSkip to conversation

docker: add installation to build tests

PATCH In review Paolo Bonzini 2 participants 4 messages Sep 22, 2017 – Sep 25, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 docker: add installation to build tests

Basic test that "make install" works; this requires msgfmt so add gettext to the packages.

---
 tests/docker/common.rc                       | 8 ++++++++
 tests/docker/dockerfiles/centos6.docker      | 1 +
 tests/docker/dockerfiles/centos7.docker      | 1 +
 tests/docker/dockerfiles/debian-ports.docker | 1 +
 tests/docker/dockerfiles/debian8.docker      | 1 +
 tests/docker/dockerfiles/debian9.docker      | 1 +
 tests/docker/dockerfiles/fedora.docker       | 2 +-
 tests/docker/dockerfiles/min-glib.docker     | 2 +-
 tests/docker/dockerfiles/ubuntu.docker       | 2 +-
 tests/docker/test-build                      | 1 +
 tests/docker/test-clang                      | 1 +
 tests/docker/test-full                       | 1 +
 tests/docker/test-mingw                      | 1 +
 tests/docker/test-quick                      | 1 +
 14 files changed, 21 insertions(+), 3 deletions(-)
tests/docker/common.rc +8 -0
index 6865689..1522aab 100755
@@ -36,3 +36,11 @@ build_qemu()
     $QEMU_SRC/configure $config_opts
     make $MAKEFLAGS
 }
+
+install_qemu()
+{
+    make install $MAKEFLAGS DESTDIR=$PWD/=destdir
+    ret=$?
+    rm -rf $PWD/=destdir
+    return $ret
+}
tests/docker/dockerfiles/centos6.docker +1 -0
index f6aae13..ad24319 100644
@@ -8,6 +8,7 @@ ENV PACKAGES \
     flex \
     g++ \
     gcc \
+    gettext \
     git \
     glib2-devel \
     libepoxy-devel \
tests/docker/dockerfiles/centos7.docker +1 -0
index 0b59aa2..575de29 100644
@@ -9,6 +9,7 @@ ENV PACKAGES \
     flex \
     g++ \
     gcc \
+    gettext \
     git \
     glib2-devel \
     libepoxy-devel \
tests/docker/dockerfiles/debian-ports.docker +1 -0
index fba224f..e05a9a9 100644
@@ -27,6 +27,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         clang \
         debian-ports-archive-keyring \
         flex \
+        gettext \
         git \
         pkg-config \
         psmisc \
tests/docker/dockerfiles/debian8.docker +1 -0
index 3d09b4b..1bcf2e3 100644
@@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         clang \
         curl \
         flex \
+        gettext \
         git \
         gnupg \
         pkg-config \
tests/docker/dockerfiles/debian9.docker +1 -0
index a450995..154ae2a 100644
@@ -22,6 +22,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
         ca-certificates \
         clang \
         flex \
+        gettext \
         git \
         pkg-config \
         psmisc \
tests/docker/dockerfiles/fedora.docker +1 -1
index 4eaa8ed..700806e 100644
@@ -1,6 +1,6 @@
 FROM fedora:latest
 ENV PACKAGES \
-    ccache git tar PyYAML sparse flex bison python2 bzip2 hostname \
+    ccache gettext git tar PyYAML sparse flex bison python2 bzip2 hostname \
     glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel \
     gcc gcc-c++ clang make perl which bc findutils libaio-devel \
     mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config \
tests/docker/dockerfiles/min-glib.docker +1 -1
index 9f542d5..f2eed97 100644
@@ -1,6 +1,6 @@
 FROM centos:6
 RUN yum install -y \
-    tar git make gcc g++ \
+    tar gettext git make gcc g++ \
     zlib-devel SDL-devel pixman-devel \
     epel-release
 RUN yum install -y libfdt-devel ccache
tests/docker/dockerfiles/ubuntu.docker +1 -1
index a360a05..131668c 100644
@@ -7,7 +7,7 @@ ENV PACKAGES flex bison \
     libseccomp-dev libgnutls-dev libssh2-1-dev  libspice-server-dev \
     libspice-protocol-dev libnss3-dev libfdt-dev \
     libgtk-3-dev libvte-2.90-dev libsdl1.2-dev libpng12-dev libpixman-1-dev \
-    git make ccache python-yaml gcc clang sparse
+    gettext git make ccache python-yaml gcc clang sparse
 RUN apt-get -y install $PACKAGES
 RUN dpkg -l $PACKAGES | sort > /packages.txt
 ENV FEATURES clang pyyaml
tests/docker/test-build +1 -0
index 031a7d9..22766cf 100755
@@ -18,3 +18,4 @@ cd "$BUILD_DIR"
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu
+install_qemu
tests/docker/test-clang +1 -0
index 16485e6..1eb61a3 100755
@@ -24,3 +24,4 @@ OPTS="--enable-debug --cxx=clang++ --cc=clang --host-cc=clang"
     #--extra-cflags=-fno-sanitize=float-divide-by-zero"
 build_qemu $OPTS
 make $MAKEFLAGS check
+install_qemu
tests/docker/test-full +1 -0
index 05f0d49..a0ba90e 100755
@@ -17,3 +17,4 @@ cd "$BUILD_DIR"
 
 build_qemu
 make check $MAKEFLAGS
+install_qemu
tests/docker/test-mingw +1 -0
index 2adadcb..39a1da4 100755
@@ -31,6 +31,7 @@ for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
         --enable-guest-agent \
         --with-sdlabi=1.2 \
         --with-gtkabi=2.0
+    install_qemu
     make clean
 
 done
tests/docker/test-quick +1 -0
index c465dc0..3b7bce6 100755
@@ -19,3 +19,4 @@ DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu
 make check $MAKEFLAGS
+install_qemu
Signature · 1 line
1.8.3.1
#1 lore raw

tests/docker/common.rc build_qemu() · line 42

Quoted 12 lines · Paolo Bonzini
tests/docker/common.rc +4 -0
index 6865689..1522aab 100755
@@ -36,3 +36,11 @@ build_qemu()
     $QEMU_SRC/configure $config_opts
     make $MAKEFLAGS
 }
+
+install_qemu()
+{
+    make install $MAKEFLAGS DESTDIR=$PWD/=destdir

Why provide DESTDIR? build_qemu already has "--prefix=$INSTALL_DIR", can a simple "make install $MAKEFLAGS" work? Is there a permission problem?

tests/docker/common.rc build_qemu() · line 44

Quoted 2 lines
tests/docker/common.rc +2 -0
+    ret=$?
+    rm -rf $PWD/=destdir

Why is this cleanup needed given the container will go away anyway?

Fam

#2 lore raw
Quoted 16 lines · Fam Zheng

tests/docker/common.rc build_qemu() · line 42

Quoted 12 lines · Paolo Bonzini
tests/docker/common.rc +4 -0
index 6865689..1522aab 100755
@@ -36,3 +36,11 @@ build_qemu()
     $QEMU_SRC/configure $config_opts
     make $MAKEFLAGS
 }
+
+install_qemu()
+{
+    make install $MAKEFLAGS DESTDIR=$PWD/=destdir

Why provide DESTDIR? build_qemu already has "--prefix=$INSTALL_DIR", can a simple "make install $MAKEFLAGS" work? Is there a permission problem?

Just to test the $DESTDIR case. I have plans to extend the test a bit further, such as:

- checking that $INSTALL_DIR remains empty

- comparing the destdir installation against the $INSTALL_DIR (to ensure that the destdir doesn't end up in the installed files; distro packaging conventions usually don't like that).

- doing the DESTDIR install as a non-root user

Quoted 4 lines

tests/docker/common.rc build_qemu() · line 44

Quoted 2 lines
tests/docker/common.rc +2 -0
+    ret=$?
+    rm -rf $PWD/=destdir

Why is this cleanup needed given the container will go away anyway?

Again it's just for cleanliness. Another possible test to add is that "make distclean" actually leaves the build tree in a pristine state, and this would fail if we leave the installation tree around.

All these tests, by the way, are inspired by the "make distcheck" produced by Automake.

Paolo

#3 lore raw
Quoted 32 lines · Paolo Bonzini
Quoted 16 lines · Fam Zheng

tests/docker/common.rc build_qemu() · line 42

Quoted 12 lines · Paolo Bonzini
tests/docker/common.rc +4 -0
index 6865689..1522aab 100755
@@ -36,3 +36,11 @@ build_qemu()
     $QEMU_SRC/configure $config_opts
     make $MAKEFLAGS
 }
+
+install_qemu()
+{
+    make install $MAKEFLAGS DESTDIR=$PWD/=destdir

Why provide DESTDIR? build_qemu already has "--prefix=$INSTALL_DIR", can a simple "make install $MAKEFLAGS" work? Is there a permission problem?

Just to test the $DESTDIR case. I have plans to extend the test a bit further, such as:

- checking that $INSTALL_DIR remains empty

- comparing the destdir installation against the $INSTALL_DIR (to ensure that the destdir doesn't end up in the installed files; distro packaging conventions usually don't like that).

- doing the DESTDIR install as a non-root user

Quoted 3 lines
Quoted 2 lines
tests/docker/common.rc +2 -0
+    ret=$?
+    rm -rf $PWD/=destdir
Quoted 8 lines
Quoted 1 line

Why is this cleanup needed given the container will go away anyway?

Again it's just for cleanliness. Another possible test to add is that "make distclean" actually leaves the build tree in a pristine state, and this would fail if we leave the installation tree around.

All these tests, by the way, are inspired by the "make distcheck" produced by Automake.

Yeah, this is fine. We can add pure "make install" in addition. I'll queue this patch. Thanks.

Fam