1
0
Fork 0
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:
Martijn Dekker 2020-09-02 06:02:40 +01:00
parent 55f0f8ce52
commit 5395641036
51 changed files with 63 additions and 82 deletions

View file

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