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

PATCH: test system.



Two test system changes which someone more sophisticated would have sent
separately.

First, it's now possible to have lines beginning with `F:' to show text
to be displayed if a test failed.  Can someone confirm that the text for
the NFS -N condition failure is appropriate?

Second, changes for Dan's patch for xtrace quoting.  Someone really to
look in more detail to see if quoting has now appeared in all the right
places, but it looked OK at first sight.

I also felt some case-parenthesis fascism coming on.

Index: Test/C02cond.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C02cond.ztst,v
retrieving revision 1.12
diff -u -r1.12 C02cond.ztst
--- Test/C02cond.ztst	17 Apr 2002 17:17:42 -0000	1.12
+++ Test/C02cond.ztst	5 Aug 2002 12:07:37 -0000
@@ -135,6 +135,9 @@
     [[ -N newnewnew && ! -N unmodified ]]
   fi
 0:-N cond
+F:This test can fail on NFS-mounted filesystems as the access and
+F:modification times are not updated separately.  This does not indicate
+F:a problem in the shell.
 
   [[ newnewnew -nt zerolength && ! (unmodified -nt zerolength) ]]
 0:-nt cond
Index: Test/E02xtrace.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/E02xtrace.ztst,v
retrieving revision 1.4
diff -u -r1.4 E02xtrace.ztst
--- Test/E02xtrace.ztst	22 Aug 2001 15:59:27 -0000	1.4
+++ Test/E02xtrace.ztst	5 Aug 2002 12:07:37 -0000
@@ -55,32 +55,32 @@
 >Tracing: function 2>file
 >Tracing: source
 >Tracing: source 2>file
->+(eval):7> print Tracing: ( builtin ) 2>file
+>+(eval):7> print 'Tracing: ( builtin ) 2>file'
 >+(eval):9> cat
->+(eval):11> print Tracing: { builtin } 2>file
+>+(eval):11> print 'Tracing: { builtin } 2>file'
 >+(eval):13> cat
->+(eval):15> print Tracing: do builtin done 2>file
+>+(eval):15> print 'Tracing: do builtin done 2>file'
 >+(eval):17> cat
-?+(eval):2> print Tracing: builtin
-?+(eval):3> print Tracing: builtin 2>file
+?+(eval):2> print 'Tracing: builtin'
+?+(eval):3> print 'Tracing: builtin 2>file'
 ?+(eval):4> cat
 ?+(eval):5> cat
-?+(eval):6> print Tracing: ( builtin )
+?+(eval):6> print 'Tracing: ( builtin )'
 ?+(eval):8> cat
-?+(eval):10> print Tracing: { builtin }
+?+(eval):10> print 'Tracing: { builtin }'
 ?+(eval):12> cat
-?+(eval):14> print Tracing: do builtin done
+?+(eval):14> print 'Tracing: do builtin done'
 ?+(eval):16> cat
-?+(eval):18> xtf Tracing: function
+?+(eval):18> xtf 'Tracing: function'
 ?+xtf:1> local regression_test_dummy_variable
-?+xtf:2> print Tracing: function
-?+(eval):19> xtf Tracing: function 2>file
+?+xtf:2> print 'Tracing: function'
+?+(eval):19> xtf 'Tracing: function 2>file'
 ?+xtf:1> local regression_test_dummy_variable
-?+xtf:2> print Tracing: function 2>file
-?+(eval):20> . ./xt.in Tracing: source
-?+./xt.in:1> print Tracing: source
-?+(eval):21> . ./xt.in Tracing: source 2>file
-?+./xt.in:1> print Tracing: source 2>file
+?+xtf:2> print 'Tracing: function 2>file'
+?+(eval):20> . ./xt.in 'Tracing: source'
+?+./xt.in:1> print 'Tracing: source'
+?+(eval):21> . ./xt.in 'Tracing: source 2>file'
+?+./xt.in:1> print 'Tracing: source 2>file'
 ?+(eval):22> set +x
 
  typeset -ft xtf
@@ -88,4 +88,4 @@
 0:
 >Tracing: function
 ?+xtf:1> local regression_test_dummy_variable
-?+xtf:2> print Tracing: function
+?+xtf:2> print 'Tracing: function'
Index: Test/ztst.zsh
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/ztst.zsh,v
retrieving revision 1.17
diff -u -r1.17 ztst.zsh
--- Test/ztst.zsh	5 Jul 2001 14:51:35 -0000	1.17
+++ Test/ztst.zsh	5 Aug 2002 12:07:37 -0000
@@ -101,6 +101,10 @@
     print -r "Was testing: $ZTST_message"
   fi
   print -r "$ZTST_testname: test failed."
+  if [[ -n $ZTST_failmsg ]]; then
+    print -r "The following may (or may not) help identifying the cause:
+$ZTST_failmsg"
+  fi
   ZTST_testfailed=1
   return 1
 }
@@ -195,13 +199,13 @@
 $ZTST_redir"
 
 case $char in
-  '<') fn=$ZTST_in
+  ('<') fn=$ZTST_in
        ;;
-  '>') fn=$ZTST_out
+  ('>') fn=$ZTST_out
        ;;
-  '?') fn=$ZTST_err
+  ('?') fn=$ZTST_err
        ;;
-   *)  ZTST_testfailed "bad redir operator: $char"
+  ( *)  ZTST_testfailed "bad redir operator: $char"
        return 1
        ;;
 esac
@@ -260,6 +264,7 @@
     rm -f $ZTST_in $ZTST_out $ZTST_err
     touch $ZTST_in $ZTST_out $ZTST_err
     ZTST_message=''
+    ZTST_failmsg=''
     found=0
 
     ZTST_verbose 2 "ZTST_test: looking for new test"
@@ -268,14 +273,14 @@
       ZTST_verbose 2 "ZTST_test: examining line:
 $ZTST_curline"
       case $ZTST_curline in
-	%*) if [[ $found = 0 ]]; then
+	(%*) if [[ $found = 0 ]]; then
 	      break 2
 	    else
 	      last=1
 	      break
 	    fi
 	    ;;
-	[[:space:]]#)
+	([[:space:]]#)
 	    if [[ $found = 0 ]]; then
 	      ZTST_getline || break 2
 	      continue
@@ -283,7 +288,7 @@
 	      break
 	    fi
 	    ;;
-	[[:space:]]##[^[:space:]]*) ZTST_getchunk
+	([[:space:]]##[^[:space:]]*) ZTST_getchunk
 	  if [[ $ZTST_curline == (#b)([-0-9]##)([[:alpha:]]#)(:*)# ]]; then
 	    ZTST_xstatus=$match[1]
 	    ZTST_flags=$match[2]
@@ -296,16 +301,21 @@
 	  ZTST_getline
 	  found=1
 	  ;;
-	'<'*) ZTST_getredir || return 1
+	('<'*) ZTST_getredir || return 1
 	  found=1
 	  ;;
-	'>'*) ZTST_getredir || return 1
+	('>'*) ZTST_getredir || return 1
 	  found=1
 	  ;;
-	'?'*) ZTST_getredir || return 1
+	('?'*) ZTST_getredir || return 1
 	  found=1
 	  ;;
-	*) ZTST_testfailed "bad line in test block:
+	('F:'*) ZTST_failmsg="${ZTST_failmsg:+${ZTST_failmsg}
+}  ${ZTST_curline[3,-1]}"
+	  ZTST_getline
+	  found=1
+          ;;
+	(*) ZTST_testfailed "bad line in test block:
 $ZTST_curline"
 	  return 1
           ;;
@@ -373,7 +383,7 @@
 ZTST_unimplemented=
 while [[ -z "$ZTST_unimplemented" ]] && ZTST_getsect $ZTST_skipok; do
   case $ZTST_cursect in
-    prep) if (( ${ZTST_sects[prep]} + ${ZTST_sects[test]} + \
+    (prep) if (( ${ZTST_sects[prep]} + ${ZTST_sects[test]} + \
 	        ${ZTST_sects[clean]} )); then
 	    ZTST_testfailed "\`prep' section must come first"
             exit 1
@@ -381,7 +391,7 @@
 	  ZTST_prepclean
 	  ZTST_sects[prep]=1
 	  ;;
-    test)
+    (test)
 	  if (( ${ZTST_sects[test]} + ${ZTST_sects[clean]} )); then
 	    ZTST_testfailed "bad placement of \`test' section"
 	    exit 1
@@ -392,7 +402,7 @@
 	  (( $? )) && ZTST_skipok=1
 	  ZTST_sects[test]=1
 	  ;;
-    clean)
+    (clean)
 	   if (( ${ZTST_sects[test]} == 0 || ${ZTST_sects[clean]} )); then
 	     ZTST_testfailed "bad use of \`clean' section"
 	   else

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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