Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/1] Makefile: Add kernel modules related make targets
Date: Wed, 6 Aug 2025 13:52:17 +0200	[thread overview]
Message-ID: <20250806115217.GB431066@pevik> (raw)
In-Reply-To: <CAEemH2c9h97nC6sj323oG2kDvkcEqxspA5DPRrgK=zGSpEFr6w@mail.gmail.com>

Hi Li, all,

> >> +MODULE_DIRS := commands/insmod \

> > Here should be:

> > -MODULE_DIRS := commands/insmod \
> > +MODULE_DIRS := testcases/commands/insmod \


> Or, if we avoid hard-coding the module dirs, then we don't need
> to amend it when adding new tests later.

> Something maybe like:

> -MODULE_DIRS := commands/insmod \
> -       testcases/kernel/firmware \
> -       testcases/kernel/device-drivers \
> -       testcases/kernel/syscalls/delete_module \
> -       testcases/kernel/syscalls/finit_module \
> -       testcases/kernel/syscalls/init_module
> +MODULE_DIRS := $(shell \
> +  find testcases/ -type f -name 'Makefile' | \
> +  xargs grep -l 'include.*module\.mk' | \
> +  xargs -n1 dirname | \
> +  sort -u \
> +)

nit: at least xargs could be avoided.

MODULE_DIRS := $(shell \
	dirname $(grep -l 'include.*module\.mk' $(find testcases/ -type f -name 'Makefile')) | sort -u
)

Although this works, I wonder if we want to depend on a shell detection like
this (I'd appreciate others' opinion).

Kind regards,
Petr

> >> +       testcases/kernel/firmware \
> >> +       testcases/kernel/device-drivers \
> >> +       testcases/kernel/syscalls/delete_module \
> >> +       testcases/kernel/syscalls/finit_module \
> >> +       testcases/kernel/syscalls/init_module
> >> +
> >> +.PHONY: modules modules-clean modules-install
> >> +modules:
> >> +       @$(foreach dir,$(MODULE_DIRS),\
> >> +               echo "Build $(dir)";\
> >> +               $(MAKE) -C $(abs_srcdir)/$(dir); \
> >> +)
> >> +modules-clean:
> >> +       @$(foreach dir,$(MODULE_DIRS),\
> >> +               echo "Build $(dir)";\
> >> +               $(MAKE) -C $(abs_srcdir)/$(dir) clean; \
> >> +)
> >> +modules-install: modules
> >> +       @$(foreach dir,$(MODULE_DIRS),\
> >> +               echo "Build $(dir)";\
> >> +               $(MAKE) -C $(abs_srcdir)/$(dir) install; \
> >> +)

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-08-06 11:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 10:09 [LTP] [PATCH v2 1/1] Makefile: Add kernel modules related make targets Petr Vorel
2025-08-01 10:20 ` Petr Vorel
2025-08-02  3:59   ` Li Wang via ltp
2025-08-06 11:47     ` Petr Vorel
2025-08-02  3:25 ` Li Wang via ltp
2025-08-02  4:11   ` Li Wang via ltp
2025-08-06 11:52     ` Petr Vorel [this message]
2025-08-06 13:29       ` Cyril Hrubis
2025-08-06 19:49         ` Petr Vorel

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=20250806115217.GB431066@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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