mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
shtests: cd to each test set's temp dir before running
An oops in tests/io.sh (re: c607c48c
) wrote temporary files outside
$tmp and into src/cmd/ksh93/tests. Let's fix this properly so it
doesn't happen again.
src/cmd/ksh93/tests/shtests:
- Start each test set in its own temporary directory by default.
src/cmd/ksh93/tests/*.sh:
- Refuse to run if $tmp != $PWD.
- Related cleanups.
This commit is contained in:
parent
55f0f8ce52
commit
5395641036
51 changed files with 63 additions and 82 deletions
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
alias foo='print hello'
|
||||
if [[ $(foo) != hello ]]
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
{
|
||||
x=abc
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
trap '' FPE # NOTE: osf.alpha requires this (no ieee math)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function fun
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
for ((i=0; i < 4; i++ ))
|
||||
do for ((j=0; j < 5; j++ ))
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
r=readonly u=Uppercase l=Lowercase i=22 i8=10 L=abc L5=def uL5=abcdef xi=20
|
||||
x=export t=tagged H=hostname LZ5=026 RZ5=026 Z5=123 lR5=ABcdef R5=def n=l
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
binecho=$(whence -p echo)
|
||||
|
@ -66,9 +66,6 @@ umask u=rwx,go=rx || err_exit "umask u=rws,go=rx failed"
|
|||
if [[ $(umask -S) != u=rwx,g=rx,o=rx ]]
|
||||
then err_exit 'umask -S incorrect'
|
||||
fi
|
||||
pwd=$PWD
|
||||
[[ $SHELL != /* ]] && SHELL=$pwd/$SHELL
|
||||
cd $tmp || { err_exit "cd $tmp failed"; exit 1; }
|
||||
um=$(umask -S)
|
||||
( umask 0777; > foobar )
|
||||
rm -f foobar
|
||||
|
@ -235,7 +232,6 @@ if [[ $x != hello ]]
|
|||
then err_exit "command substitution with stdout closed failed"
|
||||
fi
|
||||
exec >& 9
|
||||
cd $pwd
|
||||
x=$(export binecho bincat; cat <<\! | $SHELL
|
||||
"$binecho" | "$bincat"
|
||||
"$binecho" hello
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
null=''
|
||||
if [[ ! -z $null ]]
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bar=foo2
|
||||
bam=foo[3]
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
#test for compound variables
|
||||
Command=${0##*/}
|
||||
|
|
|
@ -49,7 +49,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
# "nounset" disabled for now
|
||||
#set -o nounset
|
||||
|
|
|
@ -29,7 +29,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
if [[ -d /cygdrive ]]
|
||||
then err_exit cygwin detected - coprocess tests disabled - enable at the risk of wedging your system
|
||||
|
|
|
@ -29,7 +29,7 @@ Command=${0##*/}
|
|||
integer Errors=0
|
||||
integer n=2
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
typeset -T Box_t=(
|
||||
float -h 'height in inches' x=2
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
enum Color_t=(red green blue orange yellow)
|
||||
enum -i Sex_t=(Male Female)
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function abspath
|
||||
{
|
||||
|
@ -41,7 +41,6 @@ function abspath
|
|||
#test for proper exit of shell
|
||||
builtin getconf
|
||||
ABSHELL=$(abspath)
|
||||
cd $tmp || { err_exit "cd $tmp failed"; exit 1; }
|
||||
print exit 0 >.profile
|
||||
${ABSHELL} <<!
|
||||
HOME=$PWD \
|
||||
|
@ -73,6 +72,7 @@ EOF
|
|||
if [[ $($SHELL ./run.sh) != 123 ]]
|
||||
then err_exit 'subshell trap on exit overwrites parent trap'
|
||||
fi
|
||||
cd /
|
||||
cd ~- || err_exit "cd back failed"
|
||||
$SHELL -c 'builtin -f cmd getconf; getconf --"?-version"; exit 0' >/dev/null 2>&1 || err_exit 'ksh plugin exit failed -- was ksh built with CCFLAGS+=$(CC.EXPORT.DYNAMIC)?'
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function err_exit
|
|||
integer Errors=0
|
||||
Command=${0##*/}
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
# {...} expansion tests -- ignore if not supported
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
integer Errors=0
|
||||
Command=${0##*/}
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
compiled=''
|
||||
read -n4 c < $0 2> /dev/null
|
||||
|
|
|
@ -27,7 +27,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer aware=0 contrary=0 Errors=0 ignorant=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function test_glob
|
||||
{
|
||||
|
@ -89,8 +89,6 @@ alias test_case='test_case $LINENO'
|
|||
|
||||
unset undefined
|
||||
|
||||
cd $tmp || { err_exit "cd $tmp failed"; exit 1; }
|
||||
|
||||
export LC_COLLATE=C
|
||||
touch B b
|
||||
set -- *
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function grep
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset HISTFILE
|
||||
|
||||
|
@ -49,7 +49,6 @@ done
|
|||
exec 3> /dev/null
|
||||
[[ $(fun) == good ]] || err_exit 'file 3 closed before subshell completes'
|
||||
exec 3>&-
|
||||
cd $tmp || { err_exit "cd $tmp failed"; exit ; }
|
||||
print foo > file1
|
||||
print bar >> file1
|
||||
if [[ $(<file1) != $'foo\nbar' ]]
|
||||
|
@ -145,7 +144,6 @@ print world
|
|||
!
|
||||
chmod +x script
|
||||
[[ $( $SHELL ./script) == $'hello\nworld' ]] || err_exit 'closing 3 & 4 causes script to fail'
|
||||
cd ~- || err_exit "cd back failed"
|
||||
( exec > '' ) 2> /dev/null && err_exit '> "" does not fail'
|
||||
unset x
|
||||
( exec > ${x} ) 2> /dev/null && err_exit '> $x, where x null does not fail'
|
||||
|
@ -542,13 +540,9 @@ actual=$( (redirect /dev/null/foo >$tmp/wrong_redirect) 2>&1; echo " status = $?
|
|||
# Process substitution
|
||||
|
||||
# An output process substitution should work when combined with a redirection.
|
||||
# The 'cd "$tmp"' is because in many versions of ksh the test creates a bizarre
|
||||
# file that isn't easy to delete individually.
|
||||
cd "$tmp"
|
||||
result=$("$SHELL" -c 'echo ok > >(sed s/ok/good/); wait')
|
||||
[[ $result == good ]] || err_exit 'process substitution does not work with redirections' \
|
||||
"(expected 'good', got $(printf %q "$result"))"
|
||||
cd - >/dev/null
|
||||
|
||||
# Process substitution in an interactive shell shouldn't print the
|
||||
# process ID of the asynchronous process.
|
||||
|
|
|
@ -29,7 +29,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
builtin vmstate 2>/dev/null || { err\_exit "$LINENO" 'vmstate built-in command not compiled in; skipping tests'; exit 0; }
|
||||
|
||||
# Get the current amount of memory usage
|
||||
|
|
|
@ -28,8 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset LANG ${!LC_*}
|
||||
|
||||
|
|
|
@ -28,8 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
set -o nounset
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function checkref
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
foo=abc
|
||||
typeset -C bar=(x=3 y=4 t=7)
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset HISTFILE
|
||||
export LC_ALL=C ENV=/./dev/null
|
||||
|
@ -139,8 +139,7 @@ fi
|
|||
rm -rf $tmp/.kshrc
|
||||
|
||||
if command set -G 2> /dev/null
|
||||
then cd $tmp
|
||||
mkdir bar foo
|
||||
then mkdir bar foo
|
||||
> bar.c > bam.c
|
||||
> bar/foo.c > bar/bam.c
|
||||
> foo/bam.c
|
||||
|
@ -160,10 +159,8 @@ then cd $tmp
|
|||
expected='bam.c bar/bam.c foo/bam.c'
|
||||
[[ $* == $expected ]] ||
|
||||
err_exit "-G **/bam.c failed -- expected '$expected', got '$*'"
|
||||
cd ~-
|
||||
fi
|
||||
|
||||
cd $tmp
|
||||
t="<$$>.profile.<$$>"
|
||||
echo "echo '$t'" > .profile
|
||||
cp $SHELL ./-ksh
|
||||
|
@ -201,8 +198,7 @@ else
|
|||
[[ $(HOME=$PWD ./-ksh -ip </dev/null 2>&1) == *$t* ]] &&
|
||||
err_exit './-ksh -p does not ignore .profile'
|
||||
fi
|
||||
cd ~-
|
||||
rm -rf $tmp/.profile
|
||||
rm .profile
|
||||
|
||||
# { exec interactive login_shell restricted xtrace } in the following test
|
||||
|
||||
|
@ -441,7 +437,6 @@ PAR=(
|
|||
CMD=( command-kill script-kill )
|
||||
ADD=( '' '; :' )
|
||||
|
||||
cd $tmp
|
||||
print $'#!'$SHELL$'\nkill -KILL $$' > command-kill
|
||||
print $'kill -KILL $$' > script-kill
|
||||
chmod +x command-kill script-kill
|
||||
|
|
|
@ -28,8 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
type /xxxxxx > out1 2> out2
|
||||
[[ -s out1 ]] && err_exit 'type should not write on stdout for not found case'
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
typeset -T Pt_t=(
|
||||
float x=1
|
||||
|
|
|
@ -41,7 +41,7 @@ alias err_exit='err_exit $lineno'
|
|||
Command=${0##*/}
|
||||
integer Errors=0 lineno=1
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
whence -q pty || { err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; }
|
||||
|
||||
# On FreeBSD, the stty command does not appear to work correctly on a pty pseudoterminal.
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
binecho=$(whence -p echo)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
set -o noglob
|
||||
if [[ 'hi there' != "hi there" ]]
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
tmp1=$tmp/tmp1.csv
|
||||
tmp2=$tmp/tmp2.csv
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
typeset -T Pt_t=(
|
||||
float x=1
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
binecho=$(whence -p echo)
|
||||
|
||||
|
@ -46,8 +46,6 @@ function check_restricted
|
|||
grep restricted out > /dev/null 2>&1
|
||||
}
|
||||
|
||||
[[ $SHELL != /* ]] && SHELL=$pwd/$SHELL
|
||||
cd $tmp || err_exit "cd $tmp failed"
|
||||
ln -s $SHELL rksh
|
||||
PATH=$PWD:$PATH
|
||||
rksh -c '[[ -o restricted ]]' || err_exit 'restricted option not set'
|
||||
|
|
|
@ -30,7 +30,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset HISTFILE
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
PS3='ABC '
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ valgrindflags='--xml=yes --log-file=/dev/null --track-origins=yes --read-var-inf
|
|||
|
||||
USAGE=$'
|
||||
[-s8?
|
||||
@(#)$Id: shtests (AT&T Research/ksh93) 2020-08-11 $
|
||||
@(#)$Id: shtests (AT&T Research/ksh93) 2020-09-02 $
|
||||
]
|
||||
'$USAGE_LICENSE$'
|
||||
[+NAME?shtests - ksh regression test harness]
|
||||
|
@ -355,6 +355,7 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
do o=$u
|
||||
tmp_s=$tmp/$u.$lang
|
||||
mkdir -m700 "$tmp_s" || exit
|
||||
cd "$tmp_s" || exit
|
||||
if [[ $lang == C ]]
|
||||
then lang=
|
||||
else o="$o($lang)"
|
||||
|
@ -363,9 +364,10 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
|
||||
(
|
||||
export ${lang:+"$lang"} "tmp=$tmp_s"
|
||||
$valgrind $SHELL $trace $i
|
||||
$valgrind $SHELL $trace "$OLDPWD/$i"
|
||||
)
|
||||
e=$?
|
||||
cd "$OLDPWD" || exit
|
||||
if (( !keep ))
|
||||
then rm -rf "$tmp_s"
|
||||
fi
|
||||
|
@ -395,7 +397,8 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
|
||||
tmp_s=$tmp/$u.shcomp
|
||||
mkdir -m700 "$tmp_s" || exit
|
||||
if $SHCOMP $i > $c
|
||||
cd "$tmp_s" || exit
|
||||
if $SHCOMP "$OLDPWD/$i" > $c
|
||||
then if tmp=$tmp_s $valgrind $SHELL $trace $c
|
||||
then echo test $o passed ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} "[ $t $T 0 errors ]"
|
||||
else e=$?
|
||||
|
@ -415,6 +418,7 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
(( ++total_e ))
|
||||
echo test $o failed to compile ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"} with exit code $e "[ 1 test 1 error ]"
|
||||
fi
|
||||
cd "$OLDPWD" || exit
|
||||
if (( !keep ))
|
||||
then rm -rf "$tmp_s" "$c"
|
||||
fi
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
float DELAY=${1:-0.02}
|
||||
integer FOREGROUND=10 BACKGROUND=2
|
||||
|
|
|
@ -28,8 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset n s t
|
||||
typeset -A SIG
|
||||
|
|
|
@ -32,7 +32,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
set -o nounset
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ Command=${0##*/}
|
|||
integer Errors=0
|
||||
typeset -F SECONDS # for fractional seconds in PS4
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
builtin getconf
|
||||
bincat=$(PATH=$(getconf PATH) whence -p cat)
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
tmpPS4='+ [temp_PS4|L$LINENO|e$?] ' # used to avoid interference to ${.sh.match} from $PS4 set by shtests
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
if $SHELL -c '[[ ~root == /* ]]'
|
||||
then x=$(print -r -- ~root)
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
typeset -T Time_t=(
|
||||
integer .=-1
|
||||
|
|
|
@ -64,7 +64,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
## test start
|
||||
typeset -C tree1 tree2
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
integer n=2
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
[[ ${.sh.version} == "$KSH_VERSION" ]] || err_exit '.sh.version != KSH_VERSION'
|
||||
unset ss
|
||||
|
@ -74,7 +74,7 @@ cd /
|
|||
if [[ $OLDPWD != $old ]]
|
||||
then err_exit "OLDPWD variable failed -- expected '$old', got '$OLDPWD'"
|
||||
fi
|
||||
cd $old || err_exit cd failed
|
||||
cd "$old" || err_exit cd failed
|
||||
# REPLY
|
||||
read <<-!
|
||||
foobar
|
||||
|
@ -220,6 +220,7 @@ done
|
|||
kill -s 0 $! || err_exit '$! does not point to latest asynchronous process'
|
||||
kill $!
|
||||
unset x
|
||||
cd /tmp || exit
|
||||
CDPATH=/
|
||||
x=$(cd ${tmp#/})
|
||||
if [[ $x != $tmp ]]
|
||||
|
@ -234,6 +235,7 @@ x=$(cd ${tmp#/})
|
|||
if [[ $x != $tmp ]]
|
||||
then err_exit "CDPATH ${tmp#/} does not display new directory"
|
||||
fi
|
||||
cd "$tmp" || exit
|
||||
TMOUT=100
|
||||
(TMOUT=20)
|
||||
if (( TMOUT !=100 ))
|
||||
|
@ -750,8 +752,6 @@ set --
|
|||
)
|
||||
Errors=$? # ensure error count survives subshell
|
||||
|
||||
cd $tmp
|
||||
|
||||
print print -n zzz > zzz
|
||||
chmod +x zzz
|
||||
exp='aaazzz'
|
||||
|
|
|
@ -35,7 +35,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function build_tree
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
# "built_tree1" and "built_tree2" are identical except the way how they test
|
||||
# whether a variable exists:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue