Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] find RLIM_NLIMITS correctly on Cygwin



Daniel Shahaf wrote on Fri, 20 Mar 2020 17:39 +0000:
> Bart Schaefer wrote on Fri, 20 Mar 2020 10:20 -0700:
> > On Fri, Mar 20, 2020 at 10:03 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:  
> > >
> > > The "limit" builtin is provided by a module.  As such, it can be
> > > unavailable if the module had been disabled in config.modules prior to
> > > building.
> > >
> > > Proposed patch:
> > >
> > > +  if grep '^name=zsh/rlimits .* link=no ' $ZTST_testdir/../config.modules >/dev/null    
> > 
> > Wouldn't it be better to test this with "zmodload" rather than attempt
> > to examine the build config?  
> 
> That was my first instinct too, but I just copied what V07pcre.ztst
> did.  If using zmodload is better, then that file should probably be
> updated to that approach too.

Ah, I see.  I think the reason for checking config.modules is because
we need to distinguish between "module had been disabled" and "module
was enabled, but failed to load due to a bug".  That is, we want the
test suite to fail if the module failed to load even though it was
enabled in config.modules.

However, most Test/V*.ztst files use a simple «if ! zmodload zsh/foo; …»
check.

So, I think we should write a ZTST_* helper function that encapsulates
the config.modules check, and then call it as «ZTST_load_or_skip zsh/foo || return $?»
to make sure that V${N}foo.ztst fails if «zmodload zsh/foo» unexpectedly failed.

Makes sense?

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author