Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1035548rwo; Sat, 22 Jul 2023 05:28:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlGqHNC0CWKk3GlXndSiUMmmDZftYzU9IF/ks/xScr6xEyRBFLlz+zremNNv6KjqEEWV5WCp X-Received: by 2002:a05:6a20:1609:b0:133:449c:677c with SMTP id l9-20020a056a20160900b00133449c677cmr4570232pzj.58.1690028912375; Sat, 22 Jul 2023 05:28:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690028912; cv=none; d=google.com; s=arc-20160816; b=ZsjHRQ6wvSm+Jx/Jh3hRtEFzc7IN3D/0z8h+QmoAX6SmRQY2nmjMCZ2/K6utEMNL8h kDrOSEwGGXn8ESqAqEkAGdV1tPaMgY2zesPG+Or2EYyeJWeKS/N8CY/wjbuGwlQNFJVj tQQTIn/WHZy8FeGzrUtymVWa6TaQXi7kqOmBmsXfmQixkbGpNpySV6eHN/OVT1wt/oG7 fSLWh57IoJWaQMvxvDNHaiU4tja0a9t/nZUyk2VY/AM2lGJeVznrt4gMIHCTMgGPgS86 oN2f/PTRTk3dTCq1IhIDSVvnF79DUOluRwo+zC1OO1H75t+hhugIf1BfBO4GDMdfQybN bnbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iNBnnN2WnHtYqwdWJqOxjUoIqHf+I6osjsGyKA1kOVA=; fh=ujwW7c4tbJyQEFqfHDIuJXTy68vjNzYK6N7f8YmL270=; b=f5uInpm/QDMGuKUPVTAuz9TNRYv76Ys5r0AkjYfSablDe+3wqJheAe7jRvazDnAXL6 OC/j4/0aPwLQUeBII+mI/JiTRYwvrDJth3+FyM9WedbvHinh45+qBdlmcCw5S21Ymunu 7VcHAXRTx+5MldBwDMX+0WVZTgemb2fH4p80Ep25auF19TdcsSBjvG7RwTW5m1E+VSZj AR7OWAPEJ0w18dMuyIS733gh3tKY5rXuewpwTSBrIedm8ymaPlaYgv8p0pMyxGq2xNfO pnXWj3m+hyacCf8rymuSyhG7Ejgrb623GxFWSRuQFxovktVsALH3oaGpd7UVkffoWiSY hlVA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a65688c000000b005579e1fc429si4999819pgt.669.2023.07.22.05.28.20; Sat, 22 Jul 2023 05:28:32 -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 S229760AbjGVMUT (ORCPT + 99 others); Sat, 22 Jul 2023 08:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjGVMUT (ORCPT ); Sat, 22 Jul 2023 08:20:19 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E3BE89B; Sat, 22 Jul 2023 05:20:17 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 36MCK93g017357; Sat, 22 Jul 2023 14:20:09 +0200 Date: Sat, 22 Jul 2023 14:20:09 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: thomas@t-8ch.de, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 02/14] selftests/nolibc: add macros to enhance maintainability Message-ID: <20230722122009.GE17311@1wt.eu> References: <0415392c9c2b0a7249563abd79599a475019b508.1689759351.git.falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0415392c9c2b0a7249563abd79599a475019b508.1689759351.git.falcon@tinylab.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, Jul 19, 2023 at 09:19:10PM +0800, Zhangjin Wu wrote: > 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 share the same logging related settings, let's add common > variables RUN_OUT, LOG_OUT and REPORT_RUN_OUT for them. > > The qemu run/rerun targets share the same qemu system run command, add > QEMU_SYSTEM_RUN for them. > > Signed-off-by: Zhangjin Wu > --- > tools/testing/selftests/nolibc/Makefile | 41 ++++++++++++++++--------- > 1 file changed, 27 insertions(+), 14 deletions(-) > > diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile > index 0cd17de2062c..8c531518bb9f 100644 > --- a/tools/testing/selftests/nolibc/Makefile > +++ b/tools/testing/selftests/nolibc/Makefile > @@ -166,45 +166,58 @@ endif > libc-test: nolibc-test.c > $(QUIET_CC)$(CC) -o $@ $< > > +# common macros for logging > +RUN_OUT = $(CURDIR)/run.out > +LOG_OUT = > "$(RUN_OUT)" > +REPORT_RUN_OUT = $(REPORT) "$(RUN_OUT)" > + > # local libc-test > run-libc-test: libc-test > - $(Q)./libc-test > "$(CURDIR)/run.out" || : > - $(Q)$(REPORT) $(CURDIR)/run.out > + $(Q)./libc-test $(LOG_OUT) || : > + $(Q)$(REPORT_RUN_OUT) Sorry but I don't find that this improves maintainability, quite the opposite in fact. One reason is that you never visually expect that some shell indirection delimiters are hidden in a macro that seems to only convey a name. Sure there are valid use cases for this, but I think that here it's just adding too much abstraction and it makes it quite hard to unfold all of this mentally. Please try to keep the number of macros to the minimum that needs to be replaced or forced by the user. Here I'm not seeing a compelling reason for a user to want to force LOG_OUT to something else. Also makefile macros are generally a pain to debug, which is another reason for not putting too many of them. I noticed that your next patch changes LOG_OUT to tee, it could have done it everywhere and wouldn't affect readability as much. Thanks, Willy