From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7fP1-0001dG-Uo for qemu-devel@nongnu.org; Tue, 31 May 2016 04:51:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7fOw-0008RV-UH for qemu-devel@nongnu.org; Tue, 31 May 2016 04:51:54 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7fOw-0008RL-64 for qemu-devel@nongnu.org; Tue, 31 May 2016 04:51:50 -0400 Received: by mail-wm0-x241.google.com with SMTP id e3so30269203wme.2 for ; Tue, 31 May 2016 01:51:49 -0700 (PDT) Sender: Paolo Bonzini References: <20160527135437.20474-1-famz@redhat.com> <20160527135437.20474-5-famz@redhat.com> From: Paolo Bonzini Message-ID: Date: Tue, 31 May 2016 10:51:44 +0200 MIME-Version: 1.0 In-Reply-To: <20160527135437.20474-5-famz@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v6 04/15] Makefile: Rules for docker testing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: =?UTF-8?Q?Alex_Benn=c3=a9e?= > 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) >