docker fixes (and one tcg test tweak)
PATCH v3 1/18 tests/.gitignore: don't ignore docker tests
In reply to Alex BennéeThe .gitignore was being a little over enthusiastic hiding files.
---
v2
- minor wording tweak for more explicitness
--- tests/.gitignore | 1 + 1 file changed, 1 insertion(+)
tests/.gitignore +1 -0
@@ -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
v3 cover docker fixes (and one tcg test tweak)
Hi,
I've missed the boat for today's rc1 but I'd like to get this merged before rc2. The new docker.py change is technically new functionality but I'm counting it as a usability bug fix as it replaces a random back trace failure with a preemptive failure and message mentioning binfmt_misc configuration. This would have saved Richard a lot of head scratching as he tried to setup a powerpc-user setup to test his setcontext fix (he had a custom binfmt_misc pointing to his src tree).
Finally we also drop the runcom test. It was cute that it got resurrected but it is ultimately a pointless test for something I'm sure no one actually uses.
There will be a follow-up RFC series after this that cleans-up some of the rough edges when your host is not an x86_64 box but that series won't be targeting the 3.0 release.
: The following patches need review
: patch docker/disable debian powerpc user cross.patch : patch docker/drop QEMU_TARGET check fallback in EXECUTABLE.patch : patch docker/Update debootstrap script after Debian migrat.patch : patch docker/ignore distro versioning of debootstrap.patch : patch docker/perform basic binfmt_misc validation in docke.patch : patch tests/tcg remove runcom test.patch
Alex Bennée (17):
tests/.gitignore: don't ignore docker tests
docker: base debian-tricore on qemu:debian9
docker: par down QEMU_CONFIGURE_OPTS in debian-tricore-cross
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
docker: drop QEMU_TARGET check, fallback in EXECUTABLE not set
docker: add --hint to docker.py check
docker: add commentary to debian-bootstrap.docker
docker: ignore distro versioning of debootstrap
docker: perform basic binfmt_misc validation in docker.py tests/tcg: remove runcom test
Philippe Mathieu-Daudé (1):
docker: Update debootstrap script after Debian migration from Alioth
to Salsa
tests/.gitignore | 1 + tests/docker/Makefile.include | 26 ++- tests/docker/common.rc | 24 ++- tests/docker/docker.py | 40 +++- .../dockerfiles/debian-bootstrap.docker | 1 + tests/docker/dockerfiles/debian-bootstrap.pre | 13 +- .../dockerfiles/debian-tricore-cross.docker | 6 +- tests/docker/test-clang | 2 +- tests/docker/test-debug | 2 +- tests/docker/test-full | 2 +- tests/docker/test-quick | 2 +- tests/docker/test-unit | 21 ++ tests/tcg/i386/Makefile.target | 5 - tests/tcg/i386/README | 3 - tests/tcg/i386/pi_10.com | Bin 54 -> 0 bytes tests/tcg/i386/runcom.c | 192 ------------------ 16 files changed, 116 insertions(+), 224 deletions(-) create mode 100755 tests/docker/test-unit delete mode 100644 tests/tcg/i386/pi_10.com delete mode 100644 tests/tcg/i386/runcom.c
Signature · 1 line
2.17.1
PATCH v3 2/18 docker: base debian-tricore on qemu:debian9
We need both git and a working compiler to build the tools. Although the qemu:debian9 image also has a bunch of extra dependencies it would be fairly unusual for a user not to already have this layer available for one of our many other docker images so lets not complicate things.
--- tests/docker/dockerfiles/debian-tricore-cross.docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/dockerfiles/debian-tricore-cross.docker +1 -1
@@ -7,7 +7,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # -FROM debian:9 +FROM qemu:debian9 MAINTAINER Philippe Mathieu-Daudé <[email protected]>
Signature · 1 line
2.17.1
PATCH v3 6/18 docker: move make check into check_qemu helper
In reply to Alex BennéeNot all docker images can run the check step. Let's move everything into a common helper so we don't need to replicate checks in the future.
---
v2
- add "move" to Let's everything in commit message
v3
- avoid confusion using IVOCATION, add comment
--- tests/docker/common.rc | 11 +++++++++++ tests/docker/test-clang | 2 +- tests/docker/test-debug | 2 +- tests/docker/test-full | 2 +- tests/docker/test-quick | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-)
tests/docker/common.rc +11 -0
@@ -40,6 +40,17 @@ build_qemu() make $MAKEFLAGS } +check_qemu() +{ + # default to make check unless the caller specifies + if test -z "$@"; then + INVOCATION="check" + else + INVOCATION="$@" + fi + make $MAKEFLAGS $INVOCATION +} + test_fail() { echo "$@"
tests/docker/test-clang +1 -1
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v3 3/18 docker: par down QEMU_CONFIGURE_OPTS in debian-tricore-cross
In reply to Alex BennéeThis image isn't going to build anything significant as it is just intended for building test cases. In case it does end up getting inadvertently included in a build lets aim for the minimal possible product.
--- tests/docker/dockerfiles/debian-tricore-cross.docker | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/docker/dockerfiles/debian-tricore-cross.docker +2 -2
@@ -19,5 +19,5 @@ RUN git clone --single-branch \ make && make install && \ rm -rf /usr/src/binutils -# Specify the cross prefix for this image (see tests/docker/common.rc) -ENV QEMU_CONFIGURE_OPTS --cross-prefix=tricore- +# This image isn't designed for building QEMU but building tests +ENV QEMU_CONFIGURE_OPTS --disable-system --disable-user
Signature · 1 line
2.17.1
PATCH v3 5/18 docker: split configure_qemu from build_qemu
In reply to Alex BennéeThis 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
@@ -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
PATCH v3 4/18 docker: fail more gracefully on docker.py check
In reply to Alex BennéeAs 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
@@ -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
PATCH v3 10/18 docker: add test-unit runner
In reply to Alex BennéeThis test doesn't even build QEMU, it just builds and runs all the unit tests. Intended to make checking unit tests on all docker images easier.
---
v2
- make script -e to error out on failure
- add comment as to why the configure step is run
--- tests/docker/test-unit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tests/docker/test-unit
tests/docker/test-unit new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/bash -e +# +# 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" + +# although we are not building QEMU itself we still need a configured +# build for the unit tests to be built and run +configure_qemu +check_qemu check-unit
Signature · 1 line
2.17.1
PATCH v3 11/18 docker: add expansion for docker-test-FOO to Makefile.include
In reply to Alex BennéeThis 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. At the same time rename docker-test to docker-all-tests to be clearer.
---
v2
- docker-test -> docker-all-tests
--- tests/docker/Makefile.include | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +4 -2
@@ -151,7 +151,8 @@ $(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES) $(DOCKER_DEPR $(eval docker-$t@$i: docker-image-$i docker-run-$t@$i) \ ) \ $(foreach t,$(DOCKER_TESTS), \ - $(eval docker-test: docker-$t@$i) \ + $(eval docker-all-tests: docker-$t@$i) \ + $(eval docker-$t: docker-$t@$i) \ ) \ )
@@ -161,7 +162,8 @@ docker: @echo 'Available targets:' @echo @echo ' docker: Print this help.' - @echo ' docker-test: Run all image/test combinations.' + @echo ' docker-all-tests: 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
PATCH v3 8/18 docker: Makefile.include don't include partial images
In reply to Alex BennéeRename 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
@@ -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
PATCH v3 7/18 docker: gracefully skip check_qemu
In reply to Alex BennéeNot 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.
---
v3
- use command -v in preference to bash-ist type
--- tests/docker/common.rc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tests/docker/common.rc +7 -1
@@ -48,7 +48,13 @@ check_qemu() else INVOCATION="$@" fi - make $MAKEFLAGS $INVOCATION + + if command -v gtester > /dev/null 2>&1 && \ + gtester --version > /dev/null 2>&1; then + make $MAKEFLAGS $INVOCATION + else + echo "No working gtester, skipping make $INVOCATION" + fi } test_fail()
Signature · 1 line
2.17.1
PATCH v3 9/18 docker: disable debian-powerpc-user-cross
In reply to Alex BennéeWhile 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
@@ -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
PATCH v3 12/18 docker: drop QEMU_TARGET check, fallback in EXECUTABLE not set
In reply to Alex BennéeThe addition of QEMU_TARGET was intended to ensure we fall back to checking for the existence of an image if the build system was not currently configured to build it. However this breaks the direct use of the rule for building custom binfmt_misc images. We already check for EXECUTABLE so let us just use that as a proxy for deciding if we are just going to check the image exits.
--- tests/docker/Makefile.include | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tests/docker/Makefile.include +1 -4
@@ -58,13 +58,11 @@ docker-image-%: $(DOCKER_FILES_DIR)/%.docker docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker $(if $(EXECUTABLE),,\ $(error EXECUTABLE not set, debootstrap of debian-$* would fail)) - $(if $(wildcard $(EXECUTABLE)),,\ - $(error Please build $(EXECUTABLE) first)) $(if $(DEB_ARCH),,\ $(error DEB_ARCH not set, debootstrap of debian-$* would fail)) $(if $(DEB_TYPE),,\ $(error DEB_TYPE not set, debootstrap of debian-$* would fail)) - $(if $(filter $(QEMU_TARGET),$(TARGET_DIRS)), \ + $(if $(wildcard $(EXECUTABLE)), \ $(call quiet-command, \ DEB_ARCH=$(DEB_ARCH) \ DEB_TYPE=$(DEB_TYPE) \
@@ -136,7 +134,6 @@ DOCKER_PARTIAL_IMAGES += debian-tricore-cross debian-powerpc-cross fedora-i386-c # broken so we need a qemu-linux-user for this target docker-binfmt-image-debian-powerpc-user: DEB_ARCH = powerpc docker-binfmt-image-debian-powerpc-user: DEB_TYPE = jessie -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
Signature · 1 line
2.17.1
PATCH v3 18/18 tests/tcg: remove runcom test
In reply to Alex BennéeThe combination of being rather esoteric and needing to support mmap @ 0 means this only ever worked under translation. It has now regressed even further and is no longer useful. Kill it.
--- tests/tcg/i386/Makefile.target | 5 - tests/tcg/i386/README | 3 - tests/tcg/i386/pi_10.com | Bin 54 -> 0 bytes tests/tcg/i386/runcom.c | 192 --------------------------------- 4 files changed, 200 deletions(-) delete mode 100644 tests/tcg/i386/pi_10.com delete mode 100644 tests/tcg/i386/runcom.c
tests/tcg/i386/Makefile.target +0 -5
@@ -29,11 +29,6 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ $(<D)/test-i386.c $(<D)/test-i386-code16.S $(<D)/test-i386-vm86.S -lm -# Specialist test runners -run-runcom: TIMEOUT=30 -run-runcom: runcom pi_10.com - $(call run-test,$<,$(QEMU) ./runcom $(I386_SRC)/pi_10.com,"$< on $(TARGET_NAME)") - ifeq ($(SPEED), slow) test-i386-fprem.ref: test-i386-fprem
tests/tcg/i386/README +0 -3
@@ -25,9 +25,6 @@ and host CPUs. test-i386-fprem --------------- -runcom ------- - test-mmap ---------
tests/tcg/i386/pi_10.com deleted binary +0 -0
tests/tcg/i386/runcom.c deleted +0 -192
192 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 15/18 docker: add commentary to debian-bootstrap.docker
In reply to Alex BennéeThis is just a note that later versions of debootstrap don't technically need this hack.
--- tests/docker/dockerfiles/debian-bootstrap.docker | 1 + 1 file changed, 1 insertion(+)
tests/docker/dockerfiles/debian-bootstrap.docker +1 -0
@@ -9,6 +9,7 @@ FROM scratch ADD . / # Patch all mounts as docker already has stuff set up +# (this is not needed for later debootstraps but is harmless atm) RUN sed -i 's/in_target mount/echo not for docker in_target mount/g' /debootstrap/functions # Run stage 2
Signature · 1 line
2.17.1
PATCH v3 16/18 docker: ignore distro versioning of debootstrap
In reply to Alex BennéeWe do a minimum version check for the debootstrap but if the distro has added their own minor version tick it would fail and fall-back to the SCM version. This is sub-optimal as the latest/greatest version may be broken at any one particular time. We fix that with a little sed magic on the version string before passing to our ugly shell versioning check.
--- tests/docker/dockerfiles/debian-bootstrap.pre | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
tests/docker/dockerfiles/debian-bootstrap.pre +7 -4
@@ -56,10 +56,13 @@ if [ -z $DEBOOTSTRAP_DIR ]; then if [ -z $DEBOOTSTRAP ]; then echo "No debootstrap installed, attempting to install from SCM" NEED_DEBOOTSTRAP=true - elif ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; "${DEBOOTSTRAP}" --version \ - | cut -d ' ' -f 2) | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -c &>/dev/null; then - echo "debootstrap too old, attempting to install from SCM" - NEED_DEBOOTSTRAP=true + else + INSTALLED_VERSION=$(${DEBOOTSTRAP} --version | sed 's/debootstrap \([0-9\.]*\)[^0-9\.]*.*/\1/') + if ! (echo "${MIN_DEBOOTSTRAP_VERSION}" ; echo "${INSTALLED_VERSION}") \ + | sort -t . -n -k 1,1 -k 2,2 -k 3,3 -C ; then + echo "debootstrap too old, attempting to install from SCM" + NEED_DEBOOTSTRAP=true + fi fi if $NEED_DEBOOTSTRAP; then DEBOOTSTRAP_SOURCE=https://salsa.debian.org/installer-team/debootstrap.git
Signature · 1 line
2.17.1
PATCH v3 13/18 docker: add --hint to docker.py check
In reply to Alex BennéeWhen a check fails we currently just report why we failed. This is not totally helpful to people who want to boot-strap a new image. Add a --hint option which we can pass down to give a bit more information.
--- tests/docker/Makefile.include | 3 ++- tests/docker/docker.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +2 -1
@@ -73,7 +73,8 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)), \ "BUILD","binfmt debian-$* (debootstrapped)"), \ $(call quiet-command, \ - $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $<, \ + $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $< \ + --hint "you will need to build $(EXECUTABLE)", \ "CHECK", "debian-$* exists")) endif
tests/docker/docker.py +2 -1
@@ -475,6 +475,7 @@ class CheckCommand(SubCommand): default="checksum", help="check type") parser.add_argument("--olderthan", default=60, type=int, help="number of minutes") + parser.add_argument("--hint", default="", help="hint to user") def run(self, args, argv): tag = args.tag
@@ -487,7 +488,7 @@ class CheckCommand(SubCommand): info = dkr.inspect_tag(tag) if info is None: - print("Image does not exist") + print("Image does not exist %s" % (args.hint)) return 1 if args.checktype == "checksum":
Signature · 1 line
2.17.1
PATCH v3 14/18 docker: Update debootstrap script after Debian migration from Alioth to Salsa
In reply to Alex BennéeFrom: Philippe Mathieu-Daudé <[email protected]>
This silents the following warning:
Cloning into './debootstrap.git'...
warning: redirecting to https://salsa.debian.org/installer-team/debootstrap.git/
See https://lists.debian.org/debian-devel-announce/2018/01/msg00004.html
--- tests/docker/dockerfiles/debian-bootstrap.pre | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/dockerfiles/debian-bootstrap.pre +1 -1
@@ -62,7 +62,7 @@ if [ -z $DEBOOTSTRAP_DIR ]; then NEED_DEBOOTSTRAP=true fi if $NEED_DEBOOTSTRAP; then - DEBOOTSTRAP_SOURCE=https://anonscm.debian.org/git/d-i/debootstrap.git + DEBOOTSTRAP_SOURCE=https://salsa.debian.org/installer-team/debootstrap.git git clone ${DEBOOTSTRAP_SOURCE} ./debootstrap.git export DEBOOTSTRAP_DIR=./debootstrap.git DEBOOTSTRAP=./debootstrap.git/debootstrap
Signature · 1 line
2.17.1
PATCH v3 17/18 docker: perform basic binfmt_misc validation in docker.py
In reply to Alex BennéeSetting up binfmt_misc is outside of the scope of the docker.py script but we can at least validate it with any given executable so we have a more useful error message than the sed line of deboostrap failing cryptically.
--- tests/docker/docker.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
tests/docker/docker.py +30 -0
@@ -112,6 +112,31 @@ def _copy_binary_with_libs(src, dest_dir): so_path = os.path.dirname(l) _copy_with_mkdir(l , dest_dir, so_path) + +def _check_binfmt_misc(executable): + """Check binfmt_misc has entry for executable in the right place. + + The details of setting up binfmt_misc are outside the scope of + this script but we should at least fail early with a useful + message if it won't work.""" + + binary = os.path.basename(executable) + binfmt_entry = "/proc/sys/fs/binfmt_misc/%s" % (binary) + + if not os.path.exists(binfmt_entry): + print ("No binfmt_misc entry for %s" % (binary)) + return False + + with open(binfmt_entry) as x: entry = x.read() + + qpath = "/usr/bin/%s" % (binary) + if not re.search("interpreter %s\n" % (qpath), entry): + print ("binfmt_misc for %s does not point to %s" % (binary, qpath)) + return False + + return True + + def _read_qemu_dockerfile(img_name): # special case for Debian linux-user images if img_name.startswith("debian") and img_name.endswith("user"):
@@ -315,6 +340,11 @@ class BuildCommand(SubCommand): # Create a docker context directory for the build docker_dir = tempfile.mkdtemp(prefix="docker_build") + # Validate binfmt_misc will work + if args.include_executable: + if not _check_binfmt_misc(args.include_executable): + return 1 + # Is there a .pre file to run in the build context? docker_pre = os.path.splitext(args.dockerfile)[0]+".pre" if os.path.exists(docker_pre):
Signature · 1 line
2.17.1
Quoted 18 lines · Alex Bennée
Hi,
I've missed the boat for today's rc1 but I'd like to get this merged before rc2. The new
docker.pychange is technically new functionality but I'm counting it as a usability bug fix as it replaces a random back trace failure with a preemptive failure and message mentioningbinfmt_miscconfiguration. This would have saved Richard a lot of head scratching as he tried to setup a powerpc-user setup to test his setcontext fix (he had a custombinfmt_miscpointing to his src tree).Finally we also drop the runcom test. It was cute that it got resurrected but it is ultimately a pointless test for something I'm sure no one actually uses.
There will be a follow-up RFC series after this that cleans-up some of the rough edges when your host is not an
x86_64box but that series won't be targeting the 3.0 release.
Quoted 7 lines
: The following patches need review
: patch docker/disable debian powerpc user cross.patch : patch docker/dropQEMU_TARGETcheck fallback in EXECUTABLE.patch : patch docker/Update debootstrap script after Debian migrat.patch : patch docker/ignore distro versioning of debootstrap.patch : patch docker/perform basicbinfmt_miscvalidation in docke.patch : patch tests/tcg remove runcom test.patch
Ping?
--
Alex Bennée
Re: [Qemu-devel] [PATCH v3 for 3.0 09/18] docker: disable debian-powerpc-user-cross
In reply to Alex BennéeQuoted 9 lines · 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.
Signed-off-by Alex Bennée <[email protected]>Cc David Gibson <[email protected]>Cc Alexander Graf <[email protected]>
Dropping this patch now rth's setcontext fix is in.
Quoted 9 lines
--- tests/docker/Makefile.include | 3 +++ 1 file changed, 3 insertions(+)tests/docker/Makefile.include +0
-0
tests/docker/Makefile.include docker-binfmt-image-debian-powerpc-user: QEMU_TARGET = ppc-linux-user · line 148
Quoted 9 lines
tests/docker/Makefile.include +3
-0@@ -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)), \
--
Alex Bennée
Re: [Qemu-devel] [PATCH v3 for 3.0 13/18] docker: add --hint to docker.py check
In reply to Alex BennéeQuoted 40 lines · Alex Bennée
When a check fails we currently just report why we failed. This is not totally helpful to people who want to boot-strap a new image. Add a --hint option which we can pass down to give a bit more information.
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- tests/docker/Makefile.include | 3 ++- tests/docker/docker.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)tests/docker/Makefile.include +2
-1@@ -73,7 +73,8 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)), \ "BUILD","binfmt debian-$* (debootstrapped)"), \ $(call quiet-command, \ - $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $<, \ + $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $< \ + --hint "you will need to build $(EXECUTABLE)", \ "CHECK", "debian-$* exists")) endiftests/docker/docker.py +1
-0@@ -475,6 +475,7 @@ class CheckCommand(SubCommand): default="checksum", help="check type") parser.add_argument("--olderthan", default=60, type=int, help="number of minutes") + parser.add_argument("--hint", default="", help="hint to user") def run(self, args, argv): tag = args.tag
tests/docker/docker.py class CheckCommand(SubCommand): · line 491
Quoted 5 lines
tests/docker/docker.py +1
-1@@ -487,7 +488,7 @@ class CheckCommand(SubCommand): info = dkr.inspect_tag(tag) if info is None: - print("Image does not exist") + print("Image does not exist %s" % (args.hint))
No, please. This is just hacky and makes no sense to me. The Makefile can do this
$(DOCKER_SCRIPT) check ... || { echo "you will need to build
$(EXECUTABLE)"; exit 1 }
Fam
Quoted 6 lines
tests/docker/docker.py +0
-1return 1 if args.checktype == "checksum": --2.17.1
Re: [Qemu-devel] [PATCH v3 for 3.0 17/18] docker: perform basic binfmt_misc validation in docker.py
In reply to Alex BennéeQuoted 28 lines · Alex Bennée
Setting up
binfmt_miscis outside of the scope of thedocker.pyscript but we can at least validate it with any given executable so we have a more useful error message than the sed line of deboostrap failing cryptically.Signed-off-by Alex Bennée <[email protected]>Reported-by Richard Henderson <[email protected]>--- tests/docker/docker.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)tests/docker/docker.py +8
-0@@ -112,6 +112,31 @@ def _copy_binary_with_libs(src, dest_dir): so_path = os.path.dirname(l) _copy_with_mkdir(l , dest_dir, so_path) + +def _check_binfmt_misc(executable): + """Check binfmt_misc has entry for executable in the right place. + + The details of setting up binfmt_misc are outside the scope of + this script but we should at least fail early with a useful + message if it won't work.""" +
tests/docker/docker.py def _copy_binary_with_libs(src, dest_dir): · line 132
Quoted 10 lines
tests/docker/docker.py +10
-0+ binary = os.path.basename(executable) + binfmt_entry = "/proc/sys/fs/binfmt_misc/%s" % (binary) + + if not os.path.exists(binfmt_entry): + print ("No binfmt_misc entry for %s" % (binary)) + return False + + with open(binfmt_entry) as x: entry = x.read() + + qpath = "/usr/bin/%s" % (binary)
Is it intended to hardcode this to /usr/bin? I thought we were more flexible than that..
Fam
Quoted 25 lines
tests/docker/docker.py +12
-1+ if not re.search("interpreter %s\n" % (qpath), entry): + print ("binfmt_misc for %s does not point to %s" % (binary, qpath)) + return False + + return True + + def _read_qemu_dockerfile(img_name): # special case for Debian linux-user images if img_name.startswith("debian") and img_name.endswith("user"):@@ -315,6 +340,11 @@ class BuildCommand(SubCommand): # Create a docker context directory for the build docker_dir = tempfile.mkdtemp(prefix="docker_build") + # Validate binfmt_misc will work + if args.include_executable: + if not _check_binfmt_misc(args.include_executable): + return 1 + # Is there a .pre file to run in the build context? docker_pre = os.path.splitext(args.dockerfile)[0]+".pre" if os.path.exists(docker_pre): --2.17.1
Quoted 30 lines · Alex Bennée
Quoted 18 lines · Alex Bennée
Hi,
I've missed the boat for today's rc1 but I'd like to get this merged before rc2. The new
docker.pychange is technically new functionality but I'm counting it as a usability bug fix as it replaces a random back trace failure with a preemptive failure and message mentioningbinfmt_miscconfiguration. This would have saved Richard a lot of head scratching as he tried to setup a powerpc-user setup to test his setcontext fix (he had a custombinfmt_miscpointing to his src tree).Finally we also drop the runcom test. It was cute that it got resurrected but it is ultimately a pointless test for something I'm sure no one actually uses.
There will be a follow-up RFC series after this that cleans-up some of the rough edges when your host is not an
x86_64box but that series won't be targeting the 3.0 release.Quoted 7 lines
: The following patches need review
: patch docker/disable debian powerpc user cross.patch : patch docker/dropQEMU_TARGETcheck fallback in EXECUTABLE.patch : patch docker/Update debootstrap script after Debian migrat.patch : patch docker/ignore distro versioning of debootstrap.patch : patch docker/perform basicbinfmt_miscvalidation in docke.patch : patch tests/tcg remove runcom test.patch
Quoted 1 line
Ping?
I had questions about patch 13 and 17. Otherwise looks good.
Maybe you can drop them for now (including patch 9) and send the PULL for the rest.
I don't know if we can catch up -rc2 but I guess the testing fixes are fairly safe to sneak in. :)
(My development machine is affected by
an
office power outage, and I was
also
busy with upgrading patchew.org. Sorry for the
late reply
!)
Fam
Re: [Qemu-devel] [PATCH v3 for 3.0 13/18] docker: add --hint to docker.py check
In reply to Fam ZhengQuoted 50 lines · Fam Zheng
Quoted 40 lines · Alex Bennée
When a check fails we currently just report why we failed. This is not totally helpful to people who want to boot-strap a new image. Add a --hint option which we can pass down to give a bit more information.
Signed-off-by Alex Bennée <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- tests/docker/Makefile.include | 3 ++- tests/docker/docker.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)tests/docker/Makefile.include +2
-1@@ -73,7 +73,8 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker $(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)), \ "BUILD","binfmt debian-$* (debootstrapped)"), \ $(call quiet-command, \ - $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $<, \ + $(DOCKER_SCRIPT) check --quiet qemu:debian-$* $< \ + --hint "you will need to build $(EXECUTABLE)", \ "CHECK", "debian-$* exists")) endiftests/docker/docker.py +1
-0@@ -475,6 +475,7 @@ class CheckCommand(SubCommand): default="checksum", help="check type") parser.add_argument("--olderthan", default=60, type=int, help="number of minutes") + parser.add_argument("--hint", default="", help="hint to user") def run(self, args, argv): tag = args.tagtests/docker/docker.py class CheckCommand(SubCommand): · line 491
Quoted 5 lines
tests/docker/docker.py +1
-1@@ -487,7 +488,7 @@ class CheckCommand(SubCommand): info = dkr.inspect_tag(tag) if info is None: - print("Image does not exist") + print("Image does not exist %s" % (args.hint))No, please. This is just hacky and makes no sense to me. The
Makefilecan do this
Quoted 2 lines
$(DOCKER_SCRIPT) check ... || { echo "you will need to build
$(EXECUTABLE)"; exit 1 }
OK I'll do it in the Makefile.
Quoted 9 lines
Fam
Quoted 6 lines
tests/docker/docker.py +0
-1return 1 if args.checktype == "checksum": --2.17.1
--
Alex Bennée
Re: [Qemu-devel] [PATCH v3 for 3.0 17/18] docker: perform basic binfmt_misc validation in docker.py
In reply to Fam ZhengQuoted 34 lines · Fam Zheng
Quoted 33 lines · Alex Bennée
Setting up
binfmt_miscis outside of the scope of thedocker.pyscript but we can at least validate it with any given executable so we have a more useful error message than the sed line of deboostrap failing cryptically.Signed-off-by Alex Bennée <[email protected]>Reported-by Richard Henderson <[email protected]>--- tests/docker/docker.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)tests/docker/docker.py +13
-0@@ -112,6 +112,31 @@ def _copy_binary_with_libs(src, dest_dir): so_path = os.path.dirname(l) _copy_with_mkdir(l , dest_dir, so_path) + +def _check_binfmt_misc(executable): + """Check binfmt_misc has entry for executable in the right place. + + The details of setting up binfmt_misc are outside the scope of + this script but we should at least fail early with a useful + message if it won't work.""" + + binary = os.path.basename(executable) + binfmt_entry = "/proc/sys/fs/binfmt_misc/%s" % (binary) + + if not os.path.exists(binfmt_entry): + print ("No binfmt_misc entry for %s" % (binary))
Quoted 8 lines
tests/docker/docker.py def _copy_binary_with_libs(src, dest_dir): · line 132
Quoted 5 lines
tests/docker/docker.py +5
-0+ return False + + with open(binfmt_entry) as x: entry = x.read() + + qpath = "/usr/bin/%s" % (binary)Is it intended to hardcode this to
/usr/bin? I thought we were more flexible than that..
That's where we currently copy it. However we are certainly capable of being more flexible. For example as long at there is an entry visible to the host file-system with the "F" flag we can actually create and run docker images without copying QEMU inside the container.
However if we don't we certainly need to copy it to the same place in the container than it is used outside the container.
Quoted 17 lines
Fam
Quoted 14 lines
tests/docker/docker.py +7
-0+ if not re.search("interpreter %s\n" % (qpath), entry): + print ("binfmt_misc for %s does not point to %s" % (binary, qpath)) + return False + + return True + + def _read_qemu_dockerfile(img_name): # special case for Debian linux-user images if img_name.startswith("debian") and img_name.endswith("user"):@@ -315,6 +340,11 @@ class BuildCommand(SubCommand): # Create a docker context directory for the build docker_dir = tempfile.mkdtemp(prefix="docker_build")
Quoted 11 lines
Quoted 11 lines
tests/docker/docker.py +5
-1+ # Validate binfmt_misc will work + if args.include_executable: + if not _check_binfmt_misc(args.include_executable): + return 1 + # Is there a .pre file to run in the build context? docker_pre = os.path.splitext(args.dockerfile)[0]+".pre" if os.path.exists(docker_pre): --2.17.1
--
Alex Bennée
Quoted 31 lines · Fam Zheng
Quoted 30 lines · Alex Bennée
Quoted 25 lines · Alex Bennée
Hi,
I've missed the boat for today's rc1 but I'd like to get this merged before rc2. The new
docker.pychange is technically new functionality but I'm counting it as a usability bug fix as it replaces a random back trace failure with a preemptive failure and message mentioningbinfmt_miscconfiguration. This would have saved Richard a lot of head scratching as he tried to setup a powerpc-user setup to test his setcontext fix (he had a custombinfmt_miscpointing to his src tree).Finally we also drop the runcom test. It was cute that it got resurrected but it is ultimately a pointless test for something I'm sure no one actually uses.
There will be a follow-up RFC series after this that cleans-up some of the rough edges when your host is not an
x86_64box but that series won't be targeting the 3.0 release.: The following patches need review
: patch docker/disable debian powerpc user cross.patch : patch docker/dropQEMU_TARGETcheck fallback in EXECUTABLE.patch : patch docker/Update debootstrap script after Debian migrat.patch : patch docker/ignore distro versioning of debootstrap.patch : patch docker/perform basicbinfmt_miscvalidation in docke.patch : patch tests/tcg remove runcom test.patch
Quoted 5 lines
Quoted 1 line
Ping?
I had questions about patch 13 and 17. Otherwise looks good.
Maybe you can drop them for now (including patch 9) and send the PULL for the rest.
I can drop/replace 13 - but 17 was there for a better reporting of a failure case Peter found. We can certainly expand it and be smarter in future iterations.
Quoted 12 lines
I don't know if we can catch up -rc2 but I guess the testing fixes are fairly safe to sneak in. :)
(My development machine is affected by
an
office power outage, and I was
also
busy with upgrading patchew.org. Sorry for the
late reply
!)
Quoted 1 line
Fam
--
Alex Bennée
Quoted 37 lines · Alex Bennée
Quoted 33 lines · Fam Zheng
Quoted 31 lines · Alex Bennée
Quoted 18 lines · Alex Bennée
Hi,
I've missed the boat for today's rc1 but I'd like to get this merged before rc2. The new
docker.pychange is technically new functionality but I'm counting it as a usability bug fix as it replaces a random back trace failure with a preemptive failure and message mentioningbinfmt_miscconfiguration. This would have saved Richard a lot of head scratching as he tried to setup a powerpc-user setup to test his setcontext fix (he had a custombinfmt_miscpointing to his src tree).Finally we also drop the runcom test. It was cute that it got resurrected but it is ultimately a pointless test for something I'm sure no one actually uses.
There will be a follow-up RFC series after this that cleans-up some of the rough edges when your host is not an
x86_64box but that series won't be targeting the 3.0 release.Quoted 7 lines
: The following patches need review
: patch docker/disable debian powerpc user cross.patch : patch docker/dropQEMU_TARGETcheck fallback in EXECUTABLE.patch : patch docker/Update debootstrap script after Debian migrat.patch : patch docker/ignore distro versioning of debootstrap.patch : patch docker/perform basicbinfmt_miscvalidation in docke.patch : patch tests/tcg remove runcom test.patchPing?
Quoted 7 lines
Quoted 3 lines
I had questions about patch 13 and 17. Otherwise looks good. Maybe you can drop them for now (including patch 9) and send the PULL for the rest.
I can drop/replace 13 - but 17 was there for a better reporting of a failure case Peter found. We can certainly expand it and be smarter in future iterations.
Sounds good to me.
Fam
Quoted 19 lines
Quoted 11 lines
I don't know if we can catch up -rc2 but I guess the testing fixes are fairly safe to sneak in. :)
(My development machine is affected by
an
office power outage, and I was
also
busy with upgrading patchew.org. Sorry for theQuoted 4 lines
late reply
!)Fam
--
Alex Bennée
Re: [Qemu-devel] [PATCH v3 for 3.0 18/18] tests/tcg: remove runcom test
In reply to Alex BennéeQuoted 6 lines · Alex Bennée
The combination of being rather esoteric and needing to support mmap @ 0 means this only ever worked under translation. It has now regressed even further and is no longer useful. Kill it.
Signed-off-by Alex Bennée <[email protected]>---
thanks
-- PMM