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

Re: [PATCH] find RLIM_NLIMITS correctly on CygwinjL



Daniel Shahaf wrote on Wed, 25 Mar 2020 22:04 +0000:
> Jun T wrote on Wed, 25 Mar 2020 09:16 +0900:
> > > 2020/03/24 11:43, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > > 2020/03/21 2:02, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > >     
> > >> + limit | grep UNKNOWN || print OK    
> > > 
> > > 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.    
> > 
> > So what the fix for this? Is it enough to skip the tests if loading
> > rlimits module fails (because we are testing module features, not
> > module loading)?  
> 
> Yes, I think so.  The patch in 45591 will take care of testing that
> zmodload succeeds.  With that patch, B12limit.ztst can just do
> «if ! zmodload …; ZTST_unimplemented=…» like all other V*ztst files:
> zmodload errors will be caught by 45591.

So, to be concrete, how about the following? —

workers/45591 (with conflicts fixed):

[[[
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index 0a7fbb651..daf49cd72 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -64,7 +64,7 @@
 
  for m in $mods
  do
-   zmodload $m || mods[(r)$m]=()
+   zmodload $m || return $?
  done
 0d:Test loading of all compiled modules
 
diff --git a/Test/V07pcre.ztst b/Test/V07pcre.ztst
index ab67f3d80..15a0982c8 100644
--- a/Test/V07pcre.ztst
+++ b/Test/V07pcre.ztst
@@ -1,11 +1,10 @@
 %prep
 
-  if grep '^name=zsh/pcre .* link=no ' $ZTST_testdir/../config.modules >/dev/null
+  if ! zmodload zsh/pcre 2>/dev/null; then
   then
     ZTST_unimplemented="the zsh/pcre module was disabled by configure (see config.modules)"
     return 0
   fi
-  zmodload zsh/pcre
   setopt rematch_pcre
 # Find a UTF-8 locale.
   setopt multibyte
]]]

Followed by 45584, adjusted for the above:

[[[
diff --git a/Test/B12limit.ztst b/Test/B12limit.ztst
index 922751369..48d33e6e3 100644
--- a/Test/B12limit.ztst
+++ b/Test/B12limit.ztst
@@ -1,4 +1,12 @@
-# check if there is unknown resouce(s)
+
+%prep
+
+  if ! zmodload zsh/rlimits 2>/dev/null
+  then
+    ZTST_unimplemented="the zsh/rlimits module was disabled by configure (see config.modules)"
+    return 0
+  fi
+  zmodload zsh/rlimits
 
 %test
]]]

Cheers,

Daniel



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