[LTP] [PATCH v4 2/2] modules.mk: Add FORCE_MODULES=1 to fail on error
Li Wang
liwang@redhat.com
Fri Aug 15 01:57:08 CEST 2025
On Thu, Aug 14, 2025 at 9:19 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Li,
>
> > Hi Petr,
>
> > I am still trying to make sure my understanding is correct on
> > 'FORCE_MODULES=1',
> > which one below do you mean:
>
> > 1. If a subdirectory fails, it stops for that subdirectory but the
> > top-level make
> > continues with the next directory in the list.
>
> > 2. The top-level build should stop immediately when any subdirectory
> > fails.
>
> > If the answer is (1), I believe our current patch is correct (feel free to
> > add my RBT).
> > However, if the intended behavior is (2), we will need to amend the
> > top-level Makefile
> > to ensure the build stops at the first failure.
>
> I intended 1., but exit afterwards non-zero on error. But this actually is not
> true. => v5 is needed.
>
> The reason for 1. was to see which modules failed (all of them).
> Maybe it'd be enough to implement 2.
Yes, but FORCE_MODULES=1 is still make sense, people may not like
to see the module's error stop the build every time.
>
> This works for me (sending v5 today):
> - $(MAKE) -C $(abs_srcdir)/$(dir); \
> + $(MAKE) -C $(abs_srcdir)/$(dir); [ $$? -eq 0 ] || exit exit $$?; \
Why not:
$(MAKE) -C $(abs_srcdir)/$(dir) || exit $$?; \
>
> I wonder if it's enough to add the change only to 'modules' target or whether I
> should add it to the others (modules-clean, modules-install) as well.
To ensures consistent and correct error handling, we probably need to
take care all.
Normally, we wouldn't encounter cleanup/installation errors, but imagine if
modules-clean failed in a subdirectory but continued silently. We might think
everything was cleaned, but outdated .ko or .o files might remain.
For modules-install: fail fast by default to avoid a partially
installed tree is necessary.
--
Regards,
Li Wang
More information about the ltp
mailing list