[LTP] [PATCH v4 2/2] modules.mk: Add FORCE_MODULES=1 to fail on error

Petr Vorel pvorel@suse.cz
Fri Aug 15 08:14:05 CEST 2025


Hi Li,

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

I guess you're talking about the 'make modules' exit code, right?
NOTE: I don't expect this target would be run in production builds (e.g. rpm
or other package creation), I want to add it to CI and use in manual debugging.

With the change above we're implementing 2. I'm not sure what is the best.
Failing on first error hides other errors, but it's easier to spot the error,
therefore I tend to this variant.

1. is good to see all failures, but one can overlook the result. If we decide
about it, I would prefer to exit non-zero if any of the modules fail (let's call
it variant 3.).

> > 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 $$?; \

Ah, that's of course better. I was obviously not concentrated enough.

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

Right, I'll add it.

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

+1

> For modules-install: fail fast by default to avoid a partially
> installed tree is necessary.

+1

I'll send v5 during today (wait little longer for your feedback).

Kind regards,
Petr


More information about the ltp mailing list