From patchwork Tue Apr 10 19:38:55 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: 133097 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1633819ljb; Tue, 10 Apr 2018 12:42:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx48bx675XM615mZImcJq5uygiyHe2rI0aJ5/RDA+7NCFY761Fzzzn9Hd0l+G/ye5XK7PvXUb X-Received: by 10.55.33.226 with SMTP id f95mr2577250qki.320.1523389357264; Tue, 10 Apr 2018 12:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523389357; cv=none; d=google.com; s=arc-20160816; b=xXbH3m2LEFm57akB00UJuLJyEjAtgoZjcXKMqWDqFhuEZRtExXbkj8uwFnTDhcGD8j J82JnRlMg1Vl0++F/5VFh/3n+9n8NH5KagODbPpf0lpQ3S3tYGToel0NeLQeito8fBkA EY3LcHQWV8Cht4d0FsRqqJNjUSpElVwd/BdVwbZr+cr5423XMUzuJWV/1XpEFrFX4JyY QCUPYRJujoo9jpfejAZI1ob9N3wmnUaw9FLo9rH3RT5rZyaJhCk00WuPBWZBIz4xuf5y E3hGvkrQstSBTaQ4e2kX0MUHsZuOPqHjyDsvIo/eJST2k8XApja9R5v5q8cKKXoBmdim N7Rw== 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:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=GCqXUQ9rM0wB3rcDVgBg5pfV9FrX4GgZ1wqicUB2ZSI=; b=rIRvEjBS654pWGGjzuEixPxktaJCaLACax6+LzKS/GNEHVySzrkAHdCulEC/b7L+XZ KQnZsswIwirQRbPld1Spxv3Kjw/ysCS7JwKfLVyjgsARg1bgP0wYotCWbV1lid0t725r RwfiA2gxQsA9g+rqvNog4ewsiEU5WNX8YzS4ZLIk+8dIrC2pRKqN0h+HUhsMsjqdEtYZ gMPUjSO8MthTy75kXQZQbFddjFbKONq+IwghQf+VvdMNf98qCd5k3aY7TunCdA6229Qz esBr+Cy14R0shKwNBLDtGxC/sPMUPQzW60Hqq/D72WTV2yZeJlJbKqvCQ/2pXzmCGS5P Dqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=H/jz6GN6; 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 95si1147735qkz.240.2018.04.10.12.42.37 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Apr 2018 12:42:37 -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=H/jz6GN6; 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]:39696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5zA4-0001sI-Md for patch@linaro.org; Tue, 10 Apr 2018 15:42:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f5z6z-000058-Aj for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f5z6w-0006EX-5j for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:25 -0400 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]:35788) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f5z6v-0006Dp-RM for qemu-devel@nongnu.org; Tue, 10 Apr 2018 15:39:22 -0400 Received: by mail-wr0-x236.google.com with SMTP id o3so1625787wri.2 for ; Tue, 10 Apr 2018 12:39:21 -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:mime-version :content-transfer-encoding; bh=GCqXUQ9rM0wB3rcDVgBg5pfV9FrX4GgZ1wqicUB2ZSI=; b=H/jz6GN6McZpSjXvWjljyAdFZbnnVe76TIOKpdo/7PGdxXM5qzZ1Z15pBhBYPjSyrC R16nFIGeONGFW9JzFK8FNuyF8kxmr27vZCz4NrUGTEkli5cjj8+UYsMqjGiurx83NZnS oIG6uDuF0yTv9BcKMS1efGstLh1ALq0AtrgtU= 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:mime-version :content-transfer-encoding; bh=GCqXUQ9rM0wB3rcDVgBg5pfV9FrX4GgZ1wqicUB2ZSI=; b=ZyOmkYJtoxNqBD0VXbo4LWVar9LD/UwCMmWvOt3pt7zL0qMnyjRnnCOwx/pT9asV1l 9umSRNWEiQzWeIH9WJ/DA6OCjD9BrcKW+/Si7vbphdrWNi7YnLW+l8dsJtSnCKkooBNb XrbY0e7Fv6UUHLA7ViVK1Jm0WvIz/EIB/7KRKdBJ+jsvZ/pPF3UKJPpstN9B9zgL4xyR FVP2x2H320k99Gw86jYP8gn7HfvU3XgfaWYC7j/02U+dCshkk0NhCcNgrmUfi36Y4BqH TG4MIginpQoit+OqXd8n3+v3JzkZuBRLgSmpEu6v0YIY0KyNeFrb5tZPSKw43pMPB40c GhZw== X-Gm-Message-State: ALQs6tDOhr0cbr5rbCwP9Xw79HhkWPPa4PVLqACrBAW1zRPwSzjmPCfy +QfEB0YJyu+s02+JRPwex9KSPA== X-Received: by 10.223.155.154 with SMTP id d26mr1432239wrc.8.1523389160567; Tue, 10 Apr 2018 12:39:20 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u44sm3200977wrb.67.2018.04.10.12.39.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 12:39:19 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 647CE3E021D; Tue, 10 Apr 2018 20:39:19 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 10 Apr 2018 20:38:55 +0100 Message-Id: <20180410193919.28026-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.16.2 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::236 Subject: [Qemu-devel] [PATCH v1 00/24] fix building of tests/tcg 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?= , famz@redhat.com, cota@braap.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Hi, We've talked about fixing this up for a long time and there have been several RFC patches sent attempting to do that. This is yet another RFC but hopefully shows a way forward which can build on our docker support but also allow users to specify their own guest cross compilers. So far I've built arm, aarch64, ppc64 and s390x but adding support for additional guests is simple, especially if we already have a docker cross compile setup. I've weeded out any tests that linked with QEMU (testpath) and reduced the expectations of any tests/tcg test to just having access to libc. This is the lowest common denominator for anything that can reasonably be called a cross compiler. The tests are all aimed at linux-user targets. We could probably come up with something for building bare-metal softmmu tests but I suspect that might be better served by using a different mechanism to import existing tests into our build (e.g. kvm-unit-tests). Let's breakdown the series: configure: As we need make magic we move the detection of docker and cross compilers into configure. If any cross compiler is detected for a given target we set CROSS_CC_GUEST in each config-target.mak. A functioning cross compiler takes precedence over the docker fallback. I think this makes sense for individual target sub-maintainers as they likely already have a cross compile setup. For docker we only set HAVE_USER_DOCKER in config-host.mak if the user can run docker without sudo. We still need match up a docker image and compiler once we build. This is handled by tests/tcg/$(ARCH)/Makefile.include. docker: I've extended Fam's original patches to allow a bit more flexibility for the "cc" command. I'm not overly wedded to using the docker.py wrapper, we could just construct the command directly in Make if we wanted to. tests/tcg: The top of the tree has been cleared out and everything moved into sub-directories. There is a new multiarch sub-directory which is built for every linux-user guest that has compiler support. Additional tests are then included from tests/tcg/$(ARCH)/*.c or manually added/modified by tests/tcg/$(ARCH)/Makefile.target. Makefile: As we are building tests/tcg for each target so Makefile.target now invokes a sub-make with tests/tcg/Makefile while in the appropriate build directory $(ARCH)-linux-user/tests/. The check-tcg and clean-tcg targets unroll into all the configured FOO-linux-user targets and will build the tests if cross compilation is available, otherwise the build is skipped without failing the make. Running tests: Currently this is done manually from the build directory: ./qemu-arm tests/hello-arm However once we have everything converted it shouldn't be too hard to plumb into the normal make check sequence. So what do people think? Is this a viable way to go forward? Alex Bennée (20): configure: add test for docker availability configure: add support for --cross-cc-FOO configure: move i386_cc to cross_cc_i386 docker: extend "cc" command to accept compiler docker: allow "cc" command to run in user context docker: Makefile.include introduce DOCKER_SCRIPT tests/tcg: move architecture independent tests into subdir tests/tcg: move i386 specific tests into subdir tests/tcg/i386: move test-i386-sse.c to tests/tcg/x86_64/test-sse.c tests/tcg/i386: fix test-i386 tests/tcg/i368: fix hello-i386 tests/tcg/i386: fix test-i386-fprem tests/tcg: move ARM specific tests into subdir tests/tcg/arm: fix hello-arm tests/tcg: move MIPS specific tests into subdir tests/tcg: enable building for s390x tests/tcg: enable building for ppc64 tests/tcg/Makefile: update to be called from Makefile.target Makefile.target: add (clean-)guest-tests targets tests/Makefile.include: add (clean-)check-tcg targets Fam Zheng (4): Makefile: Rename TARGET_DIRS to TARGET_LIST docker: Add "cc" subcommand tests/tcg/multiarch: Build fix for linux-test tests/tcg/i386: Build fix for hello-i386 Makefile | 20 +-- Makefile.target | 5 + configure | 92 +++++++++- scripts/create_config | 2 +- tests/Makefile.include | 21 ++- tests/docker/Makefile.include | 10 +- tests/docker/docker.py | 40 +++++ tests/tcg/Makefile | 185 +++++---------------- tests/tcg/Makefile.include | 79 +++++++++ tests/tcg/README | 69 +------- tests/tcg/arm/Makefile.target | 6 + tests/tcg/arm/README | 11 ++ tests/tcg/{ => arm}/hello-arm.c | 0 tests/tcg/{ => arm}/test-arm-iwmmxt.s | 0 tests/tcg/i386/Makefile.target | 35 ++++ tests/tcg/i386/README | 38 +++++ tests/tcg/{ => i386}/hello-i386.c | 1 + tests/tcg/{ => i386}/pi_10.com | Bin tests/tcg/{ => i386}/runcom.c | 0 tests/tcg/{ => i386}/test-i386-code16.S | 0 tests/tcg/{ => i386}/test-i386-fprem.c | 9 +- tests/tcg/{ => i386}/test-i386-muldiv.h | 0 tests/tcg/{ => i386}/test-i386-shift.h | 0 tests/tcg/{ => i386}/test-i386-vm86.S | 0 tests/tcg/{ => i386}/test-i386.c | 1 - tests/tcg/{ => i386}/test-i386.h | 0 tests/tcg/mips/README | 7 + tests/tcg/{ => mips}/hello-mips.c | 0 tests/tcg/multiarch/README | 1 + tests/tcg/{ => multiarch}/linux-test.c | 68 +++----- tests/tcg/{ => multiarch}/sha1.c | 0 tests/tcg/{ => multiarch}/test-mmap.c | 0 tests/tcg/{ => multiarch}/testthread.c | 0 tests/tcg/ppc64/Makefile.include | 2 + tests/tcg/s390x/Makefile.include | 2 + tests/tcg/test_path.c | 157 ----------------- tests/tcg/{test-i386-ssse3.c => x86_64/test-sse.c} | 6 +- 37 files changed, 424 insertions(+), 443 deletions(-) create mode 100644 tests/tcg/Makefile.include create mode 100644 tests/tcg/arm/Makefile.target create mode 100644 tests/tcg/arm/README rename tests/tcg/{ => arm}/hello-arm.c (100%) rename tests/tcg/{ => arm}/test-arm-iwmmxt.s (100%) create mode 100644 tests/tcg/i386/Makefile.target create mode 100644 tests/tcg/i386/README rename tests/tcg/{ => i386}/hello-i386.c (96%) rename tests/tcg/{ => i386}/pi_10.com (100%) rename tests/tcg/{ => i386}/runcom.c (100%) rename tests/tcg/{ => i386}/test-i386-code16.S (100%) rename tests/tcg/{ => i386}/test-i386-fprem.c (98%) rename tests/tcg/{ => i386}/test-i386-muldiv.h (100%) rename tests/tcg/{ => i386}/test-i386-shift.h (100%) rename tests/tcg/{ => i386}/test-i386-vm86.S (100%) rename tests/tcg/{ => i386}/test-i386.c (99%) rename tests/tcg/{ => i386}/test-i386.h (100%) create mode 100644 tests/tcg/mips/README rename tests/tcg/{ => mips}/hello-mips.c (100%) create mode 100644 tests/tcg/multiarch/README rename tests/tcg/{ => multiarch}/linux-test.c (91%) rename tests/tcg/{ => multiarch}/sha1.c (100%) rename tests/tcg/{ => multiarch}/test-mmap.c (100%) rename tests/tcg/{ => multiarch}/testthread.c (100%) create mode 100644 tests/tcg/ppc64/Makefile.include create mode 100644 tests/tcg/s390x/Makefile.include delete mode 100644 tests/tcg/test_path.c rename tests/tcg/{test-i386-ssse3.c => x86_64/test-sse.c} (93%) -- 2.16.2