23486: use {fd} syntax to get fd's for tests

This commit is contained in:
Peter Stephenson 2007-05-29 14:50:28 +00:00
parent 29b7123647
commit 52e5a75a7a
6 changed files with 20 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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; }

View file

@ -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
}