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

Re: Test/V01private.ztst skipped (was: zsh 5.1.1-test-1)



On Nov 21,  5:14pm, Bart Schaefer wrote:
}
} So obviously the 2>/dev/null is in the wrong place.
} 
} No response to my grumbling in workers/37086 ...

I went through all the tests that use zmodload, forced zmodload to fail
by copying /dev/null on top of the corresponding .so file, and then
checked the output of the test.

The following patch makes all tests as consistent as context permits.
This replaces 37178.  "make check" passes all with these changes. 

One interesting point:  If zsh/datetime cannot be loaded, we don't
test any of the "features" functionality in V04features.ztst.  Should
this be considered failure rather than unimplemented?  I left it as
it was for now.


diff --git a/Test/C02cond.ztst b/Test/C02cond.ztst
index e9a596a..40bbf42 100644
--- a/Test/C02cond.ztst
+++ b/Test/C02cond.ztst
@@ -257,7 +257,7 @@ F:Failures in these cases do not indicate a problem in the shell.
 >status = 1
 
 # core dumps on failure
-  if zmodload -i zsh/regex 2>/dev/null; then
+  if zmodload zsh/regex 2>/dev/null; then
      echo >regex_test.sh 'if [[ $# = 1 ]]; then
 	if [[ $1 =~ /?[^/]+:[0-9]+:$ ]]; then
 	  :
@@ -268,7 +268,8 @@ F:Failures in these cases do not indicate a problem in the shell.
   fi
 0:regex tests shouldn't crash
 
-  (if zmodload -i zsh/regex 2>/dev/null; then
+  if zmodload zsh/regex 2>/dev/null; then
+   ( # subshell in case coredump test failed
     string="this has stuff in it"
     bad_regex=0
     if [[ $string =~ "h([a-z]*) s([a-z]*) " ]]; then
@@ -295,23 +296,26 @@ F:Failures in these cases do not indicate a problem in the shell.
     else
       print -r "regex failed to match '$string'"
     fi
+   )
   else
     # if it didn't load, tough, but not a test error
-    print OK
-  fi)
+    ZTST_skip="regexp library not found."
+  fi
 0:MATCH, MBEGIN, MEND, match, mbegin, mend
 >OK
 
-  (if zmodload -i zsh/regex 2>/dev/null; then
+  if zmodload zsh/regex 2>/dev/null; then
+   ( # subshell because regex module may dump core, see above
     if [[ a =~ a && b == b ]]; then
       print OK
     else
       print "regex =~ inverted following test"
     fi
+   )
   else
     # not a test error
-    print OK
-  fi)
+    ZTST_skip="regexp library not found."
+  fi
 0:regex infix operator should not invert following conditions
 >OK
 
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index dff2ec1..f95c06d 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -500,7 +500,7 @@
 # aren't quite double width, but the arithmetic is correct.
 # It appears just to be an effect of the font.
 
-  if zmodload -i zsh/regex 2>/dev/null; then
+  if zmodload zsh/regex 2>/dev/null; then
     [[ $'\ua0' =~ '^.$' ]] && print OK
     [[ $'\ua0' =~ $'^\ua0$' ]] && print OK
     [[ $'\ua0'X =~ '^X$' ]] || print OK
diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst
index 3580bac..349ae9c 100644
--- a/Test/V01zmodload.ztst
+++ b/Test/V01zmodload.ztst
@@ -52,7 +52,7 @@
 >zmodload zsh/main
 >zmodload zsh/parameter
 
-# You use to need zmodload -i to avoid an error.
+# You used to need zmodload -i to avoid an error.
 # That has been deemed pointless, so now an attempt
 # to load a loaded module should succeed.
  zmodload zsh/main
@@ -64,7 +64,7 @@
 
  for m in $mods
  do
-   zmodload -i $m || mods[(r)$m]=()
+   zmodload $m || mods[(r)$m]=()
  done
 0d:Test loading of all compiled modules
 
@@ -74,7 +74,7 @@
 # Now check for proper failure conditions by trying some operations on
 # a nonexistent module.
 
- zmodload -i bogus/notamodule
+ zmodload bogus/notamodule
 1D:Check that loading a nonexistent module fails
 
  zmodload -u bogus/notamodule
diff --git a/Test/V02zregexparse.ztst b/Test/V02zregexparse.ztst
index ddca3c9..b4cec42 100644
--- a/Test/V02zregexparse.ztst
+++ b/Test/V02zregexparse.ztst
@@ -2,7 +2,9 @@
 
 %prep
 
-  zmodload zsh/zutil
+ if ! zmodload zsh/zutil 2>/dev/null; then
+   ZTST_unimplemented="can't load the zsh/zutil module for testing"
+ fi
 
 %test
 
diff --git a/Test/V03mathfunc.ztst b/Test/V03mathfunc.ztst
index ab383db..1edb7a2 100644
--- a/Test/V03mathfunc.ztst
+++ b/Test/V03mathfunc.ztst
@@ -1,9 +1,7 @@
 # Tests for the module zsh/mathfunc
 
 %prep
-  if ( zmodload -i zsh/mathfunc ) >/dev/null 2>&1; then
-    zmodload -i zsh/mathfunc
-  else
+  if ! zmodload zsh/mathfunc 2>/dev/null; then
     ZTST_unimplemented="The module zsh/mathfunc is not available."
   fi
 
@@ -112,7 +110,6 @@ F:This test fails if your math library doesn't have erand48().
   float -F f sum sumsq max max2 av sd
   typeset -a randoms
   randoms=('f = RANDOM' 'f = rand48()')
-  zmodload -i zsh/mathfunc
   for isource in 1 2; do
     (( sum = sumsq = max = 0 ))
     repeat $N; do
diff --git a/Test/V04features.ztst b/Test/V04features.ztst
index 2790456..6939053 100644
--- a/Test/V04features.ztst
+++ b/Test/V04features.ztst
@@ -7,7 +7,8 @@
 # We use zsh/datetime because it has a list of features that is short
 # but contains two types.
 
-  if ! (zmodload zsh/datetime >/dev/null 2>/dev/null); then
+  # Subshell for prep test so we can load individual features later
+  if ! (zmodload zsh/datetime 2>/dev/null); then
     ZTST_unimplemented="can't load the zsh/datetime module for testing"
   fi
 
diff --git a/Test/V05styles.ztst b/Test/V05styles.ztst
index e932b54..ca95b63 100644
--- a/Test/V05styles.ztst
+++ b/Test/V05styles.ztst
@@ -2,9 +2,7 @@
 
 # Test the use of styles, if the zsh/zutil module is available.
 
-  if (zmodload zsh/zutil >/dev/null 2>/dev/null); then
-    zmodload zsh/zutil
-  else
+  if ! zmodload zsh/zutil 2>/dev/null; then
     ZTST_unimplemented="can't load the zsh/zutil module for testing"
   fi
 
diff --git a/Test/V09datetime.ztst b/Test/V09datetime.ztst
index 1e677cd..63ff4ee 100644
--- a/Test/V09datetime.ztst
+++ b/Test/V09datetime.ztst
@@ -1,18 +1,18 @@
 %prep
 
-  if ! (zmodload zsh/datetime >/dev/null 2>/dev/null); then
+  if zmodload zsh/datetime 2>/dev/null; then
+    setopt multibyte
+    unset LC_ALL
+    LC_TIME=C
+    TZ=UTC+0
+    # It's not clear this skip_extensions is correct, but the
+    # format in question is causing problems on Solaris.
+    # We'll revist this after the release.
+    [[ "$(strftime %^_10B 0)" = "   JANUARY" ]] || skip_extensions=1
+    [[ "$(LC_TIME=ja_JP.UTF-8 strftime %OS 1)" = � ]] || skip_japanese=1
+  else
     ZTST_unimplemented="can't load the zsh/datetime module for testing"
   fi
-  setopt multibyte
-  zmodload zsh/datetime
-  unset LC_ALL
-  LC_TIME=C
-  TZ=UTC+0
-  # It's not clear this skip_extensions is correct, but the
-  # format in question is causing problems on Solaris.
-  # We'll revist this after the release.
-  [[ "$(strftime %^_10B 0)" = "   JANUARY" ]] || skip_extensions=1
-  [[ "$(LC_TIME=ja_JP.UTF-8 strftime %OS 1)" = � ]] || skip_japanese=1
 
 %test
 
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index 6c38e39..c66f175 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -2,10 +2,9 @@
 
 %prep
 
- if ! (zmodload zsh/param/private >/dev/null 2>/dev/null); then
+ if ! zmodload zsh/param/private 2>/dev/null; then
    ZTST_unimplemented="can't load the zsh/param/private module for testing"
  fi
- zmodload zsh/param/private
 
 %test
 
diff --git a/Test/X02zlevi.ztst b/Test/X02zlevi.ztst
index 14bc02e..ced7030 100644
--- a/Test/X02zlevi.ztst
+++ b/Test/X02zlevi.ztst
@@ -3,7 +3,7 @@
 %prep
   if [[ $OSTYPE = cygwin ]]; then
     ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
-  elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+  elif ( zmodload zsh/zpty 2>/dev/null ); then
     . $ZTST_srcdir/comptest
     comptestinit -v -z $ZTST_testdir/../Src/zsh
   else
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 383e652..1568369 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -3,7 +3,7 @@
 %prep
   if [[ $OSTYPE = cygwin ]]; then
     ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
-  elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+  elif ( zmodload zsh/zpty 2>/dev/null ); then
     . $ZTST_srcdir/comptest
     mkdir comp.tmp
     cd comp.tmp
diff --git a/Test/Y02compmatch.ztst b/Test/Y02compmatch.ztst
index db734fa..e2f8e1a 100644
--- a/Test/Y02compmatch.ztst
+++ b/Test/Y02compmatch.ztst
@@ -13,7 +13,7 @@
 %prep
   if [[ $OSTYPE = cygwin ]]; then
     ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
-  elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+  elif ( zmodload zsh/zpty 2>/dev/null ); then
     . $ZTST_srcdir/comptest
     mkdir match.tmp
     cd match.tmp
diff --git a/Test/Y03arguments.ztst b/Test/Y03arguments.ztst
index 0627104..0147c7d 100644
--- a/Test/Y03arguments.ztst
+++ b/Test/Y03arguments.ztst
@@ -3,7 +3,7 @@
 %prep
   if [[ $OSTYPE = cygwin ]]; then
     ZTST_unimplemented="the zsh/zpty module does not work on Cygwin"
-  elif ( zmodload -i zsh/zpty ) >/dev/null 2>&1; then
+  elif ( zmodload zsh/zpty 2>/dev/null ); then
     . $ZTST_srcdir/comptest
     mkdir comp.tmp
     cd comp.tmp
diff --git a/Test/comptest b/Test/comptest
index 20a3a5b..f10739a 100644
--- a/Test/comptest
+++ b/Test/comptest
@@ -5,7 +5,7 @@ comptestinit () {
           $ZTST_srcdir/../Completion
           $ZTST_srcdir/../Completion/*/*~*/CVS(/) )
 
-  zmodload -i zsh/zpty || return $?
+  zmodload zsh/zpty || return $?
 
   comptest_zsh=${ZSH:-zsh}
   comptest_keymap=e
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index ce89a83..cdd84b5 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -41,7 +41,7 @@ export MODULE_PATH
 
 # We need to be able to save and restore the options used in the test.
 # We use the $options variable of the parameter module for this.
-zmodload -i zsh/parameter
+zmodload zsh/parameter
 
 # Note that both the following are regular arrays, since we only use them
 # in whole array assignments to/from $options.

-- 
Barton E. Schaefer



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