diff options
author | Peter Maydell | 2018-07-24 14:30:12 +0200 |
---|---|---|
committer | Peter Maydell | 2018-07-24 14:30:12 +0200 |
commit | 0a7052bb75da47e0d57d7b17b5d467de8589c4a8 (patch) | |
tree | d3d08b52c695c3175ee32fb92d931f4524d702a3 /tests/docker/docker.py | |
parent | Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2018-07-23-tag' in... (diff) | |
parent | tests/tcg: remove runcom test (diff) | |
download | qemu-0a7052bb75da47e0d57d7b17b5d467de8589c4a8.tar.gz qemu-0a7052bb75da47e0d57d7b17b5d467de8589c4a8.tar.xz qemu-0a7052bb75da47e0d57d7b17b5d467de8589c4a8.zip |
Merge remote-tracking branch 'remotes/stsquad/tags/pull-docker-fixes-for-3.0-240718-1' into staging
docker fixes & tcg test tweak
- graceful handling of testing under cross-compile
- fixes for debootstrap handling
- more helpful errors (binfmt_misc/EXECUTABLE missing)
- drop runcom TCG test
# gpg: Signature made Tue 24 Jul 2018 11:48:32 BST
# gpg: using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44
* remotes/stsquad/tags/pull-docker-fixes-for-3.0-240718-1:
tests/tcg: remove runcom test
docker: perform basic binfmt_misc validation in docker.py
docker: ignore distro versioning of debootstrap
docker: add commentary to debian-bootstrap.docker
docker: Update debootstrap script after Debian migration from Alioth to Salsa
docker: report hint when docker.py check fails
docker: drop QEMU_TARGET check, fallback in EXECUTABLE not set
docker: add expansion for docker-test-FOO to Makefile.include
docker: add test-unit runner
docker: Makefile.include don't include partial images
docker: gracefully skip check_qemu
docker: move make check into check_qemu helper
docker: split configure_qemu from build_qemu
docker: fail more gracefully on docker.py check
docker: par down QEMU_CONFIGURE_OPTS in debian-tricore-cross
docker: base debian-tricore on qemu:debian9
tests/.gitignore: don't ignore docker tests
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/docker/docker.py')
-rwxr-xr-x | tests/docker/docker.py | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 69e7130db7..d3006d4dae 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -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): @@ -479,7 +509,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") |