From: "Alex Bennée" <alex.bennee@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PULL 4/4] tests/docker/Makefile.include: add a generic docker-run target
Date: Sat, 15 Oct 2016 15:48:09 +0100 [thread overview]
Message-ID: <87wph91xee.fsf@linaro.org> (raw)
In-Reply-To: <708bf751-35b6-330e-7c9c-72e7d8741fdd@redhat.com>
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 14/10/2016 17:29, Fam Zheng wrote:
>> From: Alex Bennée <alex.bennee@linaro.org>
>>
>> This re-factors the docker makefile to include a docker-run target which
>> can be controlled entirely from environment variables specified on the
>> make command line. This allows us to run against any given docker image
>> we may have in our repository, for example:
>>
>> make docker-run TEST="test-quick" IMAGE="debian:arm64" \
>> EXECUTABLE=./aarch64-linux-user/qemu-aarch64
>>
>> The existing docker-foo@bar targets still work but the inline
>> verification has been dropped because we already don't hit that due to
>> other pattern rules in rules.mak.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> Message-Id: <20161011161625.9070-5-alex.bennee@linaro.org>
>> Message-Id: <20161011161625.9070-6-alex.bennee@linaro.org>
>> [Squash in the verification removal patch. - Fam]
>> Signed-off-by: Fam Zheng <famz@redhat.com>
>> ---
>> tests/docker/Makefile.include | 61 +++++++++++++++++++++++++++----------------
>> 1 file changed, 38 insertions(+), 23 deletions(-)
>>
>> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
>> index b44daab..925f711 100644
>> --- a/tests/docker/Makefile.include
>> +++ b/tests/docker/Makefile.include
>> @@ -78,6 +78,7 @@ docker:
>> @echo ' "IMAGE" is one of the listed container name."'
>> @echo ' docker-image: Build all images.'
>> @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)'
>> @@ -101,31 +102,45 @@ docker:
>> @echo ' NOCACHE=1 Ignore cache when build images.'
>> @echo ' EXECUTABLE=<path> Include executable in image.'
>>
>> +# 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.
>> +#
>> +# For example: make docker-run TEST="test-quick" IMAGE="debian:arm64" EXECUTABLE=./aarch64-linux-user/qemu-aarch64
>> +#
>> +docker-run: docker-qemu-src
>> + @mkdir -p "$(DOCKER_CCACHE_DIR)"
>> + @if test -z "$(IMAGE)" || test -z "$(TEST)"; \
>> + then echo "Invalid target $(IMAGE)/$(TEST)"; exit 1; \
>> + fi
>> + $(if $(EXECUTABLE), \
>> + $(call quiet-command, \
>> + $(SRC_PATH)/tests/docker/docker.py update \
>> + $(IMAGE) $(EXECUTABLE), \
>> + " COPYING $(EXECUTABLE) to $(IMAGE)"))
>> + $(call quiet-command, \
>> + $(SRC_PATH)/tests/docker/docker.py run \
>> + -t \
>> + $(if $V,,--rm) \
>> + $(if $(DEBUG),-i,--net=none) \
>> + -e TARGET_LIST=$(TARGET_LIST) \
>> + -e EXTRA_CONFIGURE_OPTS="$(EXTRA_CONFIGURE_OPTS)" \
>> + -e V=$V -e J=$J -e DEBUG=$(DEBUG) \
>> + -e SHOW_ENV=$(SHOW_ENV) \
>> + -e CCACHE_DIR=/var/tmp/ccache \
>> + -v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
>> + -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
>> + $(IMAGE) \
>> + /var/tmp/qemu/run \
>> + $(TEST), " RUN $(TEST) in ${IMAGE}")
>> +
>> +# 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-%: docker-qemu-src
>> - @mkdir -p "$(DOCKER_CCACHE_DIR)"
>> - @if test -z "$(IMAGE)" || test -z "$(CMD)"; \
>> - then echo "Invalid target"; exit 1; \
>> - fi
>> - $(if $(filter $(TESTS),$(CMD)),$(if $(filter $(IMAGES),$(IMAGE)), \
>> - $(call quiet-command,\
>> - if $(SRC_PATH)/tests/docker/docker.py images | \
>> - awk '$$1=="qemu" && $$2=="$(IMAGE)"{found=1} END{exit(!found)}'; then \
>> - $(SRC_PATH)/tests/docker/docker.py run $(if $V,,--rm) \
>> - -t \
>> - $(if $(DEBUG),-i,--net=none) \
>> - -e TARGET_LIST=$(TARGET_LIST) \
>> - -e EXTRA_CONFIGURE_OPTS=$(EXTRA_CONFIGURE_OPTS) \
>> - -e V=$V -e J=$J -e DEBUG=$(DEBUG) -e SHOW_ENV=$(SHOW_ENV)\
>> - -e CCACHE_DIR=/var/tmp/ccache \
>> - -v $$(readlink -e $(DOCKER_SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
>> - -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
>> - qemu:$(IMAGE) \
>> - /var/tmp/qemu/run \
>> - $(CMD); \
>> - fi \
>> - ,"RUN","$(CMD) in $(IMAGE)")))
>> +docker-run-%:
>> + @make docker-run TEST=$(CMD) IMAGE=qemu:$(IMAGE)
>
> This "make" should be $(MAKE), so that some parameters are handled
> correctly (e.g. -n/--dry-run) and especially so that parallel make works
> correctly.
Fam,
Do you want me to re-spin and re-send or are you going to fix up in your
pull request?
>
> Thanks,
>
> Paolo
>
>> docker-clean:
>> $(call quiet-command, $(SRC_PATH)/tests/docker/docker.py clean)
>>
--
Alex Bennée
next prev parent reply other threads:[~2016-10-15 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 15:29 [Qemu-devel] [PULL 0/4] Docker testing patches Fam Zheng
2016-10-14 15:29 ` [Qemu-devel] [PULL 1/4] tests/docker: add travis dockerfile Fam Zheng
2016-10-14 15:29 ` [Qemu-devel] [PULL 2/4] tests/docker: test-build script Fam Zheng
2016-10-14 15:29 ` [Qemu-devel] [PULL 3/4] tests/docker: make test-mingw honour TARGET_LIST Fam Zheng
2016-10-14 15:29 ` [Qemu-devel] [PULL 4/4] tests/docker/Makefile.include: add a generic docker-run target Fam Zheng
2016-10-15 13:51 ` Paolo Bonzini
2016-10-15 14:48 ` Alex Bennée [this message]
2016-10-17 2:03 ` Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wph91xee.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).