mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-07 23:51:14 +02:00
23486: use {fd} syntax to get fd's for tests
This commit is contained in:
parent
29b7123647
commit
52e5a75a7a
6 changed files with 20 additions and 11 deletions
|
@ -1,5 +1,10 @@
|
||||||
2007-05-29 Peter Stephenson <pws@csr.com>
|
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,
|
* 23485: Completion/Zsh/Command/_zmodload, Src/cond.c,
|
||||||
Src/exec.c, Src/module.c, Src/params.c: completion for
|
Src/exec.c, Src/module.c, Src/params.c: completion for
|
||||||
zmodload -F; autoloading now requests a specific feature
|
zmodload -F; autoloading now requests a specific feature
|
||||||
|
|
|
@ -452,7 +452,7 @@
|
||||||
>chrysanthemum contains an e
|
>chrysanthemum contains an e
|
||||||
>Zanzibar either begins with a or an upper case letter
|
>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
|
name=0
|
||||||
# The number 4375 here is chosen to produce more than 16384 bytes of output
|
# The number 4375 here is chosen to produce more than 16384 bytes of output
|
||||||
while (( name < 4375 )); do
|
while (( name < 4375 )); do
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
# least the full two seconds to make sure we have got the output from the
|
# least the full two seconds to make sure we have got the output from the
|
||||||
# execution of the trap.
|
# 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() {
|
fn1() {
|
||||||
trap 'print TERM1' TERM
|
trap 'print TERM1' TERM
|
||||||
fn2() { trap 'print TERM2; return 1' TERM; sleep 2; }
|
fn2() { trap 'print TERM2; return 1' TERM; sleep 2; }
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
0: Nested `trap ... TERM', triggered on inner loop
|
0: Nested `trap ... TERM', triggered on inner loop
|
||||||
>TERM2
|
>TERM2
|
||||||
|
|
||||||
print 'This test, too, takes at least three seconds...' >&8
|
print -u $ZTST_fd 'This test, too, takes at least three seconds...'
|
||||||
fn1() {
|
fn1() {
|
||||||
trap 'print TERM1; return 1' TERM
|
trap 'print TERM1; return 1' TERM
|
||||||
fn2() { trap 'print TERM2; return 1' TERM; }
|
fn2() { trap 'print TERM2; return 1' TERM; }
|
||||||
|
@ -253,7 +253,7 @@
|
||||||
>Exiting, attempt 2
|
>Exiting, attempt 2
|
||||||
>Running exit trap
|
>Running exit trap
|
||||||
|
|
||||||
print Another test that takes three seconds >&8
|
print -u $ZTST_fd Another test that takes three seconds
|
||||||
gotsig=0
|
gotsig=0
|
||||||
signal_handler() {
|
signal_handler() {
|
||||||
echo "parent received signal"
|
echo "parent received signal"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
if [[ -z $mb_ok ]]; then
|
if [[ -z $mb_ok ]]; then
|
||||||
ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented"
|
ZTST_unimplemented="no UTF-8 locale or multibyte mode is not implemented"
|
||||||
else
|
else
|
||||||
print Testing multibyte with locale $LANG >&8
|
print -u $ZTST_fd Testing multibyte with locale $LANG
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%test
|
%test
|
||||||
|
|
|
@ -668,7 +668,7 @@
|
||||||
>hello
|
>hello
|
||||||
|
|
||||||
# This tests for another race in multios.
|
# 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
|
setopt multios
|
||||||
echo These are the contents of the file >multio_race.out
|
echo These are the contents of the file >multio_race.out
|
||||||
multio_race_fn() { cat; }
|
multio_race_fn() { cat; }
|
||||||
|
|
|
@ -147,10 +147,14 @@ $ZTST_failmsg"
|
||||||
ZTST_verbose() {
|
ZTST_verbose() {
|
||||||
local lev=$1
|
local lev=$1
|
||||||
shift
|
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_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) ))
|
(( SECONDS > COLUMNS+1 && (SECONDS -= COLUMNS) ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,8 +163,8 @@ if [[ ! -r $ZTST_testname ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec 8>&1
|
exec {ZTST_fd}>&1
|
||||||
exec 9<$ZTST_testname
|
exec {ZTST_input}<$ZTST_testname
|
||||||
|
|
||||||
# The current line read from the test file.
|
# The current line read from the test file.
|
||||||
ZTST_curline=''
|
ZTST_curline=''
|
||||||
|
@ -172,7 +176,7 @@ ZTST_cursect=''
|
||||||
ZTST_getline() {
|
ZTST_getline() {
|
||||||
local IFS=
|
local IFS=
|
||||||
while true; do
|
while true; do
|
||||||
read -r ZTST_curline <&9 || return 1
|
read -u $ZTST_input -r ZTST_curline || return 1
|
||||||
[[ $ZTST_curline == \#* ]] || return 0
|
[[ $ZTST_curline == \#* ]] || return 0
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue