From patchwork Fri Jun 8 12:33:00 2018 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: 138053 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp929335lji; Fri, 8 Jun 2018 07:16:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK+8PHSQjoj9c6qz+SneyH9FQWTAffGUXXGvjuykW1z/n2Jd4KmGDGGovvP7g7ZNR0bTS+8 X-Received: by 2002:a37:295:: with SMTP id v21-v6mr5243765qkg.437.1528467383360; Fri, 08 Jun 2018 07:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528467383; cv=none; d=google.com; s=arc-20160816; b=cX2JsC3oeTuhG41baAXE8okIbnasQirJ9T+l+ueniGAf5AMsUOCjZpETgJc8+65tPh tY+2kq60nQ+UQ8tHGADxluschBb+tmpRYasvocNBD9x2bhnvU1gfqKIyK28p2eA+/m9X WZDH87nj4jGH0dadPWC7xyKHMrtDWWeYJwEGEHIrRE1Gj7ocqwNgLImd2sIxeTB2BXfM w7w88b1LyNrYzZle1WSp05IBzCd3FBIwHpmnCFENDYULUA8x3Lh/6mWMiVGuZUbHCsY5 f39zgcYV1W20JfxhQ0VvV4u8MLzm0Mc+A1DJRITgz4EksWDCoqrmyqSAL5reI9x//H4i coTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=OJjV/YEsNk4B59xUm9iBF3ttHMQZkS322dgmqaimYrE=; b=RZV838gVMv8+ujO8AgZvlkihJNujWkilPyvW+BLD05JJKNgbloSs/UaaZHHENbdrTB ar9xmaZimh+hAer8B+fivxWizQBhcdBN+HUykMKZsfhM4qRQAypq2mZK70LgyweVGKoc Zy+hQGW7cvBDOphZPC6F56FRlmwGhog8EEpY5/MR94hM2OqSmwq5aCnyZ7mlnllUTKt9 QnIa57FAQo/ZT7KQLDeTemAJrBXAV8dnoXifqBM/m8Bpkz/Tj/CALS0NklLuVVauVXpT z5wE88xLD1++EFci2XTtM0qmXckNQ+geqPUUY9BLxULPnzBHIRLs8/GHY42549lvq08p 8eWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=hJxot3gN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id a189-v6si5476482qkc.229.2018.06.08.07.16.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Jun 2018 07:16:23 -0700 (PDT) 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; dkim=fail header.i=@linaro.org header.s=google header.b=hJxot3gN; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRIBi-0003P8-Q1 for patch@linaro.org; Fri, 08 Jun 2018 10:16:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRH8k-0005oS-21 for qemu-devel@nongnu.org; Fri, 08 Jun 2018 09:09:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRH8g-0006oQ-Q3 for qemu-devel@nongnu.org; Fri, 08 Jun 2018 09:09:14 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:41100) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRH8g-0006oE-Fd for qemu-devel@nongnu.org; Fri, 08 Jun 2018 09:09:10 -0400 Received: by mail-wr0-x243.google.com with SMTP id h10-v6so13333244wrq.8 for ; Fri, 08 Jun 2018 06:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OJjV/YEsNk4B59xUm9iBF3ttHMQZkS322dgmqaimYrE=; b=hJxot3gNuIvhGZgoiY+ACIiVl7HVibCzQtgpAACH44ljAbRFFMh05P9LXocKEVSC8Q EpGUGGrFqFNcOdFVb2r+sW9XsTnEsTBCganJDL6BHzdYrsofFByDfrBqUJQb4QXoGBp0 c7yemE9WQaVIrvZuarpd/58tko1ZTIWj5dROk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OJjV/YEsNk4B59xUm9iBF3ttHMQZkS322dgmqaimYrE=; b=E4cgp+VME2KBcoZsaR8t5oox06+HToUg05yLV13NaP4Xlh8INqghPD+L8zo9sZq4Rc P7a4CuLlmOarOKH/ecQ4afB32RYdy6gJnefSUqMTe8tC9D8LgEwFeHsMFuA8Tz4tMJtQ j9SO9e3F/GjQ8h9Lddz5AL45YyBRhYWG4/k4HFb7k8bp8kW4zw/2ta4Ty3jXcnFSf0pT VDr4DPElud99fEw4N0z4551FNE7f7aZWe8hWsrkDQvn4oXdKh3CIxZDpUahjlpyHx0C/ qQjp2ka60WSPw9sCBt7RQ7hFImwru2GxOyyNvP3Nnees6RStUUzXQN0zSl19QGngfi2N YwRw== X-Gm-Message-State: APt69E1/yBgZUWIrWlW58CuKKBeA2QXfYMqyZu96WVh6l6yrZEAVFMhS LzUJgyi9Em38cMqrpO0a3Zq9Xw== X-Received: by 2002:adf:d4c5:: with SMTP id w5-v6mr4823816wrk.185.1528463349445; Fri, 08 Jun 2018 06:09:09 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id j4-v6sm4633704wrr.47.2018.06.08.06.09.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jun 2018 06:09:08 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id CAEA73E0D58; Fri, 8 Jun 2018 13:33:10 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: cota@braap.org, famz@redhat.com, berrange@redhat.com, f4bug@amsat.org, richard.henderson@linaro.org, balrogg@gmail.com, aurelien@aurel32.net, agraf@suse.de, pbonzini@redhat.com, stefanha@redhat.com, stefanb@linux.vnet.ibm.com, marcandre.lureau@redhat.com Date: Fri, 8 Jun 2018 13:33:00 +0100 Message-Id: <20180608123307.24773-43-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180608123307.24773-1-alex.bennee@linaro.org> References: <20180608123307.24773-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PATCH v6 42/49] Makefile.target: add (clean-/build-)guest-tests targets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Now all the build infrastructure is in place we can build tests for each guest that we support. That support mainly depends on having cross compilers installed or docker setup. To keep all the logic for that together we put the rules in tests/tcg/Makefile.include and include it from the main Makefile.target. Signed-off-by: Alex Bennée --- v4 - pulled Makefile.include bits from next patch - added qemu-$(TARGET_NAME) dependency for running tests - accept SPEED parameter to run slow tests - pass BUILD_STATIC - update MAINTAINERS v6 - bare make -> $(MAKE) for sub-makes --- MAINTAINERS | 1 + Makefile.target | 5 +++ tests/tcg/Makefile.include | 88 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 tests/tcg/Makefile.include -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé diff --git a/MAINTAINERS b/MAINTAINERS index 4761f8cab4..6c1eca3a1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2147,6 +2147,7 @@ W: http://patchew.org/QEMU/ Guest Test Compilation Support M: Alex Bennée F: tests/tcg/Makefile +F: tests/tcg/Makefile.include L: qemu-devel@nongnu.org Documentation diff --git a/Makefile.target b/Makefile.target index dad2cf8778..a9d8928f96 100644 --- a/Makefile.target +++ b/Makefile.target @@ -36,6 +36,11 @@ endif PROGS=$(QEMU_PROG) $(QEMU_PROGW) STPFILES= +# Makefile Tests +ifdef CONFIG_USER_ONLY +include $(SRC_PATH)/tests/tcg/Makefile.include +endif + config-target.h: config-target.h-timestamp config-target.h-timestamp: config-target.mak diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include new file mode 100644 index 0000000000..4851df0951 --- /dev/null +++ b/tests/tcg/Makefile.include @@ -0,0 +1,88 @@ +# -*- Mode: makefile -*- +# +# TCG tests (per-target rules) +# +# This Makefile fragement is included from the per-target +# Makefile.target so will be invoked for each linux-user program we +# build. We have two options for compiling, either using a configured +# guest compiler or calling one of our docker images to do it for us. +# + +# The per ARCH makefile, if it exists, holds extra information about +# useful docker images or alternative compiler flags. + +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include + +GUEST_BUILD= +TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile +# Support installed Cross Compilers + +ifdef CROSS_CC_GUEST + +.PHONY: cross-build-guest-tests +cross-build-guest-tests: + $(call quiet-command, \ + (mkdir -p tests && cd tests && \ + $(MAKE) -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \ + BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \ + EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \ + "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)") + +GUEST_BUILD=cross-build-guest-tests + +endif + +# Support building with Docker + +ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y) +ifneq ($(DOCKER_IMAGE),) + +# We also need the Docker make rules to depend on +include $(SRC_PATH)/tests/docker/Makefile.include + +DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \ + --cc $(DOCKER_CROSS_COMPILER) \ + -i qemu:$(DOCKER_IMAGE) \ + -s $(SRC_PATH) -- " +DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE) + +.PHONY: docker-build-guest-tests +docker-build-guest-tests: $(DOCKER_PREREQ) + $(call quiet-command, \ + (mkdir -p tests && cd tests && \ + $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \ + BUILD_STATIC=y \ + EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \ + "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)") + +GUEST_BUILD=docker-build-guest-tests + +endif +endif + +# Final targets +.PHONY: guest-tests + +ifneq ($(GUEST_BUILD),) +guest-tests: $(GUEST_BUILD) + +run-guest-tests: guest-tests qemu-$(TARGET_NAME) + $(call quiet-command, \ + (cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \ + "RUN-TESTS", "for $(TARGET_NAME)") + +else +guest-tests: + $(call quiet-command, /bin/true, "CROSS-BUILD", \ + "$(TARGET_NAME) guest-tests SKIPPED") + +run-guest-tests: + $(call quiet-command, /bin/true, "RUN-TESTS", \ + "for $(TARGET_NAME) SKIPPED") +endif + +# It doesn't mater if these don't exits +.PHONY: clean-guest-tests +clean-guest-tests: + rm -rf tests || echo "no $(TARGET_NAME) tests to remove"