Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: w@1wt.eu
Cc: arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, thomas@t-8ch.de
Subject: Re: [PATCH v2 02/14] selftests/nolibc: add macros to enhance maintainability
Date: Tue, 25 Jul 2023 20:37:25 +0800	[thread overview]
Message-ID: <20230725123725.35508-1-falcon@tinylab.org> (raw)
In-Reply-To: <20230722122009.GE17311@1wt.eu>

Hi, Willy

> 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 <falcon@tinylab.org>
> > ---
> >  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.
>

Ok, will reserve less ones as possible as we can.

- RUN_OUT is required for architecture specific output
- REPORT_RUN_OUT is not necessary, will remove it

> 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.
>

I have forgetten to pick an old patch to silence the running log like
this:

    ifeq ($(QUIET_RUN),1)
    LOG_OUT = > "$(RUN_OUT)"
    else
    LOG_OUT = | tee "$(RUN_OUT)"
    endif

Without QUIET_RUN, we can silence the running log with:

    $ make run LOG_OUT="> /dev/null"

It is not meaningful like QUIET_RUN, seems the QUIET_RUN is not
necessary for we have 'grep status' now, so, let's remove this RUN_OUT
too.

Thanks,
Zhangjin

> Thanks,
> Willy

  reply	other threads:[~2023-07-25 12:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-19 13:16 [PATCH v2 00/14] selftests/nolibc: add minimal kernel config support - part1 Zhangjin Wu
2023-07-19 13:17 ` [PATCH v2 01/14] selftests/nolibc: allow report with existing test log Zhangjin Wu
2023-07-19 13:19 ` [PATCH v2 02/14] selftests/nolibc: add macros to enhance maintainability Zhangjin Wu
2023-07-22 12:20   ` Willy Tarreau
2023-07-25 12:37     ` Zhangjin Wu [this message]
2023-07-19 13:20 ` [PATCH v2 03/14] selftests/nolibc: print running log to screen Zhangjin Wu
2023-07-22 12:29   ` Willy Tarreau
2023-07-25 12:46     ` Zhangjin Wu
2023-07-19 13:21 ` [PATCH v2 04/14] selftests/nolibc: fix up O= option support Zhangjin Wu
2023-07-19 13:22 ` [PATCH v2 05/14] selftests/nolibc: add menuconfig for development Zhangjin Wu
2023-07-22 12:35   ` Willy Tarreau
2023-07-25 13:51     ` Zhangjin Wu
2023-07-27 13:24       ` Zhangjin Wu
2023-07-29  8:22         ` Willy Tarreau
2023-07-29 13:54           ` Zhangjin Wu
2023-07-19 13:23 ` [PATCH v2 06/14] selftests/nolibc: add mrproper " Zhangjin Wu
2023-07-22 12:36   ` Willy Tarreau
2023-07-19 13:24 ` [PATCH v2 07/14] selftests/nolibc: defconfig: remove mrproper target Zhangjin Wu
2023-07-22 12:46   ` Willy Tarreau
2023-07-25 14:04     ` Zhangjin Wu
2023-07-19 13:26 ` [PATCH v2 08/14] selftests/nolibc: string the core targets Zhangjin Wu
2023-07-22 12:57   ` Willy Tarreau
2023-07-25 14:20     ` Zhangjin Wu
2023-07-29  7:53       ` Willy Tarreau
2023-07-29  9:54         ` Zhangjin Wu
2023-07-29 17:15           ` Willy Tarreau
2023-07-29 17:44             ` Zhangjin Wu
2023-07-19 13:27 ` [PATCH v2 09/14] selftests/nolibc: allow quit qemu-system when poweroff fails Zhangjin Wu
2023-07-22 13:02   ` Willy Tarreau
2023-07-25 14:59     ` Zhangjin Wu
2023-07-29  8:04       ` Willy Tarreau
2023-07-19 13:28 ` [PATCH v2 10/14] selftests/nolibc: allow customize CROSS_COMPILE by architecture Zhangjin Wu
2023-07-19 13:29 ` [PATCH v2 11/14] selftests/nolibc: customize CROSS_COMPILE for 32/64-bit powerpc Zhangjin Wu
2023-07-19 13:30 ` [PATCH v2 12/14] selftests/nolibc: add tinyconfig target Zhangjin Wu
2023-07-22 13:07   ` Willy Tarreau
2023-07-25 15:13     ` Zhangjin Wu
2023-07-19 13:31 ` [PATCH v2 13/14] selftests/nolibc: tinyconfig: add extra common options Zhangjin Wu
2023-07-19 13:32 ` [PATCH v2 14/14] selftests/nolibc: tinyconfig: add support for 32/64-bit powerpc Zhangjin Wu
2023-07-22 13:17   ` Willy Tarreau
2023-07-25 16:04     ` Zhangjin Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230725123725.35508-1-falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox