From patchwork Mon Feb 15 14:10:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 61939 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1091547lbl; Mon, 15 Feb 2016 06:11:07 -0800 (PST) X-Received: by 10.37.44.69 with SMTP id s66mr9607372ybs.25.1455545467474; Mon, 15 Feb 2016 06:11:07 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x132si12053192ywb.19.2016.02.15.06.11.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 15 Feb 2016 06:11:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dkim=fail header.i=@linaro.org Received: from localhost ([::1]:60785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVJrm-00038Q-Qr for patch@linaro.org; Mon, 15 Feb 2016 09:11:06 -0500 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type:content-transfer-encoding; bh=rLDe4RPiJ2g/kf6fEOixizWGzuraeCHwfVMxq/mJP48=; b=VSmUAh0jF6DhPs7z/V6dbeCflvKdIrsI625HWIBb/NvCXlmwi6PIdRVKmNygJcygT0 8RUaZ6t3h91j1BR/nluOdeiadvP7ipxBSgDkefOFb0SXwTYpHJmMPbo72vB+iy6MD2EH szrwwIIZ23z4+jsEhIPbi2lsMK1utzli81W/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-type :content-transfer-encoding; bh=rLDe4RPiJ2g/kf6fEOixizWGzuraeCHwfVMxq/mJP48=; b=Giv48ri5M7x5Js39RR5j6nVuuwFjvbJFkkLh7Phuvcv2i+F6t+RN9GxQgJZCL21Cqi Q3RUE/4PfKoPivQsSed9GAL1tgDqP6RUH/okLHEPmHvSuhrvo+avaX+nX0gjN+JrwtAQ PpeTCRx3Ya2Yks0if/unTb3hbsqwdkaFeFsKskHAwbG9vCzJCI1xUMwjovx30TNwWzkV 5oYPH7tqnX0wdGM83eA5VEUHspGNogo1YjHtLQutYd+00Tm3pOe5+3Bd0/RZbM2BaIlp ok2l37WxxpDLmL9U1UCp2xRluN4jfzA8ACEuZsAA0Fpd+yuilnWwI/a+G8Mp9ABre9I/ +iOw== X-Gm-Message-State: AG10YORE3h3UTNw6E0v1H5KJSGwrjCqQ0w4E5SmglxBoFCs3bUZ3dI0g0VNE3C3Yo0XQJuQv X-Received: by 10.194.71.70 with SMTP id s6mr16274467wju.1.1455545419309; Mon, 15 Feb 2016 06:10:19 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id i10sm15878426wmf.14.2016.02.15.06.10.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Feb 2016 06:10:18 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTPS id F37D13E0264; Mon, 15 Feb 2016 14:10:17 +0000 (GMT) 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> User-agent: mu4e 0.9.17; emacs 25.0.91.2 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Fam Zheng 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::235 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 Subject: Re: [Qemu-devel] [PATCH 04/12] docker: Add test runner X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 > > Fam -- 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 \