aboutsummaryrefslogtreecommitdiff
path: root/tests/docker
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-20 11:13:08 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-04-20 11:13:08 -0700
commit2d20a57453f6a206938cbbf77bed0b378c806c1f (patch)
tree1f20990007541156f17de9d36951ce6de8ab19fc /tests/docker
parent40a4b96eb08b3a3e83895f46b2394748dac7a641 (diff)
parentcaccf599181e2ea5f236345de9d9957a4c23e5ec (diff)
downloadqemu-2d20a57453f6a206938cbbf77bed0b378c806c1f.zip
qemu-2d20a57453f6a206938cbbf77bed0b378c806c1f.tar.gz
qemu-2d20a57453f6a206938cbbf77bed0b378c806c1f.tar.bz2
Merge tag 'pull-fixes-for-7.1-200422-1' of https://github.com/stsquad/qemu into staging
Testing, docs and gdbstub updates: - make -M virt test exercise -cpu max - document how binfmt_misc docker works - clean-up the devel TOC generation - clean-up check-tcg cross-compile behaviour - fix byte swap error in xmm gdbstub access - add float_convd test with reference files - more reference files for float_convs - more cleanly handle gdb crashing during check-tcg # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmJgIgsACgkQ+9DbCVqe # KkRs3Qf/WnL4YV3l8jO/wEVbls/57aLPk+ak1GuvXJ+iM9gH8Qz6WZxIJIEhhHlu # ZEixCewahTn8POMMRo4JAr0bRgtfBuh717GerXObiHcS3OuLsGM8rYP2Z1xqKL3L # 4pR8VqhyUq/Jyl/6MPN5OZB0AdEPIdI5MuflckCeDcFaowpthLjwHao07hG/FU0s # wQYS7aYTZT33V2Xm6xlePEEMq8YMPCJj00HF3Ljg4eUOmb+C+csFXMQtotsBJRCg # mC/T2U0IFbrQUkkWJqVmRCPwKraQGDMn6POk298siRWE0kV4BmH8mnmN+/Jxhqgl # QfFhQrsBxmPPG5TfQhEmlHfQ5EARLQ== # =8q12 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 20 Apr 2022 08:08:59 AM PDT # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * tag 'pull-fixes-for-7.1-200422-1' of https://github.com/stsquad/qemu: (25 commits) tests/guest-debug: better handle gdb crashes target/i386: fix byte swap issue with XMM register access tests/tcg: add missing reference files for float_convs tests/tcg: add float_convd test tests/tcg: remove duplicate sha512-sse case tests/tcg: fix non-static build tests/docker: remove SKIP_DOCKER_BUILD tests/tcg: isolate from QEMU's config-host.mak tests/tcg: invoke Makefile.target directly from QEMU's makefile tests/tcg: list test targets in Makefile.prereqs tests/tcg: prepare Makefile.prereqs at configure time tests/tcg: remove CONFIG_USER_ONLY from config-target.mak tests/tcg: remove CONFIG_LINUX_USER from config-target.mak tests/tcg: add compiler test variables when using containers tests/docker: do not duplicate rules for hexagon-cross tests/docker: simplify docker-TEST@IMAGE targets tests/docker: remove unnecessary filtering of $(DOCKER_IMAGES) tests/docker: inline variable definitions or move close to use tests/docker: remove unnecessary default definitions tests/docker: remove dead variable ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/docker')
-rw-r--r--tests/docker/Makefile.include115
-rwxr-xr-xtests/docker/docker.py57
-rwxr-xr-xtests/docker/dockerfiles/debian-hexagon-cross.d/build-toolchain.sh (renamed from tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh)0
-rw-r--r--tests/docker/dockerfiles/empty.docker8
4 files changed, 22 insertions, 158 deletions
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index e495b16..ca2157d 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -8,33 +8,13 @@ COMMA := ,
HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
-# These variables can be set by the user to limit the set of docker
-# images and tests to a more restricted subset
-TESTS ?= %
-IMAGES ?= %
-
-DOCKER_SUFFIX := .docker
DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
-# we don't run tests on intermediate images (used as base by another image)
-DOCKER_PARTIAL_IMAGES := debian10 debian11
-# we don't directly build virtual images (they are used to build other images)
-DOCKER_VIRTUAL_IMAGES := debian-bootstrap debian-toolchain empty
-__IMAGES := $(sort $(filter-out $(DOCKER_VIRTUAL_IMAGES), $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker)))))
-DOCKER_IMAGES := $(if $(IMAGES), $(filter $(IMAGES), $(__IMAGES)), $(__IMAGES))
-DOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
-# Use a global constant ccache directory to speed up repetitive builds
-DOCKER_CCACHE_DIR := $$HOME/.cache/qemu-docker-ccache
ifeq ($(HOST_ARCH),x86_64)
DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu
endif
DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
-__TESTS := $(notdir $(shell \
- find $(SRC_PATH)/tests/docker/ -name 'test-*' -type f))
-DOCKER_TESTS := $(if $(TESTS), $(filter $(TESTS), $(__TESTS)), $(__TESTS))
-
ENGINE := auto
-
DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
@@ -53,17 +33,7 @@ $(DOCKER_SRC_COPY):
docker-qemu-src: $(DOCKER_SRC_COPY)
-docker-image: ${DOCKER_TARGETS}
-
-# General rule for building docker images. If we are a sub-make
-# invoked with SKIP_DOCKER_BUILD we still check the image is up to date
-# though
-ifdef SKIP_DOCKER_BUILD
-docker-image-%: $(DOCKER_FILES_DIR)/%.docker
- $(call quiet-command, \
- $(DOCKER_SCRIPT) check --quiet qemu/$* $<, \
- "CHECK", "$*")
-else
+# General rule for building docker images.
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
$(call quiet-command,\
$(DOCKER_SCRIPT) build -t qemu/$* -f $< \
@@ -99,27 +69,9 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
{ echo "You will need to build $(EXECUTABLE)"; exit 1;},\
"CHECK", "debian-$* exists"))
-# These are test targets
-USER_TCG_TARGETS=$(patsubst %-linux-user,qemu-%,$(filter %-linux-user,$(TARGET_DIRS)))
-EXEC_COPY_TESTS=$(patsubst %,docker-exec-copy-test-%, $(USER_TCG_TARGETS))
-
-$(EXEC_COPY_TESTS): docker-exec-copy-test-%: $(DOCKER_FILES_DIR)/empty.docker
- $(call quiet-command, \
- $(DOCKER_SCRIPT) build -t qemu/exec-copy-test-$* -f $< \
- $(if $V,,--quiet) --no-cache \
- --include-executable=$* \
- --skip-binfmt, \
- "TEST","copy $* to container")
- $(call quiet-command, \
- $(DOCKER_SCRIPT) run qemu/exec-copy-test-$* \
- /$* -version > tests/docker-exec-copy-test-$*.out, \
- "TEST","check $* works in container")
-
-docker-exec-copy-test: $(EXEC_COPY_TESTS)
-
-endif
-
# Enforce dependencies for composite images
+# we don't run tests on intermediate images (used as base by another image)
+DOCKER_PARTIAL_IMAGES := debian10 debian11
ifeq ($(HOST_ARCH),x86_64)
docker-image-debian-amd64: docker-image-debian10
DOCKER_PARTIAL_IMAGES += debian-amd64-cross
@@ -159,28 +111,6 @@ docker-image-debian11: NOUSER=1
# alpine has no adduser
docker-image-alpine: NOUSER=1
-#
-# The build rule for hexagon-cross is special in so far for most of
-# the time we don't want to build it. While dockers caching does avoid
-# this most of the time sometimes we want to force the issue.
-#
-docker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker
- $(if $(NOCACHE), \
- $(call quiet-command, \
- $(DOCKER_SCRIPT) build -t qemu/debian-hexagon-cross -f $< \
- $(if $V,,--quiet) --no-cache \
- --registry $(DOCKER_REGISTRY) --extra-files \
- $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker.d/build-toolchain.sh, \
- "BUILD", "debian-hexagon-cross"), \
- $(call quiet-command, \
- $(DOCKER_SCRIPT) fetch $(if $V,,--quiet) \
- qemu/debian-hexagon-cross $(DOCKER_REGISTRY), \
- "FETCH", "debian-hexagon-cross") \
- $(call quiet-command, \
- $(DOCKER_SCRIPT) update $(if $V,,--quiet) \
- qemu/debian-hexagon-cross --add-current-user, \
- "PREPARE", "debian-hexagon-cross"))
-
debian-toolchain-run = \
$(if $(NOCACHE), \
$(call quiet-command, \
@@ -200,6 +130,10 @@ debian-toolchain-run = \
"PREPARE", $1))
debian-toolchain = $(call debian-toolchain-run,$(patsubst docker-image-%,%,$1))
+docker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker \
+ $(DOCKER_FILES_DIR)/debian-hexagon-cross.d/build-toolchain.sh
+ $(call debian-toolchain, $@)
+
docker-image-debian-microblaze-cross: $(DOCKER_FILES_DIR)/debian-toolchain.docker \
$(DOCKER_FILES_DIR)/debian-microblaze-cross.d/build-toolchain.sh
$(call debian-toolchain, $@)
@@ -229,17 +163,20 @@ DOCKER_PARTIAL_IMAGES += debian-tricore-cross
DOCKER_PARTIAL_IMAGES += debian-xtensa-cross
DOCKER_PARTIAL_IMAGES += fedora-cris-cross
-# Rules for building linux-user powered images
-#
-# These are slower than using native cross compiler setups but can
-# work around issues with poorly working multi-arch systems and broken
-# packages.
+# images that are only used to build other images
+DOCKER_VIRTUAL_IMAGES := debian-bootstrap debian-toolchain
+
+__IMAGES := $(sort $(filter-out $(DOCKER_VIRTUAL_IMAGES), $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker)))))
+DOCKER_IMAGES := $(if $(IMAGES), $(filter $(IMAGES), $(__IMAGES)), $(__IMAGES))
+
+__TESTS := $(notdir $(shell find $(SRC_PATH)/tests/docker/ -name 'test-*' -type f))
+DOCKER_TESTS := $(if $(TESTS), $(filter $(TESTS), $(__TESTS)), $(__TESTS))
# Expand all the pre-requistes for each docker image and test combination
-$(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES) $(DOCKER_VIRTUAL_IMAGES),$(DOCKER_IMAGES)), \
+$(foreach i,$(filter-out $(DOCKER_PARTIAL_IMAGES),$(DOCKER_IMAGES)), \
$(foreach t,$(DOCKER_TESTS), \
$(eval .PHONY: docker-$t@$i) \
- $(eval docker-$t@$i: docker-image-$i docker-run-$t@$i) \
+ $(eval docker-$t@$i: docker-image-$i; @$(MAKE) docker-run TEST=$t IMAGE=$i) \
) \
$(foreach t,$(DOCKER_TESTS), \
$(eval docker-all-tests: docker-$t@$i) \
@@ -266,11 +203,6 @@ docker:
@echo
@echo 'Available container images:'
@echo ' $(DOCKER_IMAGES)'
-ifneq ($(DOCKER_USER_IMAGES),)
- @echo
- @echo 'Available linux-user images (docker-binfmt-image-debian-%):'
- @echo ' $(DOCKER_USER_IMAGES)'
-endif
@echo
@echo 'Available tests:'
@echo ' $(DOCKER_TESTS)'
@@ -298,9 +230,12 @@ endif
docker-help: docker
+# Use a global constant ccache directory to speed up repetitive builds
+DOCKER_CCACHE_DIR := $$HOME/.cache/qemu-docker-ccache
+
# This rule if for directly running against an arbitrary docker target.
# It is called by the expanded docker targets (e.g. make
-# docker-test-foo@bar) which will do additional verification.
+# docker-test-foo@bar) which will also ensure the image is up to date.
#
# For example: make docker-run TEST="test-quick" IMAGE="debian:arm64" EXECUTABLE=./aarch64-linux-user/qemu-aarch64
#
@@ -335,13 +270,7 @@ docker-run: docker-qemu-src
$(call quiet-command, rm -r $(DOCKER_SRC_COPY), \
" CLEANUP $(DOCKER_SRC_COPY)")
-# Run targets:
-#
-# Of the form docker-TEST-FOO@IMAGE-BAR which will then be expanded into a call to "make docker-run"
-docker-run-%: CMD = $(shell echo '$@' | sed -e 's/docker-run-\([^@]*\)@\(.*\)/\1/')
-docker-run-%: IMAGE = $(shell echo '$@' | sed -e 's/docker-run-\([^@]*\)@\(.*\)/\2/')
-docker-run-%:
- @$(MAKE) docker-run TEST=$(CMD) IMAGE=qemu/$(IMAGE)
+docker-image: ${DOCKER_IMAGES:%=docker-image-%}
docker-clean:
$(call quiet-command, $(DOCKER_SCRIPT) clean)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 78dd131..d0af286 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -676,63 +676,6 @@ class CcCommand(SubCommand):
as_user=True)
-class CheckCommand(SubCommand):
- """Check if we need to re-build a docker image out of a dockerfile.
- Arguments: <tag> <dockerfile>"""
- name = "check"
-
- def args(self, parser):
- parser.add_argument("tag",
- help="Image Tag")
- parser.add_argument("dockerfile", default=None,
- help="Dockerfile name", nargs='?')
- parser.add_argument("--checktype", choices=["checksum", "age"],
- default="checksum", help="check type")
- parser.add_argument("--olderthan", default=60, type=int,
- help="number of minutes")
-
- def run(self, args, argv):
- tag = args.tag
-
- try:
- dkr = Docker()
- except subprocess.CalledProcessError:
- print("Docker not set up")
- return 1
-
- info = dkr.inspect_tag(tag)
- if info is None:
- print("Image does not exist")
- return 1
-
- if args.checktype == "checksum":
- if not args.dockerfile:
- print("Need a dockerfile for tag:%s" % (tag))
- return 1
-
- dockerfile = _read_dockerfile(args.dockerfile)
-
- if dkr.image_matches_dockerfile(tag, dockerfile):
- if not args.quiet:
- print("Image is up to date")
- return 0
- else:
- print("Image needs updating")
- return 1
- elif args.checktype == "age":
- timestr = dkr.get_image_creation_time(info).split(".")[0]
- created = datetime.strptime(timestr, "%Y-%m-%dT%H:%M:%S")
- past = datetime.now() - timedelta(minutes=args.olderthan)
- if created < past:
- print ("Image created @ %s more than %d minutes old" %
- (timestr, args.olderthan))
- return 1
- else:
- if not args.quiet:
- print ("Image less than %d minutes old" % (args.olderthan))
- return 0
-
-
def main():
global USE_ENGINE
diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh b/tests/docker/dockerfiles/debian-hexagon-cross.d/build-toolchain.sh
index 19b1c9f..19b1c9f 100755
--- a/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
+++ b/tests/docker/dockerfiles/debian-hexagon-cross.d/build-toolchain.sh
diff --git a/tests/docker/dockerfiles/empty.docker b/tests/docker/dockerfiles/empty.docker
deleted file mode 100644
index 9ba980f..0000000
--- a/tests/docker/dockerfiles/empty.docker
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Empty Dockerfile
-#
-
-FROM scratch
-
-# Add everything from the context into the container
-ADD . /