From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57182) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVJr6-0002pA-DF for qemu-devel@nongnu.org; Mon, 15 Feb 2016 09:10:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVJr2-0000rw-Bu for qemu-devel@nongnu.org; Mon, 15 Feb 2016 09:10:24 -0500 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]:36700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVJr1-0000rq-Vx for qemu-devel@nongnu.org; Mon, 15 Feb 2016 09:10:20 -0500 Received: by mail-wm0-x235.google.com with SMTP id g62so60701353wme.1 for ; Mon, 15 Feb 2016 06:10:19 -0800 (PST) References: <1454664263-25969-1-git-send-email-famz@redhat.com> <1454664263-25969-5-git-send-email-famz@redhat.com> <878u2mnsyw.fsf@linaro.org> <8760xqnnvd.fsf@linaro.org> <20160215132959.GA18222@ad.usersys.redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <20160215132959.GA18222@ad.usersys.redhat.com> Date: Mon, 15 Feb 2016 14:10:17 +0000 Message-ID: <871t8enjxy.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 04/12] docker: Add test runner List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, peter.maydell@linaro.org, sw@weilnetz.de, qemu-devel@nongnu.org, stefanha@redhat.com, Paolo Bonzini , jsnow@redhat.com, david@gibson.dropbear.id.au Fam Zheng writes: > On Mon, 02/15 12:45, Alex Bennée wrote: >> >> Alex Bennée writes: >> >> > Fam Zheng writes: >> > >> >> It's better to have a launcher for all tests, to make it easier to >> >> initialize and manage the environment. >> >> >> >> Signed-off-by: Fam Zheng >> >> --- >> >> tests/docker/run | 23 +++++++++++++++++++++++ >> >> 1 file changed, 23 insertions(+) >> >> create mode 100755 tests/docker/run >> >> >> OK that won't work if you have alternates in your git setup. It seems to >> me the creation of the pristine tree for docker should be done before we >> enter the docker environment. >> >> There is a slight wrinkle as to what happens if the user wants to enter >> an interactive session for debugging. However that doesn't seem possible >> via the makefile and perhaps that is just as well. Perhaps that should >> be a helper script for the user? > > We can use "make distclean" in the copied tree. I wouldn't - distclean isn't always that clean due to *mumble mumble* makefile reasons. You could try this approach: commit f838d3bbe2f71c731dfe172f1c3286084de203c8 Author: Alex Bennée Date: Mon Feb 15 12:52:21 2016 +0000 tests/docker/Makefile.include: snapshot the src for docker Instead of providing a live version of the source tree to the docker container we snapshot it with git-archive. This ensure the tree is in a pristine state for whatever operations the container is going to run on them. Uncommitted changes known to files known by the git index will be included in the snapshot if there are any. Signed-off-by: Alex Bennée diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index ca84c35..63a799c 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -2,7 +2,7 @@ $(if $(quiet-command),,$(eval include $(SRC_PATH)/rules.mak)) -.PHONY: docker docker-build docker-run docker-clean +.PHONY: docker docker-build docker-qemu-src docker-run docker-clean DOCKER_SUFFIX = .docker @@ -16,12 +16,17 @@ DOCKER_TOOLS := $(filter-out test-%, $(DOCKER_SCRIPTS)) TESTS ?= % IMAGES ?= % +docker-qemu-src: + $(if git diff-index --quiet HEAD --, \ + git archive -1 HEAD --prefix=qemu-docker-snapshot/ --format=tar.gz | tar -xz -C /tmp, \ + git archive -1 `git stash create` --prefix=qemu-docker-snapshot/ --format=tar.gz | tar -xz -C /tmp) + $(foreach i,$(DOCKER_IMAGES), \ $(eval docker-build: docker-build-$i) \ $(foreach t,$(DOCKER_SCRIPTS), \ $(eval docker-build-$i docker-run-$t@$i: IMAGE=$i) \ $(eval docker-run-$t@$i: SCRIPT=$t) \ - $(eval docker-run-$t@$i: docker-build-$i) \ + $(eval docker-run-$t@$i: docker-build-$i docker-qemu-src) \ $(if $(filter test-%,$t), \ $(eval docker-run: docker-run-$t@$i) \ $(eval docker-run-$t@: docker-run-$t@$i) \ @@ -74,7 +79,7 @@ docker-run-%: $(call quiet-command,\ $(SRC_PATH)/tests/docker/docker_run \ --privileged -t --rm --net=none \ - -v $$(realpath $(SRC_PATH)):/var/tmp/qemu \ + -v $$(realpath /tmp/qemu-docker-snapshot/):/var/tmp/qemu \ -e QEMU_SRC=/var/tmp/qemu \ -e V=$(V) \ -v /var/tmp/qemu-docker-ccache:/var/tmp/ccache \ > > Fam -- Alex Bennée