mirror of
https://github.com/zsh-users/zsh
synced 2024-07-21 10:14:19 +00:00
23486: use {fd} syntax to get fd's for tests
This commit is contained in:
parent
29b7123647
commit
52e5a75a7a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue