From patchwork Wed Oct 26 05:45:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 11071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp76448wru; Tue, 25 Oct 2022 23:00:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4F61+vt8GVeLhQ3y0+zKtAcqZ2TiMIM1wViK/O63f8KinrVxeoWn059sLeqhFwnYKaWedi X-Received: by 2002:a17:902:da92:b0:17f:9148:9b8c with SMTP id j18-20020a170902da9200b0017f91489b8cmr42854696plx.117.1666764012337; Tue, 25 Oct 2022 23:00:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666764012; cv=none; d=google.com; s=arc-20160816; b=woYymu1G63wCYNiXjWb+CRJC/65c4PF5zVuR8dgZTKjoAzt8OOfAjNdDsC8EdD16Jc P3T3IkFB8e9IQ6bmup2F3NCupr74jCsvqoHqCCFrjPygDdP2o/8GY0fg5+1tDHocmIHq H245wpLnDTNeCGEWfoTtjr0ZYB1B60c/1bUN5w1Il/NsTU7mBVYpgD8neGCQt1M6Wwn3 6c4HZb+3+s3GEWLx1uhEdif9pgHbPwcE/nUN9o21JbBayGapBVZ/ddWP84JYdIbY8wc/ i5IfU5hrgjI1ru8oARz0eSqfWlH0gzit3YYdyomkOCmBt699rb3CA4vSaJ2tBZq9ongT 8iKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=1yQEY2H6UQk1F9b0QI0uA1C+vcYE++nxK/A2P1fnR2g=; b=cDRpwR8zO4pe9IaCdj87gImxs/jM6ue2l9dpOi/R8Rl4lEkuvaFMm31WK6MXJNmMFY U8uDDvx/QernlHEnk4h/12iPZ4RReQZJUl0mfSA+e5itjy7DWWCDG92YxO/AYqQtuAYN Ubz4lCTnjlI3vw5GfF9pv7PlvInBbwCAHfUt4c89ijXPTNzWR4TocLNBd+tmsyAWCm4j r23fgAnVlz00RDZEUOIM9Ta9LVBi5YdNpGsC7bjm6VC6wJYTlPo+YIpbNviR24evB4U0 ftQsrsCAbvhofA7TWb4ehV0r863MYmESemy1zgsJTno5zpB9Cqxy1NhiqiaYAjhoYmnu w06w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a632250000000b0046edccffb8dsi6207563pgm.535.2022.10.25.22.59.59; Tue, 25 Oct 2022 23:00:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232504AbiJZFqH (ORCPT + 99 others); Wed, 26 Oct 2022 01:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiJZFqF (ORCPT ); Wed, 26 Oct 2022 01:46:05 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 79A7229C8C; Tue, 25 Oct 2022 22:46:03 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 29Q5jtWm019680; Wed, 26 Oct 2022 07:45:55 +0200 From: Willy Tarreau To: "Paul E. McKenney" Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH] selftests/nolibc: always rebuild the sysroot when running a test Date: Wed, 26 Oct 2022 07:45:08 +0200 Message-Id: <20221026054508.19634-1-w@1wt.eu> X-Mailer: git-send-email 2.17.5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747728740689859300?= X-GMAIL-MSGID: =?utf-8?q?1747728740689859300?= Paul and myself got trapped a few times by not seeing the effects of applying a patch to the nolibc source code until a "make clean" was issued in the nolibc directory. It's particularly annoying when trying to confirm that a proposed patch really solves a problem (or that reverting it reintroduces the problem). The reason for the sysroot not being rebuilt was that it can be quite slow. But in fact it's only slow after a "make clean" issued at the kernel's topdir, because it's the main "make headers" that can take a tens of seconds; as long as "usr/include" still contains headers, the "headers_install" phase is only a quick "rsync", and rebuilding the whole nolibc sysroot takes a bit less than one second, which is perfectly acceptable for a test, even more once the time lost caused by misleading results if factored in. This patch marks the sysroot target as phony and starts by clearing the previous sysroot for the current architecture before reinstalling it. Thanks to this, applying a patch to nolibc makes the effect immediately visible to "make nolibc-test": $ time make -j -C tools/testing/selftests/nolibc nolibc-test make: Entering directory '/k/tools/testing/selftests/nolibc' MKDIR sysroot/x86/include make[1]: Entering directory '/k/tools/include/nolibc' make[2]: Entering directory '/k' make[2]: Leaving directory '/k' make[2]: Entering directory '/k' INSTALL /k/tools/testing/selftests/nolibc/sysroot/sysroot/include make[2]: Leaving directory '/k' make[1]: Leaving directory '/k/tools/include/nolibc' CC nolibc-test make: Leaving directory '/k/tools/testing/selftests/nolibc' real 0m0.869s user 0m0.716s sys 0m0.149s Cc: "Paul E. McKenney" Link: https://lore.kernel.org/all/20221021155645.GK5600@paulmck-ThinkPad-P17-Gen-1/ Signed-off-by: Willy Tarreau --- 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 69ea659caca9..22f1e1d73fa8 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -95,6 +95,7 @@ all: run sysroot: 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)mv sysroot/sysroot sysroot/$(ARCH) @@ -133,3 +134,5 @@ clean: $(Q)rm -rf initramfs $(call QUIET_CLEAN, run.out) $(Q)rm -rf run.out + +.PHONY: sysroot/$(ARCH)/include