Skip to contentSkip to conversation

Expand the building of qemu-user docker images

PATCH In review Alex Bennée 2 participants 19 messages Oct 28, 2016 – Nov 1, 2016

lore
Share & tools
lore
#0 lore raw

cover Expand the building of qemu-user docker images

Hi Fam,

These are a little bit of a work in progress so maybe not all ready to be taken yet although review would be welcome.

This adds some tweaks to allow us to build the cross-arch debian images with direct make invocations and then see which images we can test against from the "make docker" help text. Now:

make docker-image-debian-stable-arm64

Will do exactly as you expect. I can't get:

make docker-test-quick@debian-stable-arm64

To work but I suspect this needs some fixing to the generated rules.

Comments?

Alex Bennée (6):
tests/docker/Makefile.include: fix diff-index call tests/docker/test-user: a simple linux-user test tests/docker: add optional libs to travis.docker tests/docker/Makefile: Add a rule for Debian user images tests/docker/docker.py: expand images command tests/docker/Makefile.include: expand docker help text

 tests/docker/Makefile.include          | 29 ++++++++++++++++++++++++++---
 tests/docker/docker.py                 | 27 ++++++++++++++++++++++-----
 tests/docker/dockerfiles/travis.docker |  9 ++++++++-
 tests/docker/test-user                 | 18 ++++++++++++++++++
 4 files changed, 74 insertions(+), 9 deletions(-)
 create mode 100755 tests/docker/test-user
Signature · 1 line
2.10.1
#1 lore raw

PATCH 1/6 tests/docker/Makefile.include: fix diff-index call

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

---
TODO:
- properly understand the failure

---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +1 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
Signature · 1 line
2.10.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call

Quoted 10 lines · Alex Bennée

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

---
TODO:
- properly understand the failure

Yep, I don't see the bug on my machine (Fedora 24, git 2.7.4). What about the removed "--"? Does that make a difference for you?

Quoted 21 lines
---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +1 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
Signature · 1 line
2.10.1
#3 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call

Quoted 6 lines · Fam Zheng
Quoted 5 lines · Alex Bennée

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

Quoted 8 lines
Quoted 5 lines

---
TODO:
- properly understand the failure

Yep, I don't see the bug on my machine (Fedora 24, git 2.7.4). What about the removed "--"? Does that make a difference for you?

The -- seems superfluous as we are not giving it a list of files to check against. I was seeing the problem with known files with changes which were not committed.

My setup is Ubuntu 16.04 with git 2.10.1 (I track upstream stable).

Quoted 14 lines
Quoted 14 lines
---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +0 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
Quoted 8 lines
Quoted 8 lines
tests/docker/Makefile.include +1 -1
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
--

2.10.1

--
Alex Bennée

#4 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call

In reply to Fam Zheng
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Alex Bennée

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

Quoted 8 lines
Quoted 5 lines

---
TODO:
- properly understand the failure

Yep, I don't see the bug on my machine (Fedora 24, git 2.7.4). What about the removed "--"? Does that make a difference for you?

Nope - it seems to be the &>/dev/null that triggers the problem - but only in the Makefile. Running the commands from the command line works as expected.

However why do we need the redirect here anyway considering the call quiet-command?

Quoted 14 lines
Quoted 14 lines
---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +0 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
Quoted 8 lines
Quoted 8 lines
tests/docker/Makefile.include +1 -1
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
--

2.10.1

--
Alex Bennée

#5 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call

Quoted 18 lines · Alex Bennée
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Alex Bennée

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

Quoted 8 lines
Quoted 5 lines

---
TODO:
- properly understand the failure

Yep, I don't see the bug on my machine (Fedora 24, git 2.7.4). What about the removed "--"? Does that make a difference for you?

Quoted 6 lines

Nope - it seems to be the &>/dev/null that triggers the problem - but only in the Makefile. Running the commands from the command line works as expected.

However why do we need the redirect here anyway considering the call quiet-command?

It's to force suppressing output, while quiet-command only suppresses the echoing of the command itself. Since we have "--quiet" here, does "2>/dev/null" work for you?

Fam

Quoted 27 lines
Quoted 15 lines
Quoted 15 lines

---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +0 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
Quoted 8 lines
Quoted 8 lines
tests/docker/Makefile.include +1 -1
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
--

2.10.1

--
Alex Bennée

#6 lore raw

Re: [Qemu-devel] [PATCH 1/6] tests/docker/Makefile.include: fix diff-index call

Quoted 23 lines · Fam Zheng
Quoted 22 lines · Alex Bennée
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Alex Bennée

The whole thing is wrapped inside a call quiet-command as well as being the actual call taking a --quiet argument so the redirect is superfluous. For reasons I have yet to determine this also seems to be causing the source preparation step to skip stashing work tree stuff.

Quoted 8 lines
Quoted 5 lines

---
TODO:
- properly understand the failure

Yep, I don't see the bug on my machine (Fedora 24, git 2.7.4). What about the removed "--"? Does that make a difference for you?

Nope - it seems to be the &>/dev/null that triggers the problem - but only in the Makefile. Running the commands from the command line works as expected.

Quoted 6 lines
Quoted 2 lines

However why do we need the redirect here anyway considering the call quiet-command?

It's to force suppressing output, while quiet-command only suppresses the echoing of the command itself. Since we have "--quiet" here, does "2>/dev/null" work for you?

That works!

- (cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
+ (cd $1; if git diff-index --quiet HEAD -- 2>/dev/null; then \

Quoted 30 lines

Fam

Quoted 27 lines
Quoted 15 lines
Quoted 15 lines

---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/docker/Makefile.include +0 -1
index 3f15d5a..d91e28b 100644
@@ -20,7 +20,7 @@ IMAGES ?= %
 # Make archive from git repo $1 to tar.gz $2
 make-archive-maybe = $(if $(wildcard $1/*), \
 	$(call quiet-command, \
-		(cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
Quoted 8 lines
Quoted 8 lines
tests/docker/Makefile.include +1 -1
+		(cd $1; if git diff-index --quiet HEAD; then \
 			git archive -1 HEAD --format=tar.gz; \
 		else \
 			git archive -1 $$(git stash create) --format=tar.gz; \
--

2.10.1

--
Alex Bennée

--
Alex Bennée

#7 lore raw

PATCH 2/6 tests/docker/test-user: a simple linux-user test

In reply to Alex Bennée

This is useful for checking an appropriately updated cross-arch docker actually starts without having to do a full build.

---
 tests/docker/test-user | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 tests/docker/test-user
tests/docker/test-user new file +18 -0
new file mode 100755
index 0000000..4871de7
@@ -0,0 +1,18 @@
+#!/bin/bash -e
+#
+# A very simple test that checks qemu-linux-user binaries work
+# correctly in a cross-arch docker container.
+#
+# Copyright (c) 2016 Linaro.
+#
+# 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
+
+uname -a
+exit 0
Signature · 1 line
2.10.1
#8 lore raw

Re: [Qemu-devel] [PATCH 2/6] tests/docker/test-user: a simple linux-user test

Quoted 2 lines · Alex Bennée

This is useful for checking an appropriately updated cross-arch docker actually starts without having to do a full build.

Can we call it "test-pass"?

Fam

Quoted 35 lines
---
 tests/docker/test-user | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100755 tests/docker/test-user
tests/docker/test-user new file +18 -0
new file mode 100755
index 0000000..4871de7
@@ -0,0 +1,18 @@
+#!/bin/bash -e
+#
+# A very simple test that checks qemu-linux-user binaries work
+# correctly in a cross-arch docker container.
+#
+# Copyright (c) 2016 Linaro.
+#
+# 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
+
+uname -a
+exit 0
Signature · 1 line
2.10.1
#9 lore raw

PATCH 3/6 tests/docker: add optional libs to travis.docker

In reply to Alex Bennée

In our .travis.yml we install a bunch of extra libraries which are not part of the packaged QEMU's builddeps. We include them here to make our docker container more closely match the state of the system after docker has installed the rest of the build dependencies.

---
 tests/docker/dockerfiles/travis.docker | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tests/docker/dockerfiles/travis.docker +8 -1
index e4983ae..6bef722 100644
@@ -2,5 +2,12 @@ FROM quay.io/travisci/travis-ruby
 RUN apt-get update
 RUN apt-get -y build-dep qemu
 RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 dh-autoreconf
+# Additional optional libs not in QEMU's builddep
+RUN apt-get -y install libbrlapi-dev liblttng-ust-dev libcap-ng-dev \
+                       libnfs-dev libnss3-dev libpixman-1-dev \
+                       libpng12-dev librados-dev libseccomp-dev \
+                       libspice-protocol-dev libspice-server-dev \
+                       libssh2-1-dev liburcu-dev libusb-1.0-0-dev \
+                       libvte-2.90-dev
+RUN apt-get -y install python2.7 dh-autoreconf sparse
 ENV FEATURES pyyaml
Signature · 1 line
2.10.1
#10 lore raw

Re: [Qemu-devel] [PATCH 3/6] tests/docker: add optional libs to travis.docker

Quoted 17 lines · Alex Bennée

In our .travis.yml we install a bunch of extra libraries which are not part of the packaged QEMU's builddeps. We include them here to make our docker container more closely match the state of the system after docker has installed the rest of the build dependencies.

---
 tests/docker/dockerfiles/travis.docker | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tests/docker/dockerfiles/travis.docker +0 -0
index e4983ae..6bef722 100644
@@ -2,5 +2,12 @@ FROM quay.io/travisci/travis-ruby
 RUN apt-get update
 RUN apt-get -y build-dep qemu

tests/docker/dockerfiles/travis.docker FROM quay.io/travisci/travis-ruby · line 12

Quoted 10 lines
tests/docker/dockerfiles/travis.docker +8 -1
 RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 dh-autoreconf
+# Additional optional libs not in QEMU's builddep
+RUN apt-get -y install libbrlapi-dev liblttng-ust-dev libcap-ng-dev \
+                       libnfs-dev libnss3-dev libpixman-1-dev \
+                       libpng12-dev librados-dev libseccomp-dev \
+                       libspice-protocol-dev libspice-server-dev \
+                       libssh2-1-dev liburcu-dev libusb-1.0-0-dev \
+                       libvte-2.90-dev
+RUN apt-get -y install python2.7 dh-autoreconf sparse

Any reason to use two apt-get lines?

Also, can you put these package names in $PACKAGES and dump 'dpkg -l $PACKAGES' to /packages.txt like in ubuntu.docker? That way we can print it in reports by adding SHOW_ENV=1 in make invocation.

Fam

Quoted 5 lines
tests/docker/dockerfiles/travis.docker +0 -0
 ENV FEATURES pyyaml
Signature · 1 line
2.10.1
#11 lore raw

PATCH 4/6 tests/docker/Makefile: Add a rule for Debian user images

In reply to Alex Bennée

This allows you to create Debian images powered by a qemu linux-user binary. Later patches will list these in the help file but for now:

make docker-image-debian-stable-arm64

---
 tests/docker/Makefile.include | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/docker/Makefile.include +16 -0
index d91e28b..bb9e078 100644
@@ -64,6 +64,22 @@ $(foreach i,$(DOCKER_IMAGES), \
 	) \
 )
 
+# Additional Debian qemu-user images
+#
+# These images are built using the generic debian-bootstrap image and a qemu-user binary
+#
+docker-image-debian-%: DEB_TYPE = $(shell echo '$@' | sed -e 's/docker-image-debian-\([^@]*\)-\(.*\)/\1/')
+docker-image-debian-%: DEB_ARCH = $(shell echo '$@' | sed -e 's/docker-image-debian-\([^@]*\)-\(.*\)/\2/')
+docker-image-debian-%: QEMU_ARCH = $(subst arm64,aarch64,$(subst armhf,arm,$(DEB_ARCH)))
+docker-image-debian-%: QEMU_EXEC=$(BUILD_DIR)/$(QEMU_ARCH)-linux-user/qemu-$(QEMU_ARCH)
+docker-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
+	$(call quiet-command,\
+		DEB_ARCH=$(DEB_ARCH) DEB_TYPE=$(DEB_TYPE) \
+		$(SRC_PATH)/tests/docker/docker.py build qemu:debian-$* $< \
+		$(if $V,,--quiet) $(if $(NOCACHE),--no-cache) \
+		--include-executable=$(QEMU_EXEC),\
+		"BUILD USER","$*")
+
 docker:
 	@echo 'Build QEMU and run tests inside Docker containers'
 	@echo
Signature · 1 line
2.10.1
#12 lore raw

PATCH 5/6 tests/docker/docker.py: expand images command

In reply to Alex Bennée

Modern docker cli commands can filter by repository but as we want to work on all instances do this by hand in python:

   /tests/docker/docker.py images --repo qemu

Will return a space delimited list for the benefit of our Makefile recipes.

---
 tests/docker/docker.py | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
tests/docker/docker.py +22 -5
index 37d8319..03c0238 100755
@@ -105,12 +105,15 @@ class Docker(object):
         signal.signal(signal.SIGTERM, self._kill_instances)
         signal.signal(signal.SIGHUP, self._kill_instances)
 
-    def _do(self, cmd, quiet=True, infile=None, **kwargs):
+    def _do(self, cmd, quiet=True, infile=None, output=False, **kwargs):
         if quiet:
             kwargs["stdout"] = DEVNULL
         if infile:
             kwargs["stdin"] = infile
-        return subprocess.call(self._command + cmd, **kwargs)
+        if output:
+            return subprocess.check_output(self._command + cmd, **kwargs)
+        else:
+            return subprocess.call(self._command + cmd, **kwargs)
 
     def _do_kill_instances(self, only_known, only_active=True):
         cmd = ["ps", "-q"]
@@ -188,8 +191,8 @@ class Docker(object):
             self._instances.remove(label)
         return ret
 
-    def command(self, cmd, argv, quiet):
-        return self._do([cmd] + argv, quiet=quiet)
+    def command(self, cmd, argv, quiet, output=False):
+        return self._do([cmd] + argv, quiet=quiet, output=output)
 
 class SubCommand(object):
     """A SubCommand template base class"""
@@ -325,8 +328,22 @@ class CleanCommand(SubCommand):
 class ImagesCommand(SubCommand):
     """Run "docker images" command"""
     name = "images"
+    def args(self, parser):
+        parser.add_argument("--repo",
+                            help="List images in the given repository")
+
     def run(self, args, argv):
-        return Docker().command("images", argv, args.quiet)
+        if args.repo:
+            images=[]
+            image_re = re.compile(r"^"+re.escape(args.repo)+r"\s+(\S*)")
+            output = Docker().command("images", argv, args.quiet, output=True)
+            for line in output.split("\n"):
+                search = image_re.search(line)
+                if search:
+                    images.append(search.group(1))
+            print ' '.join(map(str,images))
+        else:
+            return Docker().command("images", argv, args.quiet)
 
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
Signature · 1 line
2.10.1
#13 lore raw

Re: [Qemu-devel] [PATCH 5/6] tests/docker/docker.py: expand images command

Quoted 55 lines · Alex Bennée

Modern docker cli commands can filter by repository but as we want to work on all instances do this by hand in python:

   /tests/docker/docker.py images --repo qemu

Will return a space delimited list for the benefit of our Makefile recipes.

---
 tests/docker/docker.py | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
tests/docker/docker.py +11 -4
index 37d8319..03c0238 100755
@@ -105,12 +105,15 @@ class Docker(object):
         signal.signal(signal.SIGTERM, self._kill_instances)
         signal.signal(signal.SIGHUP, self._kill_instances)
 
-    def _do(self, cmd, quiet=True, infile=None, **kwargs):
+    def _do(self, cmd, quiet=True, infile=None, output=False, **kwargs):
         if quiet:
             kwargs["stdout"] = DEVNULL
         if infile:
             kwargs["stdin"] = infile
-        return subprocess.call(self._command + cmd, **kwargs)
+        if output:
+            return subprocess.check_output(self._command + cmd, **kwargs)
+        else:
+            return subprocess.call(self._command + cmd, **kwargs)
 
     def _do_kill_instances(self, only_known, only_active=True):
         cmd = ["ps", "-q"]
@@ -188,8 +191,8 @@ class Docker(object):
             self._instances.remove(label)
         return ret
 
-    def command(self, cmd, argv, quiet):
-        return self._do([cmd] + argv, quiet=quiet)
+    def command(self, cmd, argv, quiet, output=False):
+        return self._do([cmd] + argv, quiet=quiet, output=output)
 
 class SubCommand(object):
     """A SubCommand template base class"""
@@ -325,8 +328,22 @@ class CleanCommand(SubCommand):
 class ImagesCommand(SubCommand):
     """Run "docker images" command"""
     name = "images"
+    def args(self, parser):
+        parser.add_argument("--repo",
+                            help="List images in the given repository")
+
     def run(self, args, argv):

tests/docker/docker.py class CleanCommand(SubCommand): · line 344

Quoted 10 lines
tests/docker/docker.py +9 -1
-        return Docker().command("images", argv, args.quiet)
+        if args.repo:
+            images=[]
+            image_re = re.compile(r"^"+re.escape(args.repo)+r"\s+(\S*)")
+            output = Docker().command("images", argv, args.quiet, output=True)
+            for line in output.split("\n"):
+                search = image_re.search(line)
+                if search:
+                    images.append(search.group(1))
+            print ' '.join(map(str,images))

s/,/, /

Otherwise looks good.

Quoted 8 lines
tests/docker/docker.py +2 -0
+        else:
+            return Docker().command("images", argv, args.quiet)
 
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
Signature · 1 line
2.10.1
#14 lore raw

PATCH 6/6 tests/docker/Makefile.include: expand docker help text

In reply to Alex Bennée

No we can query what has and hasn't been built we can make this list available in the help text. This is useful as some of the bootstrapped builds can take some time to build.

---
 tests/docker/Makefile.include | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +9 -2
index bb9e078..a19991b 100644
@@ -80,6 +80,10 @@ docker-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
 		--include-executable=$(QEMU_EXEC),\
 		"BUILD USER","$*")
 
+DOCKER_USER_IMAGES := debian-stable-armhf debian-stable-arm64
+DOCKER_BUILT_IMAGES := $(shell $(SRC_PATH)/tests/docker/docker.py images --repo qemu)
+DOCKER_UNBUILT_IMAGES := $(filter-out debian-bootstrap, $(filter-out $(DOCKER_BUILT_IMAGES), $(DOCKER_USER_IMAGES) $(DOCKER_IMAGES)))
+
 docker:
 	@echo 'Build QEMU and run tests inside Docker containers'
 	@echo
@@ -96,8 +100,11 @@ docker:
 	@echo '    docker-image-IMAGE:  Build image "IMAGE".'
 	@echo '    docker-run:          For manually running a "TEST" with "IMAGE"'
 	@echo
-	@echo 'Available container images:'
-	@echo '    $(DOCKER_IMAGES)'
+	@echo 'Available built container images:'
+	@echo '    $(DOCKER_BUILT_IMAGES)'
+	@echo
+	@echo 'Available (but unbuilt) container images:'
+	@echo '    $(DOCKER_UNBUILT_IMAGES)'
 	@echo
 	@echo 'Available tests:'
 	@echo '    $(DOCKER_TESTS)'
Signature · 1 line
2.10.1
#15 lore raw

Re: [Qemu-devel] [PATCH 6/6] tests/docker/Makefile.include: expand docker help text

Quoted 3 lines · Alex Bennée

No we can query what has and hasn't been built we can make this list available in the help text. This is useful as some of the bootstrapped builds can take some time to build.

I'm not sure how useful it is to list built images without checking if it's in sync with the dockerfile: we still rebuild outdated ones even they're built.

Quoted 39 lines
---
 tests/docker/Makefile.include | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +9 -2
index bb9e078..a19991b 100644
@@ -80,6 +80,10 @@ docker-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
 		--include-executable=$(QEMU_EXEC),\
 		"BUILD USER","$*")
 
+DOCKER_USER_IMAGES := debian-stable-armhf debian-stable-arm64
+DOCKER_BUILT_IMAGES := $(shell $(SRC_PATH)/tests/docker/docker.py images --repo qemu)
+DOCKER_UNBUILT_IMAGES := $(filter-out debian-bootstrap, $(filter-out $(DOCKER_BUILT_IMAGES), $(DOCKER_USER_IMAGES) $(DOCKER_IMAGES)))
+
 docker:
 	@echo 'Build QEMU and run tests inside Docker containers'
 	@echo
@@ -96,8 +100,11 @@ docker:
 	@echo '    docker-image-IMAGE:  Build image "IMAGE".'
 	@echo '    docker-run:          For manually running a "TEST" with "IMAGE"'
 	@echo
-	@echo 'Available container images:'
-	@echo '    $(DOCKER_IMAGES)'
+	@echo 'Available built container images:'
+	@echo '    $(DOCKER_BUILT_IMAGES)'
+	@echo
+	@echo 'Available (but unbuilt) container images:'
+	@echo '    $(DOCKER_UNBUILT_IMAGES)'
 	@echo
 	@echo 'Available tests:'
 	@echo '    $(DOCKER_TESTS)'
Signature · 1 line
2.10.1
#16 lore raw
In reply to Alex Bennée
Quoted 11 lines · Alex Bennée

Hi Fam,

These are a little bit of a work in progress so maybe not all ready to be taken yet although review would be welcome.

This adds some tweaks to allow us to build the cross-arch debian images with direct make invocations and then see which images we can test against from the "make docker" help text. Now:

make docker-image-debian-stable-arm64

Quoted 7 lines

Will do exactly as you expect. I can't get:

make docker-test-quick@debian-stable-arm64

To work but I suspect this needs some fixing to the generated rules.

Comments?

Looks good, but what about binfmt_misc?

Fam

Quoted 20 lines

Alex Bennée (6):
tests/docker/Makefile.include: fix diff-index call tests/docker/test-user: a simple linux-user test tests/docker: add optional libs to travis.docker tests/docker/Makefile: Add a rule for Debian user images tests/docker/docker.py: expand images command tests/docker/Makefile.include: expand docker help text

 tests/docker/Makefile.include          | 29 ++++++++++++++++++++++++++---
 tests/docker/docker.py                 | 27 ++++++++++++++++++++++-----
 tests/docker/dockerfiles/travis.docker |  9 ++++++++-
 tests/docker/test-user                 | 18 ++++++++++++++++++
 4 files changed, 74 insertions(+), 9 deletions(-)
 create mode 100755 tests/docker/test-user
Signature · 1 line
2.10.1
#17 lore raw
Quoted 14 lines · Fam Zheng
Quoted 13 lines · Alex Bennée

Hi Fam,

These are a little bit of a work in progress so maybe not all ready to be taken yet although review would be welcome.

This adds some tweaks to allow us to build the cross-arch debian images with direct make invocations and then see which images we can test against from the "make docker" help text. Now:

make docker-image-debian-stable-arm64

Will do exactly as you expect. I can't get:

Quoted 7 lines
Quoted 5 lines

make docker-test-quick@debian-stable-arm64

To work but I suspect this needs some fixing to the generated rules.

Comments?

Looks good, but what about binfmt_misc?

Currently the binfmt_misc check is done when the image is built (by the pre script). We could expand docker.py to check and use that?

Quoted 23 lines

Fam

Quoted 20 lines

Alex Bennée (6):
tests/docker/Makefile.include: fix diff-index call tests/docker/test-user: a simple linux-user test tests/docker: add optional libs to travis.docker tests/docker/Makefile: Add a rule for Debian user images tests/docker/docker.py: expand images command tests/docker/Makefile.include: expand docker help text

 tests/docker/Makefile.include          | 29 ++++++++++++++++++++++++++---
 tests/docker/docker.py                 | 27 ++++++++++++++++++++++-----
 tests/docker/dockerfiles/travis.docker |  9 ++++++++-
 tests/docker/test-user                 | 18 ++++++++++++++++++
 4 files changed, 74 insertions(+), 9 deletions(-)
 create mode 100755 tests/docker/test-user

--
2.10.1

--
Alex Bennée

#18 lore raw
Quoted 19 lines · Alex Bennée
Quoted 16 lines · Fam Zheng
Quoted 15 lines · Alex Bennée

Hi Fam,

These are a little bit of a work in progress so maybe not all ready to be taken yet although review would be welcome.

This adds some tweaks to allow us to build the cross-arch debian images with direct make invocations and then see which images we can test against from the "make docker" help text. Now:

make docker-image-debian-stable-arm64

Will do exactly as you expect. I can't get:

make docker-test-quick@debian-stable-arm64

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

To work but I suspect this needs some fixing to the generated rules.

Comments?

Looks good, but what about binfmt_misc?

Currently the binfmt_misc check is done when the image is built (by the pre script). We could expand docker.py to check and use that?

I was just thinking that the real convenience only comes after the automated setup of binfmt_misc (or a help text in "make docker" documentation).

What do you think?

Fam