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