From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v6 04/15] Makefile: Rules for docker testing
Date: Tue, 31 May 2016 10:51:44 +0200 [thread overview]
Message-ID: <d3704ac7-0b1a-8492-84f5-ccde37efc273@redhat.com> (raw)
In-Reply-To: <20160527135437.20474-5-famz@redhat.com>
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> new file mode 100644
> index 0000000..372733d
> --- /dev/null
> +++ b/tests/docker/Makefile.include
> @@ -0,0 +1,121 @@
> +# Makefile for Docker tests
> +
> +include $(SRC_PATH)/rules.mak
Why include this _and_ include tests/docker/Makefile.include from the
top Makefile?
I think you should do one of this:
a) drop this inclusion; nice, but it pollutes the toplevel makefile a bit
b) do the following:
- link this file into the build tree in configure
- include ../../config-host.mak
- add to the toplevel Makefile a rule like
docker docker-%:
$(MAKE) -C tests/docker $@
I prefer the latter. Either would make patch 3 unnecessary.
> +.PHONY: docker docker-test docker-clean docker-image docker-qemu-src
> +
> +DOCKER_SUFFIX := .docker
> +DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
> +DOCKER_IMAGES := $(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
> +DOCKER_CCACHE_DIR := /var/tmp/qemu-docker-ccache
> +
> +DOCKER_TESTS := $(notdir $(shell \
> + find $(SRC_PATH)/tests/docker/ -name 'test-*' -type f))
> +
> +DOCKER_TOOLS := travis
> +
> +TESTS ?= %
> +IMAGES ?= %
> +SRC_COPY := $(shell mktemp -u /tmp/qemu-src.XXXXX)
This is unsafe, especially if you place it in /tmp. Something like this
should work better:
...
# do not use -p here, so that a conflict causes the build to fail
qemu-src.%:
@mkdir $@
$(call make-archive-maybe, $(SRC_PATH), $@/qemu.tgz)
$(call make-archive-maybe, $(SRC_PATH)/dtc, $@/dtc.tgz)
$(call make-archive-maybe, $(SRC_PATH)/pixman, $@/pixman.tgz)
$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
" COPY RUNNER")
CUR_TIME = $(shell date +%Y-%m-%d-%H.%M.%S)
# Makes the definition constant after the first expansion
SRC_COPY = $(eval SRC_COPY := qemu-src.$(CUR_TIME))$(SRC_COPY)
# Perhaps creating a symlink to the latest src tree can be useful?
docker-qemu-src:
$(MAKE) $(SRC_COPY)
ln -sf $(SRC_COPY) qemu-src
Thanks,
Paolo
> +docker-run-%: docker-qemu-src
> + @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,\
> + $(SRC_PATH)/tests/docker/docker.py run $(if $V,,--rm) \
> + -t \
> + $(if $(DEBUG),-i,--net=none) \
> + -e TARGET_LIST=$(TARGET_LIST) \
> + -e V=$V -e J=$J -e DEBUG=$(DEBUG)\
> + -e CCACHE_DIR=/var/tmp/ccache \
> + -v $$(realpath $(SRC_COPY)):/var/tmp/qemu:z$(COMMA)ro \
> + -v $(DOCKER_CCACHE_DIR):/var/tmp/ccache:z \
> + -w /var/tmp/qemu \
> + qemu:$(IMAGE) \
> + $(if $V,/bin/bash -x ,) \
> + ./run \
> + $(CMD); \
> + , " RUN $(CMD) in $(IMAGE)")))
> +
> +docker-clean:
> + $(call quiet-command, $(SRC_PATH)/tests/docker/docker.py clean)
>
next prev parent reply other threads:[~2016-05-31 8:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-27 13:54 [Qemu-devel] [PATCH v6 00/15] tests: Introducing docker tests Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 01/15] tests: Add utilities for docker testing Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 02/15] rules.mak: Add "COMMA" constant Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 03/15] rules.mak: Avoid double include Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 04/15] Makefile: Rules for docker testing Fam Zheng
2016-05-31 8:51 ` Paolo Bonzini [this message]
2016-05-31 11:00 ` Fam Zheng
2016-05-31 12:02 ` Paolo Bonzini
2016-05-31 12:40 ` Fam Zheng
2016-05-31 12:48 ` Paolo Bonzini
2016-06-01 2:26 ` Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 05/15] docker: Add images Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 06/15] docker: Add test runner Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 07/15] docker: Add common.rc Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 08/15] docker: Add quick test Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 09/15] docker: Add full test Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 10/15] docker: Add clang test Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 11/15] docker: Add mingw test Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 12/15] docker: Add travis tool Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 13/15] docs: Add text for tests/docker in build-system.txt Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 14/15] docker: Add EXTRA_CONFIGURE_OPTS Fam Zheng
2016-05-27 13:54 ` [Qemu-devel] [PATCH v6 15/15] MAINTAINERS: Add tests/docker 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=d3704ac7-0b1a-8492-84f5-ccde37efc273@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=famz@redhat.com \
--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).