Skip to contentSkip to conversation

various docker fixes

PATCH Superseded Alex Bennée 3 participants 27 messages Jul 9, 2018 – Jul 12, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover various docker fixes

Hi,

The addition of the cross compilers for check-tcg broke the ability to run "make docker-test". In truth this was probably already broken as it attempts to run every single test with every single docker image which isn't something that gets done on a regular basis.

Anyway the patches clean up the ability to do that in a sane way although it still takes a long time to run the full test set.

To help with running a better subset I've expanded the individual tests so you can now run a line like:

make docker-test-build TARGET_LIST=aarch64-softmmu J=30

To make sure your favourite architecture still builds everywhere.

There is now also a docker-test-unit which just runs the unit tests although we have to do a little re-factoring to make sure we don't attempt to run "make check" steps when the docker image isn't capable of it. This is also needed to make sure the other test-FOO build tests don't choke on the check step.

Finally there is a minor tweak for .gitignore and a fix for docker.py throwing backtraces when we attempt to calculate SID_AGE. A cleaner re-factoring can be left for a future release.

Alex Bennée (10):
tests/.gitignore: don't ignore docker tests
docker: debian-tricore add git tools
docker: fail more gracefully on docker.py check
docker: split configure_qemu from build_qemu
docker: move make check into check_qemu helper
docker: gracefully skip check_qemu
docker: Makefile.include don't include partial images
docker: disable debian-powerpc-user-cross
docker: add test-unit runner
docker: add expansion for docker-test-FOO to Makefile.include

 tests/.gitignore                              |  1 +
 tests/docker/Makefile.include                 | 14 +++++++++--
 tests/docker/common.rc                        | 23 ++++++++++++++++++-
 tests/docker/docker.py                        |  7 +++++-
 .../dockerfiles/debian-tricore-cross.docker   |  3 +++
 tests/docker/test-clang                       |  2 +-
 tests/docker/test-debug                       |  2 +-
 tests/docker/test-full                        |  2 +-
 tests/docker/test-quick                       |  2 +-
 tests/docker/test-unit                        | 19 +++++++++++++++
 10 files changed, 67 insertions(+), 8 deletions(-)
 create mode 100755 tests/docker/test-unit
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/10 tests/.gitignore: don't ignore docker tests

This was being a little over enthusiastic hiding files.

---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tests/.gitignore +1 -0
index 08e2df1ce1..72c18aaab0 100644
@@ -9,6 +9,7 @@ qht-bench
 rcutorture
 test-*
 !test-*.c
+!docker/test-*
 test-qapi-commands.[ch]
 test-qapi-events.[ch]
 test-qapi-types.[ch]
Signature · 1 line
2.17.1
#2 lore raw

Re: [Qemu-devel] [PATCH for 3.0 01/10] tests/.gitignore: don't ignore docker tests

Quoted 1 line · Alex Bennée

This was being a little over enthusiastic hiding files.

What is "this" that hides test-* and calls for this patch?

Quoted 21 lines
---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tests/.gitignore +1 -0
index 08e2df1ce1..72c18aaab0 100644
@@ -9,6 +9,7 @@ qht-bench
 rcutorture
 test-*
 !test-*.c
+!docker/test-*
 test-qapi-commands.[ch]
 test-qapi-events.[ch]
 test-qapi-types.[ch]
Signature · 1 line
2.17.1
#3 lore raw

Re: [Qemu-devel] [PATCH for 3.0 01/10] tests/.gitignore: don't ignore docker tests

Quoted 4 lines · Fam Zheng
Quoted 1 line · Alex Bennée

This was being a little over enthusiastic hiding files.

What is "this" that hides test-* and calls for this patch?

I thought that was implicit from the first line, this is the .gitignore.

Quoted 7 lines
Quoted 7 lines
---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 13 lines
tests/.gitignore +1 -1
index 08e2df1ce1..72c18aaab0 100644
@@ -9,6 +9,7 @@ qht-bench
 rcutorture
 test-*
 !test-*.c
+!docker/test-*
 test-qapi-commands.[ch]
 test-qapi-events.[ch]
 test-qapi-types.[ch]
--
Quoted 2 lines

2.17.1

--
Alex Bennée

#4 lore raw

Re: [Qemu-devel] [PATCH for 3.0 01/10] tests/.gitignore: don't ignore docker tests

Quoted 9 lines · Alex Bennée
Quoted 4 lines · Fam Zheng
Quoted 1 line · Alex Bennée

This was being a little over enthusiastic hiding files.

What is "this" that hides test-* and calls for this patch?

I thought that was implicit from the first line, this is the .gitignore.

Indeed you're right. Maybe that line should be more specific, but I have no strong opinion.

Fam

Quoted 27 lines
Quoted 8 lines
Quoted 8 lines
---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 13 lines
tests/.gitignore +1 -1
index 08e2df1ce1..72c18aaab0 100644
@@ -9,6 +9,7 @@ qht-bench
 rcutorture
 test-*
 !test-*.c
+!docker/test-*
 test-qapi-commands.[ch]
 test-qapi-events.[ch]
 test-qapi-types.[ch]
--
Quoted 2 lines

2.17.1

--
Alex Bennée

Reviewed-by on v1 1/10
#5 lore raw

Re: [Qemu-devel] [PATCH for 3.0 01/10] tests/.gitignore: don't ignore docker tests

In reply to Alex Bennée
Quoted 3 lines · Alex Bennée

This was being a little over enthusiastic hiding files.

Quoted 17 lines
---
 tests/.gitignore | 1 +
 1 file changed, 1 insertion(+)
tests/.gitignore +1 -0
index 08e2df1ce1..72c18aaab0 100644
@@ -9,6 +9,7 @@ qht-bench
 rcutorture
 test-*
 !test-*.c
+!docker/test-*
 test-qapi-commands.[ch]
 test-qapi-events.[ch]
 test-qapi-types.[ch]
#6 lore raw

PATCH 2/10 docker: debian-tricore add git tools

In reply to Alex Bennée

As we check out we need git installed before we start. We would have had this based on the heavier qemu:debian9 image but we only use plain debian:9 here.

---
 tests/docker/dockerfiles/debian-tricore-cross.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/debian-tricore-cross.docker +3 -0
index 898b8dd511..5ba3ca88a7 100644
@@ -11,6 +11,9 @@ FROM debian:9
 
 MAINTAINER Philippe Mathieu-Daudé <[email protected]>
 
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -yy git
+
 RUN git clone --single-branch \
         https://github.com/bkoppelmann/tricore-binutils.git \
         /usr/src/binutils && \
Signature · 1 line
2.17.1
#7 lore raw

Re: [Qemu-devel] [PATCH for 3.0 02/10] docker: debian-tricore add git tools

Quoted 3 lines · Alex Bennée

As we check out we need git installed before we start. We would have had this based on the heavier qemu:debian9 image but we only use plain debian:9 here.

I first thought "weird, I checked this already" then noticed you rebased on debian:9.
'stretch-slim' is an alias for '9-slim' and should be tinier (the previous RFC image is 323MB).

Quoted 19 lines
 tests/docker/dockerfiles/debian-tricore-cross.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/debian-tricore-cross.docker +3 -0
index 898b8dd511..5ba3ca88a7 100644
@@ -11,6 +11,9 @@ FROM debian:9
 
 MAINTAINER Philippe Mathieu-Daudé <[email protected]>
 
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -yy git
+
 RUN git clone --single-branch \
         https://github.com/bkoppelmann/tricore-binutils.git \
         /usr/src/binutils && \
#8 lore raw

Re: [Qemu-devel] [PATCH for 3.0 02/10] docker: debian-tricore add git tools

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Alex Bennée

As we check out we need git installed before we start. We would have had this based on the heavier qemu:debian9 image but we only use plain debian:9 here.

I first thought "weird, I checked this already" then noticed you rebased on debian:9.
'stretch-slim' is an alias for '9-slim' and should be tinier (the previous RFC image is 323MB).

Quoted 12 lines
 tests/docker/dockerfiles/debian-tricore-cross.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/debian-tricore-cross.docker +0 -0
index 898b8dd511..5ba3ca88a7 100644
@@ -11,6 +11,9 @@ FROM debian:9
 
 MAINTAINER Philippe Mathieu-Daudé <[email protected]>
 
Quoted 7 lines

tests/docker/dockerfiles/debian-tricore-cross.docker FROM debian:9 · line 19

Quoted 7 lines
tests/docker/dockerfiles/debian-tricore-cross.docker +3 -0
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -yy git
+
 RUN git clone --single-branch \
         https://github.com/bkoppelmann/tricore-binutils.git \
         /usr/src/binutils && \

Apparently this is not enough:

---> Running in a044a41d4521
Cloning into '/usr/src/binutils'...
Configuring for a x86_64-unknown-linux-gnu host.
Created "Makefile" in /usr/src/binutils
./configure: 8: /tmp/cNf15/cNf15.pos: cc: not found
*** The command 'cc -o conftest -w conftest.c' failed.
*** You must set the environment variable CC to a working compiler. subprocess.CalledProcessError: Command '['docker', 'build', '-t', 'qemu:debian-tricore-cross', '-f', '/tmp/docker_build10CkqB/tmpEx12gW.docker', '/tmp/docker_build10CkqB']' returned non-zero exit status 1
make: *** [docker-image-debian-tricore-cross] Error 1

#9 lore raw

Re: [Qemu-devel] [PATCH for 3.0 02/10] docker: debian-tricore add git tools

In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Alex Bennée

As we check out we need git installed before we start. We would have had this based on the heavier qemu:debian9 image but we only use plain debian:9 here.

I first thought "weird, I checked this already" then noticed you rebased on debian:9.
'stretch-slim' is an alias for '9-slim' and should be tinier (the previous RFC image is 323MB).

Hmm why not just switch to qemu:debian9 as we need the compiler as well? It's not like there will be many users only carrying this image in their docker setup.

Quoted 13 lines
Quoted 13 lines
 tests/docker/dockerfiles/debian-tricore-cross.docker | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/dockerfiles/debian-tricore-cross.docker +0 -0
index 898b8dd511..5ba3ca88a7 100644
@@ -11,6 +11,9 @@ FROM debian:9
 
 MAINTAINER Philippe Mathieu-Daudé <[email protected]>
 
Quoted 7 lines

tests/docker/dockerfiles/debian-tricore-cross.docker FROM debian:9 · line 19

Quoted 7 lines
tests/docker/dockerfiles/debian-tricore-cross.docker +3 -0
+RUN apt-get update && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -yy git
+
 RUN git clone --single-branch \
         https://github.com/bkoppelmann/tricore-binutils.git \
         /usr/src/binutils && \

--
Alex Bennée

#10 lore raw

PATCH 3/10 docker: fail more gracefully on docker.py check

In reply to Alex Bennée

As this is called directly from the Makefile while determining dependencies and it is possible the user was configured in one window but not have credentials in the other. Let's catch the Exceptions and deal with it quietly.

---
 tests/docker/docker.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/docker/docker.py +6 -1
index 69e7130db7..2f81c6b13b 100755
@@ -479,7 +479,12 @@ class CheckCommand(SubCommand):
     def run(self, args, argv):
         tag = args.tag
 
-        dkr = Docker()
+        try:
+            dkr = Docker()
+        except:
+            print("Docker not set up")
+            return 1
+
         info = dkr.inspect_tag(tag)
         if info is None:
             print("Image does not exist")
Signature · 1 line
2.17.1
Reviewed-by on v1 3/10
#11 lore raw

Re: [Qemu-devel] [PATCH for 3.0 03/10] docker: fail more gracefully on docker.py check

Quoted 7 lines · Alex Bennée

As this is called directly from the Makefile while determining dependencies and it is possible the user was configured in one window but not have credentials in the other. Let's catch the Exceptions and deal with it quietly.

Quoted 23 lines
---
 tests/docker/docker.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/docker/docker.py +6 -1
index 69e7130db7..2f81c6b13b 100755
@@ -479,7 +479,12 @@ class CheckCommand(SubCommand):
     def run(self, args, argv):
         tag = args.tag
 
-        dkr = Docker()
+        try:
+            dkr = Docker()
+        except:
+            print("Docker not set up")
+            return 1
+
         info = dkr.inspect_tag(tag)
         if info is None:
             print("Image does not exist")
#12 lore raw

PATCH 4/10 docker: split configure_qemu from build_qemu

In reply to Alex Bennée

This allows some tests that just want to configure QEMU's source tree to do so.

---
 tests/docker/common.rc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/docker/common.rc +6 -1
index 046f8a5921..ba1f942328 100755
@@ -21,7 +21,7 @@ requires()
     done
 }
 
-build_qemu()
+configure_qemu()
 {
     config_opts="--enable-werror \
                  ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
@@ -32,6 +32,11 @@ build_qemu()
     echo $config_opts
     $QEMU_SRC/configure $config_opts || \
         { cat config.log && test_fail "Failed to run 'configure'"; }
+}
+
+build_qemu()
+{
+    configure_qemu $@
     make $MAKEFLAGS
 }
 
Signature · 1 line
2.17.1
#13 lore raw

PATCH 5/10 docker: move make check into check_qemu helper

In reply to Alex Bennée

Not all docker images can run the check step. Let's everything into a common helper so we don't need to replicate checks in the future.

---
 tests/docker/common.rc  | 10 ++++++++++
 tests/docker/test-clang |  2 +-
 tests/docker/test-debug |  2 +-
 tests/docker/test-full  |  2 +-
 tests/docker/test-quick |  2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)
tests/docker/common.rc +10 -0
index ba1f942328..cfc620d554 100755
@@ -40,6 +40,16 @@ build_qemu()
     make $MAKEFLAGS
 }
 
+check_qemu()
+{
+    if test -z "$@"; then
+        TEST="check"
+    else
+        TEST="$@"
+    fi
+    make $MAKEFLAGS $TEST
+}
+
 test_fail()
 {
     echo "$@"
tests/docker/test-clang +1 -1
index e90a793178..324e341cea 100755
@@ -23,5 +23,5 @@ OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
 #OPTS="$OPTS --extra-cflags=-fsanitize=undefined \
     #--extra-cflags=-fno-sanitize=float-divide-by-zero"
 build_qemu $OPTS
-make $MAKEFLAGS check
+check_qemu
 install_qemu
tests/docker/test-debug +1 -1
index d3f9f70d01..137f4f2ddc 100755
@@ -22,5 +22,5 @@ OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
 OPTS="--enable-debug --enable-sanitizers $OPTS"
 
 build_qemu $OPTS
-make $MAKEFLAGS V=1 check
+check_qemu check V=1
 install_qemu
tests/docker/test-full +1 -1
index b4e42d25d7..aadc0f00a2 100755
@@ -15,4 +15,4 @@
 
 cd "$BUILD_DIR"
 
-build_qemu && make check $MAKEFLAGS && install_qemu
+build_qemu && check_qemu && install_qemu
tests/docker/test-quick +1 -1
index 3b7bce6105..eee59c55fb 100755
@@ -18,5 +18,5 @@ cd "$BUILD_DIR"
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu
-make check $MAKEFLAGS
+check_qemu
 install_qemu
Signature · 1 line
2.17.1
#14 lore raw

Re: [Qemu-devel] [PATCH for 3.0 05/10] docker: move make check into check_qemu helper

Quoted 1 line · Alex Bennée

Not all docker images can run the check step. Let's everything into a

"move everything"?

Quoted 78 lines

common helper so we don't need to replicate checks in the future.

---
 tests/docker/common.rc  | 10 ++++++++++
 tests/docker/test-clang |  2 +-
 tests/docker/test-debug |  2 +-
 tests/docker/test-full  |  2 +-
 tests/docker/test-quick |  2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)
tests/docker/common.rc +10 -0
index ba1f942328..cfc620d554 100755
@@ -40,6 +40,16 @@ build_qemu()
     make $MAKEFLAGS
 }
 
+check_qemu()
+{
+    if test -z "$@"; then
+        TEST="check"
+    else
+        TEST="$@"
+    fi
+    make $MAKEFLAGS $TEST
+}
+
 test_fail()
 {
     echo "$@"
tests/docker/test-clang +1 -1
index e90a793178..324e341cea 100755
@@ -23,5 +23,5 @@ OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
 #OPTS="$OPTS --extra-cflags=-fsanitize=undefined \
     #--extra-cflags=-fno-sanitize=float-divide-by-zero"
 build_qemu $OPTS
-make $MAKEFLAGS check
+check_qemu
 install_qemu
tests/docker/test-debug +1 -1
index d3f9f70d01..137f4f2ddc 100755
@@ -22,5 +22,5 @@ OPTS="--cxx=clang++ --cc=clang --host-cc=clang"
 OPTS="--enable-debug --enable-sanitizers $OPTS"
 
 build_qemu $OPTS
-make $MAKEFLAGS V=1 check
+check_qemu check V=1
 install_qemu
tests/docker/test-full +1 -1
index b4e42d25d7..aadc0f00a2 100755
@@ -15,4 +15,4 @@
 
 cd "$BUILD_DIR"
 
-build_qemu && make check $MAKEFLAGS && install_qemu
+build_qemu && check_qemu && install_qemu
tests/docker/test-quick +1 -1
index 3b7bce6105..eee59c55fb 100755
@@ -18,5 +18,5 @@ cd "$BUILD_DIR"
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu
-make check $MAKEFLAGS
+check_qemu
 install_qemu
Signature · 1 line
2.17.1
#15 lore raw

PATCH 6/10 docker: gracefully skip check_qemu

In reply to Alex Bennée

Not all our images are able to run the tests. Rather than use features we can just check for the existence and run-ability of gtester. If the image has been setup for binfmt_misc it will be able to run anyway.

---
 tests/docker/common.rc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/docker/common.rc +7 -1
index cfc620d554..6df431eb72 100755
@@ -47,7 +47,13 @@ check_qemu()
     else
         TEST="$@"
     fi
-    make $MAKEFLAGS $TEST
+
+    if type gtester > /dev/null 2>&1 && \
+           gtester --version > /dev/null 2>&1; then
+        make $MAKEFLAGS $TEST
+    else
+        echo "No working gtester, skipping make $TEST"
+    fi
 }
 
 test_fail()
Signature · 1 line
2.17.1
#16 lore raw

PATCH 7/10 docker: Makefile.include don't include partial images

In reply to Alex Bennée

Rename DOCKER_INTERMEDIATE_IMAGES to DOCKER_PARTIAL_IMAGES and add the incomplete cross compiler images that can build tests but can't build QEMU itself. We also add debian, debian-bootstrap and the tricode images to the list.

---
 tests/docker/Makefile.include | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +7 -2
index b2a7e761cc..09fb7db7fa 100644
@@ -6,7 +6,7 @@ DOCKER_SUFFIX := .docker
 DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
 DOCKER_DEPRECATED_IMAGES := debian
 # we don't run tests on intermediate images (used as base by another image)
-DOCKER_INTERMEDIATE_IMAGES := debian8 debian9 debian8-mxe debian-ports debian-sid
+DOCKER_PARTIAL_IMAGES := debian debian8 debian9 debian8-mxe debian-ports debian-sid debian-bootstrap
 DOCKER_IMAGES := $(filter-out $(DOCKER_DEPRECATED_IMAGES),$(sort $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker)))))
 DOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
 # Use a global constant ccache directory to speed up repetitive builds
@@ -121,6 +121,11 @@ docker-image-travis: NOUSER=1
 # Specialist build images, sometimes very limited tools
 docker-image-tricore-cross: docker-image-debian9
 
+# These images may be good enough for building tests but not for test builds
+DOCKER_PARTIAL_IMAGES += debian-alpha-cross debian-hppa-cross debian-m68k-cross debian-sh4-cross
+DOCKER_PARTIAL_IMAGES += debian-sparc64-cross debian-mips64-cross debian-riscv64-cross
+DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross fedora-i386-cross
+
 # Rules for building linux-user powered images
 #
 # These are slower than using native cross compiler setups but can
@@ -137,7 +142,7 @@ docker-image-debian-powerpc-user-cross: docker-binfmt-image-debian-powerpc-user
 DOCKER_USER_IMAGES += debian-powerpc-user
 
 # Expand all the pre-requistes for each docker image and test combination
-$(foreach i,$(filter-out $(DOCKER_INTERMEDIATE_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPRECATED_IMAGES)), \
+$(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPRECATED_IMAGES)), \
 	$(foreach t,$(DOCKER_TESTS) $(DOCKER_TOOLS), \
 		$(eval .PHONY: docker-$t@$i) \
 		$(eval docker-$t@$i: docker-image-$i docker-run-$t@$i) \
Signature · 1 line
2.17.1
#17 lore raw

PATCH 8/10 docker: disable debian-powerpc-user-cross

In reply to Alex Bennée

While we can build we can't run the unit tests due to a missing system call (249 - swapcontext). This could be a code generation issue as other architectures don't seem to have this system call.

---
 tests/docker/Makefile.include | 3 +++
 1 file changed, 3 insertions(+)
tests/docker/Makefile.include +3 -0
index 09fb7db7fa..fe63aacf69 100644
@@ -140,6 +140,9 @@ docker-binfmt-image-debian-powerpc-user: QEMU_TARGET = ppc-linux-user
 docker-binfmt-image-debian-powerpc-user: EXECUTABLE = ${BUILD_DIR}/ppc-linux-user/qemu-ppc
 docker-image-debian-powerpc-user-cross: docker-binfmt-image-debian-powerpc-user
 DOCKER_USER_IMAGES += debian-powerpc-user
+# Unfortunalty while we can build with this image we can't run unit
+# tests due to missing system call: 249 which causes an abort
+DOCKER_PARTIAL_IMAGES += debian-powerpc-user-cross
 
 # Expand all the pre-requistes for each docker image and test combination
 $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPRECATED_IMAGES)), \
Signature · 1 line
2.17.1
#18 lore raw

PATCH 9/10 docker: add test-unit runner

In reply to Alex Bennée

This test doesn't even build QEMU, it just runs all the unit tests. Intended to make checking unit tests on all docker images easier.

---
 tests/docker/test-unit | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 tests/docker/test-unit
tests/docker/test-unit new file +19 -0
new file mode 100755
index 0000000000..be0d90d748
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Build and run the unit tests
+#
+# Copyright (c) 2018 Linaro Ltd.
+#
+# Authors:
+#  Alex Bennée <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+configure_qemu
+check_qemu check-unit
Signature · 1 line
2.17.1
#19 lore raw

Re: [Qemu-devel] [PATCH for 3.0 09/10] docker: add test-unit runner

Quoted 23 lines · Alex Bennée

This test doesn't even build QEMU, it just runs all the unit tests. Intended to make checking unit tests on all docker images easier.

---
 tests/docker/test-unit | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 tests/docker/test-unit
tests/docker/test-unit new file +8 -0
new file mode 100755
index 0000000000..be0d90d748
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Build and run the unit tests
+#
+# Copyright (c) 2018 Linaro Ltd.
+#
+# Authors:
+#  Alex Bennée <[email protected]>

tests/docker/test-unit line 18

Quoted 10 lines
tests/docker/test-unit new file +10 -0
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+configure_qemu

This reads a bit unusual and counter-intuitive: how could configure_qemu succeed when the env cannot actually build it? Does configure_qemu fail but the side effects needed to run build and run unit tests are done anyway? Either way, please add a comment explaining what is happening here.

Also, should we test the exit code of configure_qemu?

Quoted 4 lines
tests/docker/test-unit new file +1 -0
+check_qemu check-unit
Signature · 1 line
2.17.1
#20 lore raw

Re: [Qemu-devel] [PATCH for 3.0 09/10] docker: add test-unit runner

Quoted 31 lines · Fam Zheng
Quoted 30 lines · Alex Bennée

This test doesn't even build QEMU, it just runs all the unit tests. Intended to make checking unit tests on all docker images easier.

---
 tests/docker/test-unit | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 tests/docker/test-unit
tests/docker/test-unit new file +15 -0
new file mode 100755
index 0000000000..be0d90d748
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Build and run the unit tests
+#
+# Copyright (c) 2018 Linaro Ltd.
+#
+# Authors:
+#  Alex Bennée <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
Quoted 8 lines

tests/docker/test-unit line 18

Quoted 3 lines
tests/docker/test-unit new file +3 -0
+cd "$BUILD_DIR"
+
+configure_qemu

This reads a bit unusual and counter-intuitive: how could configure_qemu succeed when the env cannot actually build it? Does configure_qemu fail but the side effects needed to run build and run unit tests are done anyway? Either way, please add a comment explaining what is happening here.

Although we are not building QEMU itself we still need a configured build environment as we build sub-modules of QEMU to bind into the unit tests. I'll add a comment.

Quoted 2 lines

Also, should we test the exit code of configure_qemu?

Or maybe just make the script -e?

Quoted 5 lines
Quoted 5 lines
tests/docker/test-unit new file +1 -1
+check_qemu check-unit
--

2.17.1

--
Alex Bennée

#21 lore raw

PATCH 10/10 docker: add expansion for docker-test-FOO to Makefile.include

In reply to Alex Bennée

This allows us to run a particular test on all docker images. For example:

make docker-test-unit

Will run the unit tests on every supported image.

---
 tests/docker/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/Makefile.include +2 -0
index fe63aacf69..765b2c36f2 100644
@@ -152,6 +152,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR
 	) \
 	$(foreach t,$(DOCKER_TESTS), \
 		$(eval docker-test: docker-$t@$i) \
+		$(eval docker-$t: docker-$t@$i) \
 	) \
 )
 
@@ -162,6 +163,7 @@ docker:
 	@echo
 	@echo '    docker:              Print this help.'
 	@echo '    docker-test:         Run all image/test combinations.'
+	@echo '    docker-TEST:         Run TEST on all image combinations.'
 	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
 	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
 	@echo '                         Note: "TEST" is one of the listed test name,'
Signature · 1 line
2.17.1
#22 lore raw

Re: [Qemu-devel] [PATCH for 3.0 10/10] docker: add expansion for docker-test-FOO to Makefile.include

Quoted 25 lines · Alex Bennée

This allows us to run a particular test on all docker images. For example:

make docker-test-unit

Will run the unit tests on every supported image.

---
 tests/docker/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/Makefile.include +1 -0
index fe63aacf69..765b2c36f2 100644
@@ -152,6 +152,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR
 	) \
 	$(foreach t,$(DOCKER_TESTS), \
 		$(eval docker-test: docker-$t@$i) \
+		$(eval docker-$t: docker-$t@$i) \
 	) \
 )
 

tests/docker/Makefile.include docker: · line 165

Quoted 3 lines
tests/docker/Makefile.include +0 -0
@@ -162,6 +163,7 @@ docker:
 	@echo
 	@echo '    docker:              Print this help.'
 	@echo '    docker-test:         Run all image/test combinations.'

Can we rename "docker-test" -> "docker-tests" or is it too late?

Quoted 5 lines
tests/docker/Makefile.include +1 -0
+	@echo '    docker-TEST:         Run TEST on all image combinations.'
 	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
 	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
 	@echo '                         Note: "TEST" is one of the listed test name,'
#23 lore raw

Re: [Qemu-devel] [PATCH for 3.0 10/10] docker: add expansion for docker-test-FOO to Makefile.include

Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Alex Bennée

This allows us to run a particular test on all docker images. For example:

make docker-test-unit

Will run the unit tests on every supported image.

---
 tests/docker/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/Makefile.include +1 -0
index fe63aacf69..765b2c36f2 100644
@@ -152,6 +152,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR
 	) \
 	$(foreach t,$(DOCKER_TESTS), \
 		$(eval docker-test: docker-$t@$i) \
+		$(eval docker-$t: docker-$t@$i) \
 	) \
 )
 
Quoted 6 lines

tests/docker/Makefile.include docker: · line 165

Quoted 4 lines
tests/docker/Makefile.include +0 -0
@@ -162,6 +163,7 @@ docker:
 	@echo
 	@echo '    docker:              Print this help.'
 	@echo '    docker-test:         Run all image/test combinations.'

Can we rename "docker-test" -> "docker-tests" or is it too late?

Probably, I don't know how many people were actively using it. Fam?

Quoted 6 lines

tests/docker/Makefile.include docker: · line 169

Quoted 6 lines
tests/docker/Makefile.include +1 -0
+	@echo '    docker-TEST:         Run TEST on all image combinations.'
 	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
 	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
 	@echo '                         Note: "TEST" is one of the listed test name,'

--
Alex Bennée

#24 lore raw

Re: [Qemu-devel] [PATCH for 3.0 10/10] docker: add expansion for docker-test-FOO to Makefile.include

Quoted 28 lines · Alex Bennée
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Alex Bennée

This allows us to run a particular test on all docker images. For example:

make docker-test-unit

Will run the unit tests on every supported image.

---
 tests/docker/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/Makefile.include +1 -0
index fe63aacf69..765b2c36f2 100644
@@ -152,6 +152,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR
 	) \
 	$(foreach t,$(DOCKER_TESTS), \
 		$(eval docker-test: docker-$t@$i) \
+		$(eval docker-$t: docker-$t@$i) \
 	) \
 )
 
Quoted 8 lines
Quoted 6 lines

tests/docker/Makefile.include docker: · line 165

Quoted 4 lines
tests/docker/Makefile.include +0 -0
@@ -162,6 +163,7 @@ docker:
 	@echo
 	@echo '    docker:              Print this help.'
 	@echo '    docker-test:         Run all image/test combinations.'

Can we rename "docker-test" -> "docker-tests" or is it too late?

Probably, I don't know how many people were actively using it. Fam?

I don't know either. Maybe because I'm not native English speaker, but why bother? "Docker test" sounds like a generic "cover all" test, whereas "docker tests" sounds like a set of many independent tests based on Docker. Both make sense to me, though I agree the latter describes it better.

On the other hand, maybe we should create a selection instead of "all combinations" and call it docker-test, to make it a bit more useful. Then we can rename the current docker-test to "docker-all" or "docker-test-all".

Fam

Quoted 11 lines
Quoted 7 lines

tests/docker/Makefile.include docker: · line 169

Quoted 7 lines
tests/docker/Makefile.include +1 -0
+	@echo '    docker-TEST:         Run TEST on all image combinations.'
 	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
 	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
 	@echo '                         Note: "TEST" is one of the listed test name,'

--
Alex Bennée

#25 lore raw

Re: [Qemu-devel] [PATCH for 3.0 10/10] docker: add expansion for docker-test-FOO to Makefile.include

Quoted 38 lines · Fam Zheng
Quoted 28 lines · Alex Bennée
Quoted 25 lines · Philippe Mathieu-Daudé
Quoted 24 lines · Alex Bennée

This allows us to run a particular test on all docker images. For example:

make docker-test-unit

Will run the unit tests on every supported image.

---
 tests/docker/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)
tests/docker/Makefile.include +1 -0
index fe63aacf69..765b2c36f2 100644
@@ -152,6 +152,7 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR
 	) \
 	$(foreach t,$(DOCKER_TESTS), \
 		$(eval docker-test: docker-$t@$i) \
+		$(eval docker-$t: docker-$t@$i) \
 	) \
 )
 
Quoted 8 lines
Quoted 6 lines

tests/docker/Makefile.include docker: · line 165

Quoted 4 lines
tests/docker/Makefile.include +0 -0
@@ -162,6 +163,7 @@ docker:
 	@echo
 	@echo '    docker:              Print this help.'
 	@echo '    docker-test:         Run all image/test combinations.'

Can we rename "docker-test" -> "docker-tests" or is it too late?

Probably, I don't know how many people were actively using it. Fam?

Quoted 7 lines

I don't know either. Maybe because I'm not native English speaker, but why bother? "Docker test" sounds like a generic "cover all" test, whereas "docker tests" sounds like a set of many independent tests based on Docker. Both make sense to me, though I agree the latter describes it better.

On the other hand, maybe we should create a selection instead of "all combinations" and call it docker-test, to make it a bit more useful.

Well allowing the individual docket-test-FOO expansion is a halfway house to that.

Quoted 2 lines

Then we can
rename the current docker-test to "docker-all" or "docker-test-all".

docker-all-tests might be better in case we ever create and test-all test script...

Quoted 14 lines

Fam

Quoted 11 lines
Quoted 7 lines

tests/docker/Makefile.include docker: · line 169

Quoted 7 lines
tests/docker/Makefile.include +1 -0
+	@echo '    docker-TEST:         Run TEST on all image combinations.'
 	@echo '    docker-clean:        Kill and remove residual docker testing containers.'
 	@echo '    docker-TEST@IMAGE:   Run "TEST" in container "IMAGE".'
 	@echo '                         Note: "TEST" is one of the listed test name,'

--
Alex Bennée

--
Alex Bennée

#26 lore raw
In reply to Alex Bennée
Quoted 23 lines · Alex Bennée

Hi,

The addition of the cross compilers for check-tcg broke the ability to run "make docker-test". In truth this was probably already broken as it attempts to run every single test with every single docker image which isn't something that gets done on a regular basis.

Anyway the patches clean up the ability to do that in a sane way although it still takes a long time to run the full test set.

To help with running a better subset I've expanded the individual tests so you can now run a line like:

make docker-test-build TARGET_LIST=aarch64-softmmu J=30

To make sure your favourite architecture still builds everywhere.

There is now also a docker-test-unit which just runs the unit tests although we have to do a little re-factoring to make sure we don't attempt to run "make check" steps when the docker image isn't capable of it. This is also needed to make sure the other test-FOO build tests don't choke on the check step.

Quoted 3 lines

Finally there is a minor tweak for .gitignore and a fix for docker.py throwing backtraces when we attempt to calculate SID_AGE. A cleaner re-factoring can be left for a future release.

Thanks for the clean ups!

Looks good in general. The only thing I notice is the test-unit script.

Fam