mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
shtests: use central temporary directory; add --keep option
This gets rid of repetitive code in test scripts to create their own temporary directories. Instead, shtests exports a $tmp to each test script that is a subdirectory of its own temporary directory. This has the advantage of having all test script temporary directories in one hierarchy. Along with a new option to keep temporary files, this makes it easy to inspect them if wanted. This does make the test scripts less self-contained as they now depend on a temporary directory being exported as $tmp. But they already depended on $SHELL being the shell to test, so they already were not quite self-contained. src/cmd/ksh93/tests/shtests: - Add -k/--keep option to keep temporary directory. Make the EXIT trap report its location instead of deleting it. - For each test, create a subdirectory of $tmp (named after the test script plus the tested locale or 'shcomp') and export that subdirectory to the test script as its own $tmp. - If -k is not given, delete each script's temporary files immediately after running it to minimise disk usage. src/cmd/ksh93/tests/*.sh: - Don't make own temp directory. - Refuse to run if $tmp is not set. - Miscellaneous tweaks.
This commit is contained in:
parent
fa70fc3f77
commit
d7afb57c49
51 changed files with 132 additions and 274 deletions
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.alias.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
alias foo='print hello'
|
||||
if [[ $(foo) != hello ]]
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
{
|
||||
x=abc
|
||||
x+=def ;} 2> /dev/null
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.arith.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
trap '' FPE # NOTE: osf.alpha requires this (no ieee math)
|
||||
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.arrays.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function fun
|
||||
{
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
for ((i=0; i < 4; i++ ))
|
||||
do for ((j=0; j < 5; j++ ))
|
||||
do a[i][j]=$i$j
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.attributes.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { 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,14 +28,8 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.basic.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
binecho=$(whence -p echo)
|
||||
# make an external 'sleep' command that supports fractional seconds
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.bracket.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
null=''
|
||||
if [[ ! -z $null ]]
|
||||
|
|
|
@ -28,14 +28,8 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.builtins.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
|
||||
# test shell builtin commands
|
||||
|
@ -194,7 +188,7 @@ mkdir -p $tmp/a/b/c 2>/dev/null || err_exit "mkdir -p failed"
|
|||
$SHELL -c "cd $tmp/a/b; cd c" 2>/dev/null || err_exit "initial script relative cd fails"
|
||||
|
||||
trap 'print TERM' TERM
|
||||
exp=$'trap -- \'print TERM\' TERM\ntrap -- \'cd / && rm -rf "$tmp"\' EXIT'
|
||||
exp="trap -- 'print TERM' TERM"
|
||||
got=$(trap)
|
||||
[[ $got == $exp ]] || err_exit "\$(trap) failed -- expected \"$exp\", got \"$got\""
|
||||
exp='print TERM'
|
||||
|
|
|
@ -28,6 +28,8 @@ 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; }
|
||||
|
||||
bar=foo2
|
||||
bam=foo[3]
|
||||
for i in foo1 foo2 foo3 foo4 foo5 foo6
|
||||
|
|
|
@ -25,14 +25,10 @@ function err_exit
|
|||
}
|
||||
alias err_exit='err_exit $LINENO'
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.comvar.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
#test for compound variables
|
||||
Command=${0##*/}
|
||||
|
|
|
@ -46,6 +46,11 @@ function err_exit
|
|||
}
|
||||
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; }
|
||||
|
||||
# "nounset" disabled for now
|
||||
#set -o nounset
|
||||
Command=${0##*/}
|
||||
|
|
|
@ -29,14 +29,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.coprocess.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { 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,6 +29,8 @@ 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; }
|
||||
|
||||
typeset -T Box_t=(
|
||||
float -h 'height in inches' x=2
|
||||
float -h 'width in inches' y=4
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
enum Color_t=(red green blue orange yellow)
|
||||
enum -i Sex_t=(Male Female)
|
||||
for ((i=0; i < 1000; i++))
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.exit.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function abspath
|
||||
{
|
||||
|
|
|
@ -27,6 +27,8 @@ 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; }
|
||||
|
||||
# {...} expansion tests -- ignore if not supported
|
||||
|
||||
[[ $(print a{0,1}z) == "a0z a1z" ]] || exit 0
|
||||
|
|
|
@ -27,20 +27,15 @@ 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; }
|
||||
|
||||
compiled=''
|
||||
read -n4 c < $0 2> /dev/null
|
||||
[[ $c == *$'\ck'* ]] && compiled=1
|
||||
|
||||
ulimit -c 0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.functions.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
binecho=$(whence -p echo)
|
||||
|
||||
integer foo=33
|
||||
|
|
|
@ -27,14 +27,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer aware=0 contrary=0 Errors=0 ignorant=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.glob.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function test_glob
|
||||
{
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.grep.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function grep
|
||||
{
|
||||
|
|
|
@ -28,14 +28,8 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.heredoc.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
bincat=$(whence -p cat)
|
||||
|
||||
f=$tmp/here1
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.io.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset HISTFILE
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ 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; }
|
||||
|
||||
# Get the current amount of memory usage
|
||||
function getmem
|
||||
{
|
||||
|
|
|
@ -28,17 +28,10 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
unset LANG ${!LC_*}
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.locale.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
cd $tmp || exit
|
||||
unset LANG ${!LC_*}
|
||||
|
||||
a=$($SHELL -c '/' 2>&1 | sed -e "s,.*: *,," -e "s, *\[.*,,")
|
||||
b=$($SHELL -c '(LC_ALL=debug / 2>/dev/null); /' 2>&1 | sed -e "s,.*: *,," -e "s, *\[.*,,")
|
||||
|
|
|
@ -25,25 +25,14 @@ function err_exit
|
|||
}
|
||||
alias err_exit='err_exit $LINENO'
|
||||
|
||||
set -o nounset
|
||||
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
|
||||
|
||||
set -o nounset
|
||||
|
||||
typeset tmp
|
||||
|
||||
# create temporary test directory
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.math.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
cd $tmp || exit
|
||||
|
||||
function test_arithmetric_expression_accesss_array_element_through_nameref
|
||||
{
|
||||
compound out=( typeset stdout stderr ; integer res )
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.nameref.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
function checkref
|
||||
{
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.namespace.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { 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,19 +28,13 @@ 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; }
|
||||
|
||||
unset HISTFILE
|
||||
export LC_ALL=C ENV=/./dev/null
|
||||
|
||||
ulimit -c 0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.options.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
bincat=$(whence -p cat)
|
||||
|
||||
if [[ $( ${SHELL-ksh} -s hello<<-\!
|
||||
|
|
|
@ -28,16 +28,9 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.path.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
|
||||
cd $tmp || exit
|
||||
type /xxxxxx > out1 2> out2
|
||||
[[ -s out1 ]] && err_exit 'type should not write on stdout for not found case'
|
||||
[[ -s out2 ]] || err_exit 'type should write on stderr for not found case'
|
||||
|
|
|
@ -28,6 +28,8 @@ 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; }
|
||||
|
||||
typeset -T Pt_t=(
|
||||
float x=1
|
||||
float y=0
|
||||
|
|
|
@ -41,7 +41,8 @@ alias err_exit='err_exit $lineno'
|
|||
Command=${0##*/}
|
||||
integer Errors=0 lineno=1
|
||||
|
||||
whence -q pty || { lineno=$LINENO; err_exit "pty command not found -- tests skipped"; exit 0; }
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
whence -q pty || { lineno=$LINENO; err\_exit "$LINENO" "pty command not found -- tests skipped"; exit 0; }
|
||||
|
||||
bintrue=$(whence -p true)
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
binecho=$(whence -p echo)
|
||||
|
||||
if [[ 'hi there' != "hi there" ]]
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
set -o noglob
|
||||
if [[ 'hi there' != "hi there" ]]
|
||||
then err_exit "single quotes not the same as double quotes"
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.readcsv.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
tmp1=$tmp/tmp1.csv
|
||||
tmp2=$tmp/tmp2.csv
|
||||
|
|
|
@ -28,6 +28,8 @@ 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; }
|
||||
|
||||
typeset -T Pt_t=(
|
||||
float x=1
|
||||
float y=0
|
||||
|
|
|
@ -28,14 +28,8 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.restricted.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
binecho=$(whence -p echo)
|
||||
|
||||
# test restricted shell
|
||||
|
|
|
@ -30,14 +30,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.return.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
unset HISTFILE
|
||||
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.select.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { 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-06-23 $
|
||||
@(#)$Id: shtests (AT&T Research/ksh93) 2020-07-04 $
|
||||
]
|
||||
'$USAGE_LICENSE$'
|
||||
[+NAME?shtests - ksh regression test harness]
|
||||
|
@ -31,6 +31,7 @@ USAGE=$'
|
|||
}
|
||||
[c:compile?Run test scripts using \bshcomp\b(1).]
|
||||
[d:debug?Enable \bshtests\b execution trace.]
|
||||
[k:keep?Keep temporary files after test run; shtests will report the location.]
|
||||
[l:locale?Disable \b--utf8\b and run the \b--posix\b and \b--compile\b
|
||||
tests, if enabled, in the locale of the caller. This may cause invalid
|
||||
regressions, especially for locales where \b.\b is not the radix
|
||||
|
@ -170,7 +171,7 @@ export ENV=/./dev/null
|
|||
trap + PIPE # unadvertized -- set SIGPIPE to SIG_DFL #
|
||||
|
||||
integer compile=-1 posix=-1 utf8=-1
|
||||
integer debug=0 locale=0 time=1
|
||||
integer debug=0 keep=0 locale=0 time=1
|
||||
typeset vmalloc_options=abort trace= valgrind=
|
||||
vmalloc_options= #XXX# until multi-region vmalloc trace fixed #XXX#
|
||||
|
||||
|
@ -183,6 +184,9 @@ do case $OPT in
|
|||
;;
|
||||
d) debug=$OPTARG
|
||||
;;
|
||||
k) keep=$OPTARG
|
||||
echo "[DEBUG] keep == [$keep]" >&2
|
||||
;;
|
||||
l) locale=$OPTARG
|
||||
;;
|
||||
p) posix=$OPTARG
|
||||
|
@ -282,7 +286,10 @@ tmp=$(
|
|||
echo 'mkdir failed' >&2
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
if (( keep ))
|
||||
then trap 'printf "\nTemporary files left in: %s\n" "$tmp"' EXIT
|
||||
else trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
fi
|
||||
|
||||
if (( compile ))
|
||||
then if whence $SHCOMP > /dev/null
|
||||
|
@ -329,14 +336,22 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
[[ $utf8 == 0 || $i == $setslocale ]] || locales+=" C.UTF-8"
|
||||
for lang in $locales
|
||||
do o=$u
|
||||
tmp_s=$tmp/$u.$lang
|
||||
mkdir -m700 "$tmp_s" || exit
|
||||
if [[ $lang == C ]]
|
||||
then lang=
|
||||
else o="$o($lang)"
|
||||
lang=LANG=$lang
|
||||
fi
|
||||
echo test $o begins ${time:+"at $(date +%Y-%m-%d+%H:%M:%S)"}
|
||||
eval $lang \$valgrind \$SHELL \$trace \$i
|
||||
(
|
||||
export ${lang:+"$lang"} "tmp=$tmp_s"
|
||||
$valgrind $SHELL $trace $i
|
||||
)
|
||||
e=$?
|
||||
if (( !keep ))
|
||||
then rm -rf "$tmp_s"
|
||||
fi
|
||||
if [[ $valgrind ]]
|
||||
then valxml $valxml
|
||||
(( e += $? ))
|
||||
|
@ -361,8 +376,10 @@ do [[ $i == *.sh ]] || i+='.sh'
|
|||
then c=$tmp/shcomp-$u.ksh
|
||||
o="$u(shcomp)"
|
||||
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
|
||||
then if $valgrind $SHELL $trace $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=$?
|
||||
if (( e > 128 && ++total_e ))
|
||||
|
@ -381,6 +398,9 @@ 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
|
||||
if (( !keep ))
|
||||
then rm -rf "$tmp_s" "$c"
|
||||
fi
|
||||
if [[ $i == $timesensitive ]]
|
||||
then VMALLOC_OPTIONS=$vmalloc_options
|
||||
fi
|
||||
|
|
|
@ -23,20 +23,15 @@ function err_exit
|
|||
print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
(( Errors+=1 ))
|
||||
}
|
||||
|
||||
alias err_exit='err_exit $LINENO'
|
||||
|
||||
float DELAY=${1:-0.02}
|
||||
integer FOREGROUND=10 BACKGROUND=2 Errors=0
|
||||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.sigchld.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
float DELAY=${1:-0.02}
|
||||
integer FOREGROUND=10 BACKGROUND=2
|
||||
|
||||
s=$($SHELL -c '
|
||||
integer i foreground=0 background=0
|
||||
|
|
|
@ -28,16 +28,8 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.signal.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
|
||||
cd $tmp || err_exit "cd $tmp failed"
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
CDPATH= cd -P -- "$tmp" || exit
|
||||
|
||||
unset n s t
|
||||
typeset -A SIG
|
||||
|
|
|
@ -27,14 +27,14 @@ function err_exit
|
|||
print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
(( Errors < 127 && Errors++ ))
|
||||
}
|
||||
|
||||
alias err_exit='err_exit $LINENO'
|
||||
|
||||
set -o nounset
|
||||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
set -o nounset
|
||||
|
||||
typeset -T test_t=(
|
||||
typeset name
|
||||
|
|
|
@ -29,14 +29,7 @@ Command=${0##*/}
|
|||
integer Errors=0
|
||||
typeset -F SECONDS # for fractional seconds in PS4
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.subshell.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
builtin getconf
|
||||
bincat=$(PATH=$(getconf PATH) whence -p cat)
|
||||
|
|
|
@ -27,6 +27,9 @@ 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; }
|
||||
|
||||
tmpPS4='+ [temp_PS4|L$LINENO|e$?] ' # used to avoid interference to ${.sh.match} from $PS4 set by shtests
|
||||
|
||||
integer j=4
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.tilde.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
if $SHELL -c '[[ ~root == /* ]]'
|
||||
then x=$(print -r -- ~root)
|
||||
|
|
|
@ -28,6 +28,8 @@ 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; }
|
||||
|
||||
typeset -T Time_t=(
|
||||
integer .=-1
|
||||
_='%F+%H:%M'
|
||||
|
|
|
@ -59,11 +59,13 @@ function err_exit
|
|||
print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
(( Errors+=1 ))
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
## test start
|
||||
typeset -C tree1 tree2
|
||||
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.types.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
|
||||
|
||||
integer n=2
|
||||
|
||||
|
|
|
@ -28,14 +28,7 @@ alias err_exit='err_exit $LINENO'
|
|||
Command=${0##*/}
|
||||
integer Errors=0
|
||||
|
||||
tmp=$(
|
||||
d=${TMPDIR:-/tmp}/ksh93.variables.$$.${RANDOM:-0}
|
||||
mkdir -m700 -- "$d" && CDPATH= cd -P -- "$d" && pwd
|
||||
) || {
|
||||
err\_exit $LINENO 'mkdir failed'
|
||||
exit 1
|
||||
}
|
||||
trap 'cd / && rm -rf "$tmp"' EXIT
|
||||
[[ -d $tmp && -w $tmp ]] || { 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
|
||||
|
|
|
@ -30,9 +30,13 @@ function err_exit
|
|||
print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
(( Errors+=1 ))
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
function build_tree
|
||||
{
|
||||
#set -o errexit -o xtrace
|
||||
|
|
|
@ -30,9 +30,13 @@ function err_exit
|
|||
print -u2 -r ${Command}[$1]: "${@:2}"
|
||||
(( Errors+=1 ))
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
# "built_tree1" and "built_tree2" are identical except the way how they test
|
||||
# whether a variable exists:
|
||||
# - "built_tree1" uses "${varname}" != "", e.g. looking whether the variable
|
||||
|
|
Loading…
Reference in a new issue