about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Test/A01grammar.ztst2
-rw-r--r--Test/C03traps.ztst6
-rw-r--r--Test/D07multibyte.ztst2
-rw-r--r--Test/E01options.ztst2
-rwxr-xr-xTest/ztst.zsh14
6 files changed, 20 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index d8a5342ae..be2afb06a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-05-29  Peter Stephenson  <pws@csr.com>
 
+	* 23486: Test/A01grammar.ztst, Test/C03traps.ztst,
+	Test/D07multibyte.ztst, Test/E01options.ztst, Test/ztst.zsh:
+	Use {fd} syntax to open fd's for tests that won't clash
+	with standard fd's.
+
 	* 23485: Completion/Zsh/Command/_zmodload, Src/cond.c,
 	Src/exec.c, Src/module.c, Src/params.c: completion for
 	zmodload -F; autoloading now requests a specific feature
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 22b6f9c88..41cbe6d8b 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -452,7 +452,7 @@
 >chrysanthemum contains an e
 >Zanzibar either begins with a or an upper case letter
 
-  print 'This test hangs the shell when it fails...' >&8
+  print -u $ZTST_fd 'This test hangs the shell when it fails...'
   name=0
 # The number 4375 here is chosen to produce more than 16384 bytes of output
   while (( name < 4375 )); do
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index 252ccc4cb..a39e1a7d4 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -122,7 +122,7 @@
 # least the full two seconds to make sure we have got the output from the
 # execution of the trap.
 
-  print 'This test takes at least three seconds...' >&8
+  print -u $ZTST_fd 'This test takes at least three seconds...'
   fn1() {
     trap 'print TERM1' TERM
     fn2() { trap 'print TERM2; return 1' TERM; sleep 2; }
@@ -135,7 +135,7 @@
 0: Nested `trap ... TERM', triggered on inner loop
 >TERM2
 
-  print 'This test, too, takes at least three seconds...' >&8
+  print -u $ZTST_fd 'This test, too, takes at least three seconds...'
   fn1() {
     trap 'print TERM1; return 1' TERM
     fn2() { trap 'print TERM2; return 1' TERM; }
@@ -253,7 +253,7 @@
 >Exiting, attempt 2
 >Running exit trap
 
-  print Another test that takes three seconds >&8
+  print -u $ZTST_fd Another test that takes three seconds
   gotsig=0
   signal_handler() {
    echo "parent received signal"
diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index 2e362f751..07140f6e9 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -16,7 +16,7 @@
   if [[ -z $mb_ok ]]; then
     ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented"
   else
-    print Testing multibyte with locale $LANG >&8
+    print -u $ZTST_fd Testing multibyte with locale $LANG
   fi
 
 %test
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 5bbf1b590..f8ab297c0 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -668,7 +668,7 @@
 >hello
 
 # This tests for another race in multios.
-  print 'This test hangs the shell when it fails...' >&8
+  print -u $ZTST_fd 'This test hangs the shell when it fails...'
   setopt multios
   echo These are the contents of the file >multio_race.out
   multio_race_fn() { cat; }
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index bd76a0dc0..cc27c5791 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -147,10 +147,14 @@ $ZTST_failmsg"
 ZTST_verbose() {
   local lev=$1
   shift
-  [[ -n $ZTST_verbose && $ZTST_verbose -ge $lev ]] && print -r -- $* >&8
+  if [[ -n $ZTST_verbose && $ZTST_verbose -ge $lev ]]; then
+    print -r -u $ZTST_fd -- $*
+  fi
 }
 ZTST_hashmark() {
-  [[ ZTST_verbose -le 0 && -t 8 ]] && print -nu8 ${(pl:SECONDS::\#::\#\r:)}
+  if [[ ZTST_verbose -le 0 && -t $ZTST_fd ]]; then
+    print -n -u$ZTST_fd -- ${(pl:SECONDS::\#::\#\r:)}
+  fi
   (( SECONDS > COLUMNS+1 && (SECONDS -= COLUMNS) ))
 }
 
@@ -159,8 +163,8 @@ if [[ ! -r $ZTST_testname ]]; then
   exit 1
 fi
 
-exec 8>&1
-exec 9<$ZTST_testname
+exec {ZTST_fd}>&1
+exec {ZTST_input}<$ZTST_testname
 
 # The current line read from the test file.
 ZTST_curline=''
@@ -172,7 +176,7 @@ ZTST_cursect=''
 ZTST_getline() {
   local IFS=
   while true; do
-    read -r ZTST_curline <&9 || return 1
+    read -u $ZTST_input -r ZTST_curline || return 1
     [[ $ZTST_curline == \#* ]] || return 0
   done
 }