Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp101970rdg; Tue, 10 Oct 2023 05:35:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHxMl/ES0N7kMQdgjYoIfhZ/E+/eGWRsZWqBR5TkhF1qZnUMbTUC1L5uUNPsi/d5vybpgNv X-Received: by 2002:a05:6e02:b22:b0:351:9cc:8775 with SMTP id e2-20020a056e020b2200b0035109cc8775mr22802219ilu.5.1696941311140; Tue, 10 Oct 2023 05:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696941311; cv=none; d=google.com; s=arc-20160816; b=kcCKaTM0u5d8weg819odKgLYlgqcoI1nPzlXUooSH155KDJ4Ml75xfbiodlFFHBwV/ XuxC9zoWj6vuZj7kNpCJ4RBWizO7UaLCRXwzzYC4Zt908ipt9/F8nSi/r2bxUyOZOIFS Zi5Vg49lJphO0bk6H/S5R3gM2r3i6HD0unpvbeit5lCWqz/D1bJqOX+Z9vQfws09dVer 8ul4DEOPjIL+15c190Nyd9mBLM2cOdWxVOFoJZm688FuiJlo/rK79mZyKaH3qdI/Ax9B OBCHuifkTv0jESAAxgWS4uD7o/d5Np5FxcnCcNGXjJZaNeS3L0HlvrUHZ0Fr1Q/rXCBT BITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=In4gUVwURmIwci2x6H7ymRaBvVgwy9xqwDbZQVhS3nE=; fh=9sqEKGXuwAA9c0V9ZXRADQA4HhJpzxYAPqBLFba1wk4=; b=JSJ8cD3o+/19I6srkwMObL+WI/bq1oNMiSXIFUK9WccOyz31rhEP/NYU/EDgesfifq kVa2McU+sQaSM0z9W6sRx6cYi9F7cRMOUHIQAqXqbPQkGTPiVtkBPfRdrL7RqqgqfJsQ 3dp83+b31ZO8cGOOOq6OOiOwyOk17+nk2JDEfEnZyRVyjQ6jT91bF+Kl+jmRxmVu3ICh ZRg6didUxiMaF71ER15G4wTVCzBa+G1khK6TxBpp9ORaFt4WoQH8Q/DC3mMxsBATRPdY XFkXtT/1rfigR8lpvJxHHq8xcPY1JPeVIyhLNnfTqGPwL4zgBQ/K2LPByW3doiov+1x/ Z7Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=VEUfNKVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id s63-20020a632c42000000b00578d71884b4si11509107pgs.194.2023.10.10.05.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:35:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=VEUfNKVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 36857801CB71; Tue, 10 Oct 2023 05:35:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbjJJMe2 (ORCPT + 99 others); Tue, 10 Oct 2023 08:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbjJJMeR (ORCPT ); Tue, 10 Oct 2023 08:34:17 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00A8C11B; Tue, 10 Oct 2023 05:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1696941245; bh=WxAUHJdppCeTHqWPxWpmIL5UmHFcwDBRqVdmTVlGl0U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VEUfNKVPa1jAF4dH/OyzXoKzbUul33LreA4uDaGopOnVixMFIEsnEKf8w1zTyA67o /BVTpB6u1/jw6W6yJ1YCcXJ4B1sCMEI9PZSMbCTZ3PHO2mRm97tRQKb9dpdpq4Ytw5 K6BpTXC/OwCtATJeHVQqXe0Za+nn2ObdUIEJ/VOM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Tue, 10 Oct 2023 14:33:59 +0200 Subject: [PATCH 4/5] selftests/nolibc: support out-of-tree builds MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231010-nolibc-out-of-tree-v1-4-b6a263859596@weissschuh.net> References: <20231010-nolibc-out-of-tree-v1-0-b6a263859596@weissschuh.net> In-Reply-To: <20231010-nolibc-out-of-tree-v1-0-b6a263859596@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: Zhangjin Wu , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1696941244; l=3951; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=WxAUHJdppCeTHqWPxWpmIL5UmHFcwDBRqVdmTVlGl0U=; b=/UOEch0A9EzSGr6yYRgdHzLhXIl9y7lRmAKNd1nuNPkIzI2sd3nn09koPBt6Crej7vYWswndr lGWQRved7EQCJ2CVmPRuAkpL/QjE2k/JMU3S/GKy7DF/1OGERqN19YQ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:35:05 -0700 (PDT) X-Spam-Level: ** Out of tree builds are much more convenient when building for multiple architectures or configurations in parallel. Only absolute O= parameters are supported as Makefile.include will always resolve relative paths in relation to $(srctree) instead of the current directory. Add a call to "make outputmakefile" to verify that the sourcetree is clean. This is based on Zhangjins out-of-tree patch. It extends that work for get_init_cpio support and also drops relative O= specifications explicitly. Link: https://lore.kernel.org/lkml/06d96bd81fe812a9718098a383678ad3beba98b1.1691215074.git.falcon@tinylab.org/ Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 598d53c5cb7b..21e3f7da2ecf 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -1,9 +1,16 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for nolibc tests include ../../../scripts/Makefile.include +include ../../../scripts/utilities.mak # We need this for the "cc-option" macro. include ../../../build/Build.include +ifneq ($(O),) +ifneq ($(call is-absolute,$(O)),y) +$(error Only absolute O= parameters are supported) +endif +endif + # we're in ".../tools/testing/selftests/nolibc" ifeq ($(srctree),) srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) @@ -14,6 +21,8 @@ include $(srctree)/scripts/subarch.include ARCH = $(SUBARCH) endif +objtree ?= $(srctree) + # XARCH extends the kernel's ARCH with a few variants of the same # architecture that only differ by the configuration, the toolchain # and the Qemu program used. It is copied as-is into ARCH except for @@ -52,7 +61,7 @@ IMAGE_ppc64le = arch/powerpc/boot/zImage IMAGE_riscv = arch/riscv/boot/Image IMAGE_s390 = arch/s390/boot/bzImage IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi -IMAGE = $(IMAGE_$(XARCH)) +IMAGE = $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # default kernel configurations that appear to be usable @@ -167,6 +176,7 @@ sysroot: sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot + $(Q)$(MAKE) -C $(srctree) outputmakefile $(Q)$(MAKE) -C $(srctree)/tools/include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) @@ -199,7 +209,7 @@ run-user: nolibc-test $(Q)$(REPORT) $(CURDIR)/run.out initramfs.cpio: kernel nolibc-test - $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(srctree)/usr/gen_init_cpio - > initramfs.cpio + $(QUIET_GEN)echo 'file /init nolibc-test 755 0 0' | $(objtree)/usr/gen_init_cpio - > initramfs.cpio initramfs: nolibc-test $(QUIET_MKDIR)mkdir -p initramfs @@ -217,12 +227,12 @@ kernel-standalone: initramfs # run the tests after building the kernel run: kernel initramfs.cpio - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out # re-run the tests from an existing kernel rerun: - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out # report with existing test log -- 2.42.0