From patchwork Thu Jul 27 20:22:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330692 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0503C0015E for ; Thu, 27 Jul 2023 20:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232796AbjG0UXD (ORCPT ); Thu, 27 Jul 2023 16:23:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232824AbjG0UW6 (ORCPT ); Thu, 27 Jul 2023 16:22:58 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F236F2D67; Thu, 27 Jul 2023 13:22:53 -0700 (PDT) X-QQ-mid: bizesmtp88t1690489363tb8slm3z Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:22:42 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: q+EIYT+FhZqrDLdu2684eR5Czllj1f6+FLo1hVSobBXoXKvq/9go9/jOS6tRf PMdHGvcVLRKu36l8VlpvSphXqPDUm3AUSHxcqiESgvAcL7AJo+WmsIjTUO/LxAoBSM0eJU/ blFkSG7ZX8zYzDeZgvyOUJg0tFPY5bmbL2H8e9Lts7azb/kRUQHD7ehMUHtHtImPOD7thfl OhnAOBmITZ1+AEG1C7T0101m/QGw6Kknh6cL9Pql4xM5AQTaHrlGCNgwc2JNzdWxOWSHf/X YJzlOtdku2Qhpw0/ME39BXaXp8mT7DfTn4tgzoyamTd6f9g7PxTUCXGIA9PrQOZ8wUZMkn0 w0RWIrpNYFUtwKfwf1M27fgCeRVlzRFEgVPq66fNTfowH1QQ/nLUuArh7OLjg== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5556135556970039063 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 01/12] selftests/nolibc: allow report with existing test log Date: Fri, 28 Jul 2023 04:22:42 +0800 Message-Id: <50b239f40ddbf4bd3e067c39330f99bf63c71147.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org After the tests finish, it is valuable to report and summarize with existing test log. This avoid rerun or run the tests again when not necessary. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 2e9694370913..75419b695f0d 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -207,6 +207,10 @@ rerun: $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out +# report with existing test log +report: + $(Q)$(REPORT_RUN_OUT) + clean: $(call QUIET_CLEAN, sysroot) $(Q)rm -rf sysroot From patchwork Thu Jul 27 20:23:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4697EB64DD for ; Thu, 27 Jul 2023 20:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbjG0UYW (ORCPT ); Thu, 27 Jul 2023 16:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230109AbjG0UYV (ORCPT ); Thu, 27 Jul 2023 16:24:21 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA473AA9; Thu, 27 Jul 2023 13:24:01 -0700 (PDT) X-QQ-mid: bizesmtp89t1690489430taupjqmr Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:23:49 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: 7YFKcddXagjClmzXEeTqsqBAti0I7zGcNw3o74NJMlrB+NIXdu4Mxu64pWeI9 GijqOI4AwCKaIHI/71zr/Ho8fvrwScEzDbge6LU/OzZVI8OcxxnXpE5/C7HW6mgyrxWjGNO w1Xc/7vadlLRWh2EbZ0ka+sr5L8ZEwX55NLKhW+bY31wiI9scpTopIQKJqCmPFjoSFkukjr l6LBxQwXlEOFL36ga555U6uaXkPq15LVx8sYhIPctX5dgTWtDCwJoeut+40i9e8ufwdJ4gT ZyuJF/u28VGFLMo+cKSoC/+kKerNQKF7vNPXdTX+1djVsLZqQDGYjkxAFUxHkVcIRQzhor3 KSTH0IHJMUn9ztJ3QB32ky7Ud4fZIW9voWqvJocuRGvKnn1RZLBJLNtxmpKyAdsQofJuila X-QQ-GoodBg: 0 X-BIZMAIL-ID: 1357808437858265146 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 02/12] selftests/nolibc: add macros to reduce duplicated changes Date: Fri, 28 Jul 2023 04:23:49 +0800 Message-Id: <7d033dcf0bc499de1269af8b436133733a1710f1.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The kernel targets share the same kernel make operations, the same .config file, the same kernel image, add MAKE_KERNEL, KERNEL_CONFIG and KERNEL_IMAGE for them. Many targets use the same log file, add RUN_OUT to allow save log by architecture, for example: 'make RUN_OUT=$PWD/run.$arch.out'. The qemu run/rerun targets share the same qemu system run command, add QEMU_SYSTEM_RUN for them. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230722122009.GE17311@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 41 ++++++++++++++++--------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 75419b695f0d..bfea1ea0b4e7 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -169,47 +169,58 @@ endif libc-test: nolibc-test.c $(QUIET_CC)$(CC) -o $@ $< +# common macros for logging +RUN_OUT = $(CURDIR)/run.out + # local libc-test run-libc-test: libc-test - $(Q)./libc-test > "$(CURDIR)/run.out" || : - $(Q)$(REPORT) $(CURDIR)/run.out + $(Q)./libc-test > "$(RUN_OUT)" || : + $(Q)$(REPORT) "$(RUN_OUT)" # local nolibc-test run-nolibc-test: nolibc-test - $(Q)./nolibc-test > "$(CURDIR)/run.out" || : - $(Q)$(REPORT) $(CURDIR)/run.out + $(Q)./nolibc-test > "$(RUN_OUT)" || : + $(Q)$(REPORT) "$(RUN_OUT)" # qemu user-land test run-user: nolibc-test - $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(CURDIR)/run.out" || : - $(Q)$(REPORT) $(CURDIR)/run.out + $(Q)qemu-$(QEMU_ARCH) ./nolibc-test > "$(RUN_OUT)" || : + $(Q)$(REPORT) "$(RUN_OUT)" initramfs: nolibc-test $(QUIET_MKDIR)mkdir -p initramfs $(call QUIET_INSTALL, initramfs/init) $(Q)cp nolibc-test initramfs/init +# common macros for kernel targets +MAKE_KERNEL = $(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) +KERNEL_CONFIG = $(srctree)/.config +KERNEL_IMAGE = $(srctree)/$(IMAGE) + defconfig: - $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) mrproper $(DEFCONFIG) prepare - $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(srctree)/.config" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) - $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KCONFIG_ALLCONFIG="$(srctree)/.config" allnoconfig + $(Q)$(MAKE_KERNEL) mrproper $(DEFCONFIG) prepare + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) + $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig kernel: initramfs - $(Q)$(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs + $(Q)$(MAKE_KERNEL) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs + +# common macros for qemu run/rerun targets +QEMU_SYSTEM_RUN = qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(KERNEL_IMAGE)" -serial stdio $(QEMU_ARGS) # run the tests after building the kernel run: kernel - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" - $(Q)$(REPORT) $(CURDIR)/run.out + $(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" + $(Q)$(REPORT) "$(RUN_OUT)" # re-run the tests from an existing kernel rerun: - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" - $(Q)$(REPORT) $(CURDIR)/run.out + $(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" + $(Q)$(REPORT) "$(RUN_OUT)" # report with existing test log report: - $(Q)$(REPORT_RUN_OUT) + $(Q)$(REPORT) "$(RUN_OUT)" clean: $(call QUIET_CLEAN, sysroot) From patchwork Thu Jul 27 20:24:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44119C0015E for ; Thu, 27 Jul 2023 20:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230223AbjG0UZJ (ORCPT ); Thu, 27 Jul 2023 16:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjG0UZI (ORCPT ); Thu, 27 Jul 2023 16:25:08 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32ECD213A; Thu, 27 Jul 2023 13:25:07 -0700 (PDT) X-QQ-mid: bizesmtp76t1690489498tn31pf5y Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:24:56 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: OFQdrTmJ2CT0tv/k26zD61DgunIr3+i0gone8E+YGqdNlrN1NMVMfNlBeM907 QHYMz8CJvGbNGo2HcSksGZidroSyt7+Jq0dU4tKx5ZZiLbBmsl82jsZXPz/fIp7su2ohykc 554yQkRI4nz5yiK3mB6DzQ4AUpgeLhpu3NvDkupV1A4BbpHKbl+nPP2OAKUDI22ThM7qUKK flti2txnb6ObvovHXy8v5rve33RQFJdVlo49Y31TT1pCPBQgSu2+DxtHvQf9Pb/7F5LC0/d vCjccB3olddvLIM1bmTiA+Wf3Hb76B0A27Y0PylTN7gPtLhNMevIhh9v1KvAmL8lQjHWUUA DhqwfpUhbSJaTlO3jnl/uFVJDaGyBW5Ij8WS61t2uqI0G7jdJzG3DM/UvtLyQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6039361887706887061 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 03/12] selftests/nolibc: fix up O= option support Date: Fri, 28 Jul 2023 04:24:56 +0800 Message-Id: <1da6cedc8a7232833dbb7aaada5ae9df3e60ed7e.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org To avoid pollute the source code tree and avoid mrproper for every architecture switch, the O= argument must be supported. Both IMAGE and .config are from the building directory, let's use objtree instead of srctree for them. If no O= option specified, means building kernel in source code tree, objtree should be srctree in such case. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/ZK0AB1OXH1s2xYsh@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index bfea1ea0b4e7..f5680b9ed85c 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -9,6 +9,9 @@ ifeq ($(srctree),) srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR))) endif +# add objtree for O= argument, required by IMAGE and .config +objtree ?= $(srctree) + ifeq ($(ARCH),) include $(srctree)/scripts/subarch.include ARCH = $(SUBARCH) @@ -194,12 +197,12 @@ initramfs: nolibc-test # common macros for kernel targets MAKE_KERNEL = $(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) -KERNEL_CONFIG = $(srctree)/.config -KERNEL_IMAGE = $(srctree)/$(IMAGE) +KERNEL_CONFIG = $(objtree)/.config +KERNEL_IMAGE = $(objtree)/$(IMAGE) defconfig: $(Q)$(MAKE_KERNEL) mrproper $(DEFCONFIG) prepare - $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(srctree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) + $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig kernel: initramfs From patchwork Thu Jul 27 20:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17012EB64DD for ; Thu, 27 Jul 2023 20:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbjG0UcQ (ORCPT ); Thu, 27 Jul 2023 16:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbjG0UcK (ORCPT ); Thu, 27 Jul 2023 16:32:10 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B7930F5; Thu, 27 Jul 2023 13:32:00 -0700 (PDT) X-QQ-mid: bizesmtp65t1690489565tg42khc4 Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:26:04 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: SO65WgIymiHJ7FcToC7kLxdI0mhJp0wkOEo+Sirw0umysYn9kh0wsqMc5pGqj kO1TSVq8llQr9cwcIYvv7VfJgl3PSzINEZkitkWxZFiiueP0GsxyyrOCe3tOx7Gnu8k7B4d 3dc/Ur36CeAh0rcHzK0EWcasxUczJP8IlemGAFgUj0CUnX7V0JrPeJwZlxg0cZYfJA0xnL8 i2r01JxV/uZh/dfEvSg9ODOD716/+Vu5vvDay73TO1PXlevJDttZYOzabewiCuZL0R3Ng+/ wMpZqSlgytjC21/r9RukLL8G8gdKvCzVzVSra6JhSHt4cAMhM4i1NoBsJ7CHzAxollzipHv 2GOnQ6uWxXlivYeq8+5I+StbFQFwasQphaGSkBgMd3K+FoVk9C9hGX4X3DcQi3LF6jrK4yV X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17663128529755387531 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 04/12] selftests/nolibc: string the core targets Date: Fri, 28 Jul 2023 04:26:03 +0800 Message-Id: <9b52e26748eda1ac108d569207bf428bf37b3bbc.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org To avoid run targets one by one manually and boringly, let's string them with IMAGE and .config, the MAKE command will trigger the dependencies for us. Note, defconfig target is only triggered while the .config is not there, it means only trigger defconfig for the first run or after a mrproper. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230725142017.37103-1-falcon@tinylab.org/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index f5680b9ed85c..3a61fa7e42a0 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -153,6 +153,7 @@ all: run sysroot: sysroot/$(ARCH)/include +PHONY = sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot @@ -205,14 +206,21 @@ defconfig: $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig -kernel: initramfs +PHONY += $(KERNEL_CONFIG) +$(KERNEL_CONFIG): + $(Q)if [ ! -f "$(KERNEL_CONFIG)" ]; then $(MAKE) --no-print-directory defconfig; fi + +kernel: $(KERNEL_CONFIG) + $(Q)$(MAKE) --no-print-directory initramfs $(Q)$(MAKE_KERNEL) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=$(CURDIR)/initramfs # common macros for qemu run/rerun targets QEMU_SYSTEM_RUN = qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(KERNEL_IMAGE)" -serial stdio $(QEMU_ARGS) # run the tests after building the kernel -run: kernel +PHONY += $(KERNEL_IMAGE) +$(KERNEL_IMAGE): kernel +run: $(KERNEL_IMAGE) $(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" $(Q)$(REPORT) "$(RUN_OUT)" @@ -237,4 +245,4 @@ clean: $(call QUIET_CLEAN, run.out) $(Q)rm -rf run.out -.PHONY: sysroot/$(ARCH)/include +.PHONY: $(PHONY) From patchwork Thu Jul 27 20:27:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2B47C001DC for ; Thu, 27 Jul 2023 20:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjG0U2M (ORCPT ); Thu, 27 Jul 2023 16:28:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231248AbjG0U16 (ORCPT ); Thu, 27 Jul 2023 16:27:58 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C409C30CD; Thu, 27 Jul 2023 13:27:39 -0700 (PDT) X-QQ-mid: bizesmtp70t1690489632tls6eljb Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:27:11 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: 3M0okmaRx3gIqvGRracM+M018bYz/CeLA38os0ZqnkmoJW4wVgNSRIQZdhvX6 5EL3U0qRh1Axy5sg9nEMQa38Xh1XKzC3OxtnQ5dPOq/ijA/xvg4dJGdWt09QYM8U6n1AeOO gWyTYSsHDZ8DyuU9ABRFFQUF8o6y9L+bcrYPZ45mBij+b4Jt6Qcsx52aQVkbgkGXoqwQVKE 2hbxOFotjr3YrNdj7gQHjgIsXMs7fKzDwgxwnckcRnGOjpsGNj7AH9X7LQbdvH3F72D5ZxN Om1OiM1U+BEAu/CEPdnCykyL2Z2kJ4Z370aR0Jg3WG30L1+ED5CpK57rgYiqO0oaEcIr58I BISGpTKi5+LFxkX/uBje4OCPzEVcwl4ue7TkGUJFKN5XXAojYn6Xfrkf9QtPw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7483023099886591231 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 05/12] selftests/nolibc: allow customize CROSS_COMPILE by architecture Date: Fri, 28 Jul 2023 04:27:10 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Some cross compilers may not just be prefixed with ARCH, customize them by architecture may simplify the test a lot, especially, when iterate with ARCH. After customizing this for every architecture, the minimal test argument will be architecture itself, no CROSS_COMPILE required to be passed. If the prefix of installed cross compiler is not the same as the one customized, we can also pass CROSS_COMPILE as before or even pass CROSS_COMPILE_. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 3a61fa7e42a0..3f15c7f7ef76 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -45,6 +45,12 @@ IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) +# CROSS_COMPILE: cross toolchain prefix by architecture +CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) + +# make sure CC is prefixed with CROSS_COMPILE +$(call allow-override,CC,$(CROSS_COMPILE)gcc) + # default kernel configurations that appear to be usable DEFCONFIG_i386 = defconfig DEFCONFIG_x86_64 = defconfig From patchwork Thu Jul 27 20:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F98BEB64DD for ; Thu, 27 Jul 2023 20:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbjG0U2c (ORCPT ); Thu, 27 Jul 2023 16:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjG0U2b (ORCPT ); Thu, 27 Jul 2023 16:28:31 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861CE30CD; Thu, 27 Jul 2023 13:28:28 -0700 (PDT) X-QQ-mid: bizesmtp77t1690489698t82ph8cm Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:28:17 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: dKvkn8qoLrE2yLn96qy5k0fzTpwuyKtkiBSpI4LwdFyOeVirP6jaXvT0wq5IB lyhlNscOT+zA2kHB7tqoZ7sJwvbTr525TCosc7zMPGfENlCjXaycc0d9ITayDt+FcvVnqoa CYH8kqgk62UIvsOM6IRf45fZm/tD16k4QVwCphU4X6zJSbEt3vx4jGjLm2aCkaZ0J3EdBhi 7B+qe6+RI/NJPVFoMTuzy+BKEtxQcWXRqOEGuzqmBtamF70BLvlykk4dHD5nh7usejRRyLB JCBuYBm7V062gzUOMueR6pXzenYc9e5+ti7FqyhKWD/TTxpPm7P7gsGppuRl9ksU7QLJfXx KcL5CCZD+J3JP9LDFEiXmJZhnWcgiXe2saCrF9nZ6UbWxScnTXfUrYeU7FLGvh2Jk8EGX/e X-QQ-GoodBg: 0 X-BIZMAIL-ID: 16216814846800268763 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 06/12] selftests/nolibc: customize CROSS_COMPILE for 32/64-bit powerpc Date: Fri, 28 Jul 2023 04:28:17 +0800 Message-Id: <41e2aa9e4299dd35cfeef9fecc2a6a02a7b49d90.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The little-endian powerpc64le compilers provided by Ubuntu and Fedora are able to compile big endian kernel and big endian nolibc-test [1]. These default CROSS_COMPILE settings allow to test target architectures with: $ cd /path/to/tools/testing/selftests/nolibc/ $ for arch in ppc ppc64 ppc64le; do \ make run-user ARCH=$arch | grep "status: "; \ done If want to use another cross compiler, please simply pass CROSS_COMPILE or CC as before. For example, it is able to build 64-bit nolibc-test with the big endian powerpc64-linux-gcc crosstool from [2]: $ wget -c https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-powerpc64-linux.tar.xz $ tar xvf x86_64-gcc-13.1.0-nolibc-powerpc64-linux.tar.xz $ export PATH=$PWD/gcc-13.1.0-nolibc/powerpc64-linux/bin/:$PATH $ export CROSS_COMPILE_ppc64=powerpc64-linux- $ export CROSS_COMPILE_ppc64le=powerpc64-linux- $ for arch in ppc64 ppc64le; do \ make run-user ARCH=$arch | grep "status: "; \ done Or specify CC directly with full path: $ export CC=$PWD/gcc-13.1.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc $ for arch in ppc64 ppc64le; do \ make run-user ARCH=$arch | grep "status: "; \ done [1]: https://github.com/open-power/skiboot [2]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 3f15c7f7ef76..6385915d16c9 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -46,6 +46,9 @@ IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # CROSS_COMPILE: cross toolchain prefix by architecture +CROSS_COMPILE_ppc ?= powerpc-linux-gnu- +CROSS_COMPILE_ppc64 ?= powerpc64le-linux-gnu- +CROSS_COMPILE_ppc64le ?= powerpc64le-linux-gnu- CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) # make sure CC is prefixed with CROSS_COMPILE From patchwork Thu Jul 27 20:29:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97985EB64DD for ; Thu, 27 Jul 2023 20:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbjG0U3i (ORCPT ); Thu, 27 Jul 2023 16:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjG0U3h (ORCPT ); Thu, 27 Jul 2023 16:29:37 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5BC2688; Thu, 27 Jul 2023 13:29:35 -0700 (PDT) X-QQ-mid: bizesmtp65t1690489766t9v338bu Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:29:25 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: 3M0okmaRx3hs8KjjHXgV3Mnz1SbuFa76sKO20ziBuLGO5QLIvoP9RFy4OEgee Cy0+ZWIn7BRQWovusTQnisGvElCqSK+hdthX7FIZJa0rDEywrtYE9JwNPGXNfugDB1nTF7U +JD/jIMyAb7+eEg0Bn/XSgdSX5NQVY0+YUYRJWS4/IHQE1Ym0tZSaJxcMRrXSsP6FflLo58 ld499Ozr6Eo+sFi2CqSszJD/SCrP5OBpOuy7ATwW2fq0QokE/CUxRfcyR92DNJ5NFMCuU7c TAx3dnUznunh2zaCrxSAqWa6uSZUfImNSRnq/BT2eRS9LgbGmvO6jNZ56OyddZZ0bBhKyOE iCrVoZGvHR+BjNUKyxKqLGA7XIeg1nMUOzYarGvfLMWgJIkVJCEtrVdioJdpq2hM3UldzBO X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17253053822244597306 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 07/12] selftests/nolibc: add menuconfig and mrproper for development Date: Fri, 28 Jul 2023 04:29:24 +0800 Message-Id: <45c0c24e77f4ae78ac3ace099f2e6678d15456e0.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org menuconfig and mrproper are frequently used operations during a new architecture porting, testing or debugging. menuconfig is required to tune and test extra kernel config options for tinyconfig. mrproper is required to get a clean srctree while want to start a new building with O= option, the old generated files in srctree must be mrproper-ed. differ from local nolibc targets, the menuconfig and mrproper targets from top-level Makefile accept different ARCH variable and require extra '-C /path/to/srctree', which make development not consistent and therefore very painful, let's add local menuconfig and mrproper targets too. To reduce duplicated entries, menuconfig and mrproper are added together. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 6385915d16c9..a214745e0f3e 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -215,6 +215,9 @@ defconfig: $(Q)$(srctree)/scripts/kconfig/merge_config.sh -O "$(objtree)" -m "$(KERNEL_CONFIG)" $(foreach c,$(EXTCONFIG),$(wildcard $(CURDIR)/configs/$c)) $(Q)$(MAKE_KERNEL) KCONFIG_ALLCONFIG="$(KERNEL_CONFIG)" allnoconfig +menuconfig mrproper: + $(Q)$(MAKE_KERNEL) $@ + PHONY += $(KERNEL_CONFIG) $(KERNEL_CONFIG): $(Q)if [ ! -f "$(KERNEL_CONFIG)" ]; then $(MAKE) --no-print-directory defconfig; fi From patchwork Thu Jul 27 20:30:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C3B6C001DC for ; Thu, 27 Jul 2023 20:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbjG0Uay (ORCPT ); Thu, 27 Jul 2023 16:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231421AbjG0Uaw (ORCPT ); Thu, 27 Jul 2023 16:30:52 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37BB30E4; Thu, 27 Jul 2023 13:30:42 -0700 (PDT) X-QQ-mid: bizesmtp89t1690489832t5sr73z5 Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:30:31 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: pmyeiOl6PGn82x4eFXPNEITOuWWU+TvnNm56XXJBynRue1cBZR4uW6sldlrWd 4avjCims+5xy9Qf/PYidPSKOOcbnAkxppQvdPEejuwpc4PM6jyWFcyZTUuDqVJdJ5JmoooI jL/XkwNL1y1hjcw8FyqydaCs4yicA/VuDE3SFw6wgCvkTXIyWQZt4DRiLIMNPr6eEUD+m72 f+xek+riwnuTGiwPrYymmfQffQqEBn7xLjaQbhA9sfEOtixwjGr0uWR3dBgWyKcpPJduAeb K2hMuJGt0tN6UMAuv3o32/8NH0U0c6Xm8snJ0+XJly6iTA9nuPqlwdvO8mQAPAd/qr53uSM 1WulUhXMoKeKR1ocG/O6MNH8ckx1LbDykelL+Evnc/anK0xbMA1VPoKqamurc2uMWMOEz1E X-QQ-GoodBg: 0 X-BIZMAIL-ID: 6404872216917566907 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 08/12] selftests/nolibc: allow quit qemu-system when poweroff fails Date: Fri, 28 Jul 2023 04:30:31 +0800 Message-Id: <4b4d792299ca5356f8f5af5fc9a27c687b0e4e38.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The kernel of some architectures can not poweroff qemu-system normally, especially for tinyconfig. Some architectures may have no kernel poweroff support, the others may require more kernel config options and therefore slow down the tinyconfig build and test. and also, it's very hard (and some even not possible) to find out the exact poweroff related kernel config options for every architecture. Since the low-level poweroff support is heavily kernel & qemu dependent, it is not that critical to both nolibc and nolibc-test, let's simply ignore the poweroff required kernel config options for tinyconfig (and even for defconfig) and quit qemu-system after a specified timeout or with an expected system halt or poweroff string (these strings mean our reboot() library routine is perfectly ok). QEMU_TIMEOUT can be configured for every architecture based on their time cost requirement of bios boot + kernel boot + test + poweroff. By default, 10 seconds timeout is configured, this is enough for most of the architectures, otherwise, customize one by architecture. To tell users the test running progress in time, some critical running status are also printed and detected. Suggested-by: Willy Tarreau Link: https://lore.kernel.org/lkml/20230722130248.GK17311@1wt.eu/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 30 +++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index a214745e0f3e..9a57de3b283c 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -105,6 +105,9 @@ QEMU_ARGS_s390 = -M s390-ccw-virtio -m 1G -append "console=ttyS0 panic=-1 QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=NOLIBC_TEST=%)" QEMU_ARGS = $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_EXTRA) +# QEMU_TIMEOUT: some architectures can not poweroff normally, especially for tinyconfig +QEMU_TIMEOUT = $(or $(QEMU_TIMEOUT_$(XARCH)),10) + # OUTPUT is only set when run from the main makefile, otherwise # it defaults to this nolibc directory. OUTPUT ?= $(CURDIR)/ @@ -229,16 +232,39 @@ kernel: $(KERNEL_CONFIG) # common macros for qemu run/rerun targets QEMU_SYSTEM_RUN = qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(KERNEL_IMAGE)" -serial stdio $(QEMU_ARGS) +TIMEOUT_CMD = t=$(QEMU_TIMEOUT); past=0; \ + bios_timeout=$$(expr $$t - 7); kernel_timeout=$$(expr $$t - 5); init_timeout=$$(expr $$t - 3); test_timeout=$$(expr $$t - 1); \ + err=""; bios=0; kernel=0; init=0; test=0; poweredoff=0; panic=0; \ + echo "Running $(KERNEL_IMAGE) on qemu-system-$(QEMU_ARCH)"; \ + while [ $$t -gt 0 ]; do \ + sleep 2; t=$$(expr $$t - 2); past=$$(expr $$past + 2); \ + if [ $$bios -eq 0 ] && grep -E "Linux version|Kernel command line|printk: console" "$(RUN_OUT)"; then bios=1; fi; \ + if [ $$bios -eq 1 -a $$kernel -eq 0 ] && grep -E "Run .* as init process" "$(RUN_OUT)"; then kernel=1; fi; \ + if [ $$kernel -eq 1 -a $$init -eq 0 ] && grep -E "Running test" "$(RUN_OUT)"; then init=1; fi; \ + if [ $$init -eq 1 -a $$test -eq 0 ] && grep -E "Leaving init with final status|Exiting with status" "$(RUN_OUT)"; then test=1; fi; \ + if [ $$init -eq 1 ] && grep -E "Kernel panic - not syncing: Attempted to kill init" "$(RUN_OUT)"; then err="test"; sleep 1; break; fi; \ + if [ $$test -eq 1 ] && grep -E "reboot: System halted|reboot: Power down" "$(RUN_OUT)"; then poweredoff=1; sleep 1; break; fi; \ + if [ $$past -gt $$bios_timeout -a $$bios -eq 0 ]; then err="bios"; break; fi; \ + if [ $$past -gt $$kernel_timeout -a $$kernel -eq 0 ]; then err="kernel"; break; fi; \ + if [ $$past -gt $$init_timeout -a $$init -eq 0 ]; then err="init"; break; fi; \ + if [ $$past -gt $$test_timeout -a $$test -eq 0 ]; then err="test"; break; fi; \ + done; \ + if [ -z "$$err" -a $$poweredoff -eq 0 -a $$panic -eq 0 ]; then err="qemu-system-$(QEMU_ARCH)"; fi; \ + if [ -n "$$err" ]; then echo "$$err may timeout, test failed"; tail -10 $(RUN_OUT); else echo "powered off, test finish"; fi; \ + pkill -15 qemu-system-$(QEMU_ARCH) || true + +TIMEOUT_QEMU_RUN = ($(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" &); $(TIMEOUT_CMD) + # run the tests after building the kernel PHONY += $(KERNEL_IMAGE) $(KERNEL_IMAGE): kernel run: $(KERNEL_IMAGE) - $(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" + $(Q)$(TIMEOUT_QEMU_RUN) $(Q)$(REPORT) "$(RUN_OUT)" # re-run the tests from an existing kernel rerun: - $(Q)$(QEMU_SYSTEM_RUN) > "$(RUN_OUT)" + $(Q)$(TIMEOUT_QEMU_RUN) $(Q)$(REPORT) "$(RUN_OUT)" # report with existing test log From patchwork Thu Jul 27 20:31:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83037C001DC for ; Thu, 27 Jul 2023 20:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbjG0UcK (ORCPT ); Thu, 27 Jul 2023 16:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbjG0UcI (ORCPT ); Thu, 27 Jul 2023 16:32:08 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D05E30DB; Thu, 27 Jul 2023 13:31:50 -0700 (PDT) X-QQ-mid: bizesmtp71t1690489900tiuhvymd Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:31:39 +0800 (CST) X-QQ-SSF: 01200000000000D0X000000A0000000 X-QQ-FEAT: 3M0okmaRx3iio5UHKEhK5b2ClrY+IfoQsoiyLkp16KXoPNZd6NKJ6Hq2TkPOp lxuEVdu0iqSsDofWqZLbsQNWgPuh4dTi3eZroNw+JgJBygfCJFjpuRtgX7H8WMWgkbAg4Lx HpQCjdORRam1SuzECvY3se07e0xnOANa0+i63yBaLR2iLK1CL3yVwmcFjZ0ZptN7WavMAhs 1X1RMFp4Mcb7h8SZhMJ966izSIJvKs6VM+7Rz+6TqgzWp+/SYLMiOQ2LhWCqRvqE0Dyva9V 8Df/r12xiCcEP4zb1cAwJ/yl39Tid5XJd1HShHLXUqPMkt7sEpx1X+eF8Rhcs7sGJ55iMFe iFUzR0cIPJ1QNBsh8JfDO5wzHsY2Eha/SLBOaLqj3UT0zUcKgLDQppuzwPvIQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8403613974557991608 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 09/12] selftests/nolibc: customize QEMU_TIMEOUT for ppc64/ppc64le Date: Fri, 28 Jul 2023 04:31:39 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Both ppc64 and ppc64le use slow bios in some qemu versions, let's increase the timeout to make sure the running qemu would not be killed before the test finish. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 9a57de3b283c..ad2538ec5eb0 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -106,6 +106,8 @@ QEMU_ARGS_loongarch = -M virt -append "console=ttyS0,115200 panic=-1 $(TEST:%=N QEMU_ARGS = $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_EXTRA) # QEMU_TIMEOUT: some architectures can not poweroff normally, especially for tinyconfig +QEMU_TIMEOUT_ppc64 = 15 +QEMU_TIMEOUT_ppc64le = 25 QEMU_TIMEOUT = $(or $(QEMU_TIMEOUT_$(XARCH)),10) # OUTPUT is only set when run from the main makefile, otherwise From patchwork Thu Jul 27 20:32:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7C08C41513 for ; Thu, 27 Jul 2023 20:33:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbjG0UdL (ORCPT ); Thu, 27 Jul 2023 16:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231959AbjG0Uc6 (ORCPT ); Thu, 27 Jul 2023 16:32:58 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45940F5; Thu, 27 Jul 2023 13:32:57 -0700 (PDT) X-QQ-mid: bizesmtp89t1690489968tjf0ydyx Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:32:46 +0800 (CST) X-QQ-SSF: 01200000002000D0X000B00A0000000 X-QQ-FEAT: +ynUkgUhZJkRxmTCWl75yKqo2fa1gLrTMSfYGM0V6uWTshSZ0cgdrv7cH/mZn dmX2sbf39Iyx1LX2kZa+vgxT8UOo4T5hxuT7dgpiJ6+3y3K8zuQZcX3CaCxWmcYdHJ9+ScP GtJIUU3bQdI6s8wWEomWlMCiLYKRgcLvtXD2NlwTiAdCGYpeChxDvfT3AIwmNa6xpnjdykf F476R5yc11Cn8Ive9Q1+bHgrFnZOLe3e+4hNszy2MRvJMbavTSgYGQ1JdwFqfWcDQg0qmSe yA9ajOz5duRz1dhmUpw0ZewPx1EkoNjQ0VE0Jla10GreyzUpKEo4XLv7AHBjcaVVYGxDTFp zmSCihnPDQlMRJptYUFdN3udt3VV2nKnCwfQYajztRIpHI0bFhWt7qZn1o9bw== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7408932279377289764 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 10/12] selftests/nolibc: tinyconfig: add extra common options Date: Fri, 28 Jul 2023 04:32:46 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The tinyconfig target from top-level Makefile has already enabled some common options, but they are not enough to enable boot and print. $ find kernel/ arch/*/ -name "tiny*.config" kernel/configs/tiny-base.config kernel/configs/tiny.config arch/x86/configs/tiny.config To enable qemu boot and console print, additional kernel config options are required, include the common parts and the architecture specific parts. Here adds minimal extra common parts for all architectures: * for initrd: CONFIG_BLK_DEV_INITRD * for init executable: CONFIG_BINFMT_ELF * for test result print: CONFIG_PRINTK, CONFIG_TTY Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/configs/common.config | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tools/testing/selftests/nolibc/configs/common.config diff --git a/tools/testing/selftests/nolibc/configs/common.config b/tools/testing/selftests/nolibc/configs/common.config new file mode 100644 index 000000000000..3957f812faac --- /dev/null +++ b/tools/testing/selftests/nolibc/configs/common.config @@ -0,0 +1,4 @@ +CONFIG_BLK_DEV_INITRD=y +CONFIG_BINFMT_ELF=y +CONFIG_PRINTK=y +CONFIG_TTY=y From patchwork Thu Jul 27 20:33:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A4E7EB64DD for ; Thu, 27 Jul 2023 20:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbjG0UeZ (ORCPT ); Thu, 27 Jul 2023 16:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjG0UeY (ORCPT ); Thu, 27 Jul 2023 16:34:24 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0B730EB; Thu, 27 Jul 2023 13:34:04 -0700 (PDT) X-QQ-mid: bizesmtp81t1690490035tu076myn Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:33:54 +0800 (CST) X-QQ-SSF: 01200000002000D0X000B00A0000000 X-QQ-FEAT: Y6Kc/cQg3lYdDDFJ90mtjrutfwesBX2jEXConbTZEba2sKx27B/oxMiaMAba8 hwIK0o+c2wffDHiHcQbDmpwB0Qe+iEUiXS2aUmAoTZ1ib/u8Sk7n+NB1Fqkwei5rt8DBMso iW4QXw1X8ZnkHvRR6B92r5ZAnW8XaDKAjDhUEgbAYsjKMFUDpOi782Q5XaU2P+dOcLMuoJQ Md4aoZU8FdsNorryyB+6OuScHeZ3G3x+A/jXSFpqSkGT1FcVD11ifzf47aNta6MJytc3G/d 42KABhdRngyeOs++ddJWhwi2MruJcGkZNO8+eoF6S15ywZB0GYaTvLrbMOr/Ae79OM1xrOP kYVjm5o7KLAZd6L2iEWwbpbF5qvqOdn/2euao0AsIel3rA4fgywiqU8iwD36MiCFw+KY+yK X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10885213077665245786 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 11/12] selftests/nolibc: tinyconfig: add support for 32/64-bit powerpc Date: Fri, 28 Jul 2023 04:33:53 +0800 Message-Id: <983843582e52e83fba79ad45cea6c79e1f62ec6c.1690489039.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This adds extra config options for ppc, ppc64le and ppc64, now, it is able to use tinyconfig as the minimal config target to speed up the run target of powerpc: $ for arch in ppc ppc64 ppc64le; do \ mkdir -p $PWD/kernel-$arch; \ make defconfig run DEFCONFIG=tinyconfig ARCH=$arch O=$PWD/kernel-$arch | grep status ; \ done rerun with architecture specific run.out: $ for arch in ppc ppc64 ppc64le; do \ mkdir -p $PWD/kernel-$arch; \ make rerun ARCH=$arch O=$PWD/kernel-$arch RUN_OUT=$PWD/run.$arch.out | grep status ; \ done report with existing test log: $ for arch in powerpc powerpc64 powerpc64le; do \ make report RUN_OUT=$PWD/run.$arch.out | grep status ; \ done Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/configs/ppc.config | 3 +++ tools/testing/selftests/nolibc/configs/ppc64.config | 3 +++ tools/testing/selftests/nolibc/configs/ppc64le.config | 4 ++++ 3 files changed, 10 insertions(+) create mode 100644 tools/testing/selftests/nolibc/configs/ppc64.config create mode 100644 tools/testing/selftests/nolibc/configs/ppc64le.config diff --git a/tools/testing/selftests/nolibc/configs/ppc.config b/tools/testing/selftests/nolibc/configs/ppc.config index b1975f8253f7..29123cee14c4 100644 --- a/tools/testing/selftests/nolibc/configs/ppc.config +++ b/tools/testing/selftests/nolibc/configs/ppc.config @@ -1,3 +1,6 @@ +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_PPC_PMAC=y +CONFIG_PPC_OF_BOOT_TRAMPOLINE=y CONFIG_SERIAL_PMACZILOG=y CONFIG_SERIAL_PMACZILOG_TTYS=y CONFIG_SERIAL_PMACZILOG_CONSOLE=y diff --git a/tools/testing/selftests/nolibc/configs/ppc64.config b/tools/testing/selftests/nolibc/configs/ppc64.config new file mode 100644 index 000000000000..4e17f0cdb99f --- /dev/null +++ b/tools/testing/selftests/nolibc/configs/ppc64.config @@ -0,0 +1,3 @@ +CONFIG_PPC64=y +CONFIG_PPC_POWERNV=y +CONFIG_HVC_OPAL=y diff --git a/tools/testing/selftests/nolibc/configs/ppc64le.config b/tools/testing/selftests/nolibc/configs/ppc64le.config new file mode 100644 index 000000000000..713b227f506f --- /dev/null +++ b/tools/testing/selftests/nolibc/configs/ppc64le.config @@ -0,0 +1,4 @@ +CONFIG_PPC64=y +CONFIG_PPC_POWERNV=y +CONFIG_HVC_OPAL=y +CONFIG_CPU_LITTLE_ENDIAN=y From patchwork Thu Jul 27 20:35:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13330717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E531EEB64DD for ; Thu, 27 Jul 2023 20:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229661AbjG0UfQ (ORCPT ); Thu, 27 Jul 2023 16:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbjG0UfP (ORCPT ); Thu, 27 Jul 2023 16:35:15 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4828271C; Thu, 27 Jul 2023 13:35:13 -0700 (PDT) X-QQ-mid: bizesmtp65t1690490104tdo0lyfq Received: from linux-lab-host.localdomain ( [61.141.78.189]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 28 Jul 2023 04:35:02 +0800 (CST) X-QQ-SSF: 01200000002000D0X000B00A0000000 X-QQ-FEAT: rZJGTgY0+YOFURgI4rO4FCPYfZtEtfnMGBKFe0DXq/9mV7CVBMsYHOMR4+JVr IOjcZ4pyh73O5L5n/JDvdzIMMCtbuhFCCO44m0pvqeXuESuDcN2xUKASBx63aVhk3t7tc54 K5DJI5ifluK37jWOc54qO9uY6B3j7f6msEJ8K4yVhVodJOILbBFPFeriiptpNxGRDN0SVzJ Q6zx9zbVOo6TBjyF0plarqxyqxegL9TDqmSSy4/oP38NYrS2lTTjvH79Hzqz5m4OQVs6vjL vsaaZv8k0s2lQFP7yYJ4HG9hvlPonlQFkvnbhJJHdbZbXZYswjhieFAky/22sa+CtrvtdqC igOmTDSJsdVqG0HL6MOGxfRS1rUxlxkwcxbP5F0GyD0dy1RYaF83ud/JsEbRQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17780552390268563941 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v3 12/12] selftests/nolibc: speed up some targets with multiple jobs Date: Fri, 28 Jul 2023 04:35:01 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The sysroot install and kernel build targets are time cost, let's use -j to parallelize them with multiple jobs. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index ad2538ec5eb0..1b45c22f9a94 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -171,7 +171,7 @@ PHONY = sysroot/$(ARCH)/include sysroot/$(ARCH)/include: $(Q)rm -rf sysroot/$(ARCH) sysroot/sysroot $(QUIET_MKDIR)mkdir -p sysroot - $(Q)$(MAKE) -C ../../../include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone + $(Q)$(MAKE) -j$$(nproc) -C ../../../include/nolibc ARCH=$(ARCH) OUTPUT=$(CURDIR)/sysroot/ headers_standalone $(Q)mv sysroot/sysroot sysroot/$(ARCH) ifneq ($(NOLIBC_SYSROOT),0) @@ -211,7 +211,7 @@ initramfs: nolibc-test $(Q)cp nolibc-test initramfs/init # common macros for kernel targets -MAKE_KERNEL = $(MAKE) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) +MAKE_KERNEL = $(MAKE) -j$$(nproc) -C $(srctree) ARCH=$(ARCH) CC=$(CC) CROSS_COMPILE=$(CROSS_COMPILE) KERNEL_CONFIG = $(objtree)/.config KERNEL_IMAGE = $(objtree)/$(IMAGE)