mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-24 23:14:14 +00:00
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.
66 lines
2.1 KiB
Bash
Executable file
66 lines
2.1 KiB
Bash
Executable file
########################################################################
|
|
# #
|
|
# This software is part of the ast package #
|
|
# Copyright (c) 1982-2011 AT&T Intellectual Property #
|
|
# and is licensed under the #
|
|
# Eclipse Public License, Version 1.0 #
|
|
# by AT&T Intellectual Property #
|
|
# #
|
|
# A copy of the License is available at #
|
|
# http://www.eclipse.org/org/documents/epl-v10.html #
|
|
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
|
|
# #
|
|
# Information and Software Systems Research #
|
|
# AT&T Research #
|
|
# Florham Park NJ #
|
|
# #
|
|
# David Korn <dgk@research.att.com> #
|
|
# #
|
|
########################################################################
|
|
function err_exit
|
|
{
|
|
print -u2 -n "\t"
|
|
print -u2 -r ${Command}[$1]: "${@:2}"
|
|
let Errors+=1
|
|
}
|
|
alias err_exit='err_exit $LINENO'
|
|
|
|
Command=${0##*/}
|
|
integer Errors=0
|
|
|
|
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
|
|
|
PS3='ABC '
|
|
|
|
cat > $tmp/1 <<\!
|
|
1) foo
|
|
2) bar
|
|
3) bam
|
|
!
|
|
|
|
select i in foo bar bam
|
|
do case $i in
|
|
foo) break;;
|
|
*) err_exit "select 1 not working"
|
|
break;;
|
|
esac
|
|
done 2> /dev/null <<!
|
|
1
|
|
!
|
|
|
|
unset i
|
|
select i in foo bar bam
|
|
do case $i in
|
|
foo) err_exit "select foo not working" 2>&3
|
|
break;;
|
|
*) if [[ $REPLY != foo ]]
|
|
then err_exit "select REPLY not correct" 2>&3
|
|
fi
|
|
( set -u; : $i ) || err_exit "select: i not set to null" 2>&3
|
|
break;;
|
|
esac
|
|
done 3>&2 2> $tmp/2 <<!
|
|
foo
|
|
!
|
|
|
|
exit $((Errors<125?Errors:125))
|