mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Regress tests: keep common code in one place
src/cmd/ksh93/tests/_common: - Added. This keeps one common version of 'err_exit', 'warning', and other init code. src/cmd/ksh93/tests/*.sh: - Source _common as a dot script. - Remove 50-odd, occasionally slightly different, versions of the common code. - Some minor tweaks.
This commit is contained in:
		
							parent
							
								
									6f709122c7
								
							
						
					
					
						commit
						aed5c6d70a
					
				
					 53 changed files with 101 additions and 596 deletions
				
			
		
							
								
								
									
										31
									
								
								src/cmd/ksh93/tests/_common
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/cmd/ksh93/tests/_common
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
########################################################################
 | 
			
		||||
#                                                                      #
 | 
			
		||||
#              This file is part of the ksh 93u+m package              #
 | 
			
		||||
#          Copyright (c) 1982-2012 AT&T Intellectual Property          #
 | 
			
		||||
#             Copyright (c) 2021 Contributors to ksh 93u+m             #
 | 
			
		||||
#                    <https://github.com/ksh93/ksh>                    #
 | 
			
		||||
#                      and is licensed under the                       #
 | 
			
		||||
#                 Eclipse Public License, Version 1.0                  #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
#                A copy of the License is available at                 #
 | 
			
		||||
#          http://www.eclipse.org/org/documents/epl-v10.html           #
 | 
			
		||||
#         (with md5 checksum b35adb5213ca9657e911e9befb180842)         #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
#                  Martijn Dekker <martijn@inlv.org>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
 | 
			
		||||
_message()
 | 
			
		||||
{
 | 
			
		||||
	print -r $'\t'"${Command}[$1]: ${@:2}" >&2
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='_message "$((Errors++,LINENO))"'   # inaccurate err_exit name kept for historical integrity :)
 | 
			
		||||
alias warning='_message "$LINENO" "warning:"'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
 | 
			
		||||
if	! [[ -d $tmp && -w $tmp && $tmp == "$PWD" ]]
 | 
			
		||||
then	print -r "$Command: \$tmp not set; run this from shtests. Aborting." >&2
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
alias foo='print hello'
 | 
			
		||||
if	[[ $(foo) != hello ]]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
x=abc
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
trap '' FPE # NOTE: osf.alpha requires this (no ieee math)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function fun
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
for	((i=0; i < 4; i++ ))
 | 
			
		||||
do	for	((j=0; j < 5; j++ ))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# ======
 | 
			
		||||
# as of 93u+, typeset -xu/-xl failed to change case in a value (rhbz#1188377)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
bincat=$(whence -p cat)
 | 
			
		||||
binecho=$(whence -p echo)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
null=''
 | 
			
		||||
if	[[ ! -z $null ]]
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +73,7 @@ fi
 | 
			
		|||
chmod 000 $file
 | 
			
		||||
 | 
			
		||||
if	[[ $(id -u) == '0' ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping tests involving r/w permissions"
 | 
			
		||||
then	warning "running as root: skipping tests involving r/w permissions"
 | 
			
		||||
else	if	[[ -r $file ]]
 | 
			
		||||
	then	err_exit "-r: $file should not be readable"
 | 
			
		||||
	fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
bincat=$(whence -p cat)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -808,7 +798,7 @@ e=$?
 | 
			
		|||
 | 
			
		||||
# https://bugzilla.redhat.com/1102627
 | 
			
		||||
if	[[ $(id -u) == '0' ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping tests involving directory search (x) permission"
 | 
			
		||||
then	warning "running as root: skipping tests involving directory search (x) permission"
 | 
			
		||||
else
 | 
			
		||||
mkdir -m 600 "$tmp/no_x_dir"
 | 
			
		||||
expect=": cd: $tmp/no_x_dir: [Permission denied]"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
bar=foo2
 | 
			
		||||
bam=foo[3]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
#test for compound variables
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,20 +19,7 @@
 | 
			
		|||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
 | 
			
		||||
# test setup
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n '\t'
 | 
			
		||||
	print -u2 -r "${Command}[$1]: ${@:2}"
 | 
			
		||||
	(( Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='err_exit $LINENO'
 | 
			
		||||
alias warning='err\_exit $((Errors--,LINENO)) warning:'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# "nounset" disabled for now
 | 
			
		||||
#set -o nounset
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,18 +18,8 @@
 | 
			
		|||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
# test the behavior of co-processes
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
if	[[ -d /cygdrive ]]
 | 
			
		||||
then	err_exit cygwin detected - coprocess tests disabled - enable at the risk of wedging your system
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,20 +17,11 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors+=1 ))
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='err_exit $LINENO'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
integer n=2
 | 
			
		||||
 | 
			
		||||
[[ -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
 | 
			
		||||
	float -h 'width in inches' y=4
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
enum Color_t=(red green blue orange yellow)
 | 
			
		||||
enum -i Sex_t=(Male Female)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function abspath
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,17 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$Line]: "$@"
 | 
			
		||||
	((Errors++))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
integer Errors=0
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# {...} expansion tests -- ignore if not supported
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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'
 | 
			
		||||
 | 
			
		||||
integer Errors=0
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
compiled=''
 | 
			
		||||
read -n4 c < $0 2> /dev/null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,17 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -r $'\t'"${Command}[$1] ${@:2}"
 | 
			
		||||
	((Errors++))
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='err_exit $LINENO'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer aware=0 contrary=0 Errors=0 ignorant=0
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function test_glob
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function grep
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
bincat=$(whence -p cat)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
unset HISTFILE
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,19 +13,8 @@
 | 
			
		|||
#                  Martijn Dekker <martijn@inlv.org>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r "${Command}[$1]: ${@:2}"
 | 
			
		||||
	let Errors++
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='err_exit $LINENO'
 | 
			
		||||
alias warning='err\_exit $((Errors--,LINENO)) warning:'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# All the tests here should run with job control on
 | 
			
		||||
set -o monitor
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,19 +18,7 @@
 | 
			
		|||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
 | 
			
		||||
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; }
 | 
			
		||||
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# Determine method for running tests.
 | 
			
		||||
# The 'vmstate' builtin can be used if ksh was compiled with vmalloc.
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +63,7 @@ then	N=16384
 | 
			
		|||
	{
 | 
			
		||||
		ps -o rss= -p "$$"
 | 
			
		||||
	}
 | 
			
		||||
else	err\_exit "$LINENO" 'WARNING: cannot find method to measure memory usage; skipping tests'
 | 
			
		||||
else	warning 'cannot find method to measure memory usage; skipping tests'
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
unset LANG LANGUAGE "${!LC_@}"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors < 127 && Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
set -o nounset
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function checkref
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,21 +17,11 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
if((!SHOPT_NAMESPACE))
 | 
			
		||||
then	err\_exit "$LINENO" 'warning: shell compiled without SHOPT_NAMESPACE; skipping tests'
 | 
			
		||||
then	warning 'shell compiled without SHOPT_NAMESPACE; skipping tests'
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
unset HISTFILE
 | 
			
		||||
export LC_ALL=C ENV=/./dev/null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,19 +17,8 @@
 | 
			
		|||
#                  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'
 | 
			
		||||
alias warning='err\_exit $((Errors--,LINENO)) warning:'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# to avoid spurious test failures with 'whence -a' tests, we need
 | 
			
		||||
# to remove any duplicate paths to the same directory from $PATH.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
typeset -T Pt_t=(
 | 
			
		||||
	float x=1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
: : generated by mkptytests from "posix-sh-*-c.pty" : :
 | 
			
		||||
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# These are tests for the interactive shell, run in a pseudoterminal utility
 | 
			
		||||
# called 'pty', which allows for scripting interactive sessions and which is
 | 
			
		||||
| 
						 | 
				
			
			@ -31,22 +32,7 @@
 | 
			
		|||
# the trickiest part of the tests is avoiding typeahead
 | 
			
		||||
# in the pty dialogue
 | 
			
		||||
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alias err_exit='err_exit $lineno'
 | 
			
		||||
alias warning='err\_exit $((Errors--,LINENO)) warning:'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0 lineno=1
 | 
			
		||||
 | 
			
		||||
[[ -d $tmp && -w $tmp && $tmp == "$PWD" ]] || { err\_exit "$LINENO" '$tmp not set; run this from shtests. Aborting.'; exit 1; }
 | 
			
		||||
whence -q pty || { warning "pty command not found -- tests skipped"; exit 0; }
 | 
			
		||||
 | 
			
		||||
case $(uname -s) in
 | 
			
		||||
Darwin | FreeBSD | Linux )
 | 
			
		||||
	;;
 | 
			
		||||
| 
						 | 
				
			
			@ -54,6 +40,8 @@ Darwin | FreeBSD | Linux )
 | 
			
		|||
	exit 0 ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
integer lineno=1
 | 
			
		||||
 | 
			
		||||
# On some systems, the stty command does not appear to work correctly on a pty pseudoterminal.
 | 
			
		||||
# To avoid false regressions, we have to set 'erase' and 'kill' on the real terminal.
 | 
			
		||||
if	test -t 0 2>/dev/null </dev/tty && stty_restore=$(stty -g </dev/tty)
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +211,7 @@ u ^hello\r?\n$
 | 
			
		|||
!
 | 
			
		||||
 | 
			
		||||
if	[[ $(id -u) == 0 ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping test POSIX sh 096(C)"
 | 
			
		||||
then	warning "running as root: skipping test POSIX sh 096(C)"
 | 
			
		||||
else
 | 
			
		||||
# err_exit #
 | 
			
		||||
tst $LINENO <<"!"
 | 
			
		||||
| 
						 | 
				
			
			@ -268,7 +256,7 @@ u ^ok\r?\n$
 | 
			
		|||
!
 | 
			
		||||
 | 
			
		||||
if	[[ $(id -u) == 0 ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping test POSIX sh 099(C)"
 | 
			
		||||
then	warning "running as root: skipping test POSIX sh 099(C)"
 | 
			
		||||
else
 | 
			
		||||
# err_exit #
 | 
			
		||||
tst $LINENO <<"!"
 | 
			
		||||
| 
						 | 
				
			
			@ -379,7 +367,7 @@ u ^done\r?\n$
 | 
			
		|||
!
 | 
			
		||||
 | 
			
		||||
if	[[ $(id -u) == 0 ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping test POSIX sh 111(C)"
 | 
			
		||||
then	warning "running as root: skipping test POSIX sh 111(C)"
 | 
			
		||||
else
 | 
			
		||||
# err_exit #
 | 
			
		||||
((SHOPT_VSH)) && tst $LINENO <<"!"
 | 
			
		||||
| 
						 | 
				
			
			@ -424,7 +412,7 @@ u ^hello world\r?\n$
 | 
			
		|||
!
 | 
			
		||||
 | 
			
		||||
if	[[ $(id -u) == 0 ]]
 | 
			
		||||
then	print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping test POSIX sh 251(C)"
 | 
			
		||||
then	warning "running as root: skipping test POSIX sh 251(C)"
 | 
			
		||||
else
 | 
			
		||||
# err_exit #
 | 
			
		||||
((SHOPT_VSH)) && tst $LINENO <<"!"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
binecho=$(whence -p echo)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
set -o noglob
 | 
			
		||||
if	[[ 'hi there' != "hi there" ]]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
	
 | 
			
		||||
tmp1=$tmp/tmp1.csv
 | 
			
		||||
tmp2=$tmp/tmp2.csv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
typeset -T Pt_t=(
 | 
			
		||||
	float x=1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
binecho=$(whence -p echo)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,18 +19,7 @@
 | 
			
		|||
########################################################################
 | 
			
		||||
# test the behavior of return and exit with functions
 | 
			
		||||
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
unset HISTFILE
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
PS3='ABC '
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -345,9 +345,6 @@ do	[[ $i == *.sh ]] || i+='.sh'
 | 
			
		|||
		glob.sh)	grep -c '^[[:blank:]]*test_[a-z]\{3,\}' $i ;;
 | 
			
		||||
		*)		grep -c err_exit $i ;;
 | 
			
		||||
		esac	)
 | 
			
		||||
	if	(( t > 2 ))
 | 
			
		||||
	then	(( t = t - 2 ))
 | 
			
		||||
	fi
 | 
			
		||||
	tests[$i]=$t
 | 
			
		||||
	T=test
 | 
			
		||||
	if	(( t != 1 ))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
float DELAY=${1:-0.02}
 | 
			
		||||
integer FOREGROUND=10 BACKGROUND=2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
unset n s t
 | 
			
		||||
typeset -A SIG
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,18 +21,7 @@
 | 
			
		|||
# Written by Roland Mainz <roland.mainz@nrubsig.org>
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors < 127 && Errors++ ))
 | 
			
		||||
}
 | 
			
		||||
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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
set -o nounset
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,20 +17,11 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( Errors+=1 ))
 | 
			
		||||
}
 | 
			
		||||
alias err_exit='err_exit $LINENO'
 | 
			
		||||
 | 
			
		||||
Command=${0##*/}
 | 
			
		||||
integer Errors=0
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
typeset -F SECONDS  # for fractional seconds in PS4
 | 
			
		||||
 | 
			
		||||
[[ -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)
 | 
			
		||||
binecho=$(PATH=$(getconf PATH) whence -p echo)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
tmpPS4='+ [temp_PS4|L$LINENO|e$?] '  # used to avoid interference to ${.sh.match} from $PS4 set by shtests
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r $Command: "$@"
 | 
			
		||||
	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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
if	$SHELL -c '[[ ~root == /* ]]'
 | 
			
		||||
then	x=$(print -r -- ~root)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
typeset -T Time_t=(
 | 
			
		||||
	integer .=-1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,8 @@
 | 
			
		|||
# Use is subject to license terms.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# This test checks whether "typeset -m" correctly moves local variables
 | 
			
		||||
# into a global variable tree.
 | 
			
		||||
| 
						 | 
				
			
			@ -53,19 +55,6 @@
 | 
			
		|||
# -- snip --
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
 | 
			
		||||
## test start
 | 
			
		||||
typeset -C tree1 tree2
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  David Korn <dgk@research.att.com>                   #
 | 
			
		||||
#                                                                      #
 | 
			
		||||
########################################################################
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
integer n=2
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,18 +17,8 @@
 | 
			
		|||
#                  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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
[[ ${.sh.version} == "$KSH_VERSION" ]] || err_exit '.sh.version != KSH_VERSION'
 | 
			
		||||
unset ss
 | 
			
		||||
| 
						 | 
				
			
			@ -747,17 +737,14 @@ unset r v x
 | 
			
		|||
Errors=$?  # ensure error count survives subshell
 | 
			
		||||
(
 | 
			
		||||
	errmsg=$({ LANG=bad_LOCALE; } 2>&1)
 | 
			
		||||
	if	[[ -z $errmsg ]]
 | 
			
		||||
	then	print -u2 "\t${Command}[$LINENO]: warning: C library does not seem to verify locales: skipping LC_* tests"
 | 
			
		||||
		exit $Errors
 | 
			
		||||
	fi
 | 
			
		||||
	x=x
 | 
			
		||||
	for v in LC_ALL LC_CTYPE LC_MESSAGES LC_COLLATE LC_NUMERIC
 | 
			
		||||
	do	nameref r=$v
 | 
			
		||||
		unset $v
 | 
			
		||||
		[[ $r ]] && err_exit "unset $v failed -- expected '', got '$r'"
 | 
			
		||||
		d=$($SHELL -c "$v=$x" 2>&1)
 | 
			
		||||
		[[ $d ]] || err_exit "$v=$x failed -- expected locale diagnostic"
 | 
			
		||||
		# Test disabled: some system libraries do not verify the locale, so no diagnostic is printed.
 | 
			
		||||
		#d=$($SHELL -c "$v=$x" 2>&1)
 | 
			
		||||
		#[[ $d ]] || err_exit "$v=$x failed -- expected locale diagnostic"
 | 
			
		||||
		{ g=$( r=$x; print -- $r ); } 2>/dev/null
 | 
			
		||||
		[[ $g == '' ]] || err_exit "$v=$x failed -- expected '', got '$g'"
 | 
			
		||||
		{ g=$( r=C; r=$x; print -- $r ); } 2>/dev/null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,23 +19,12 @@
 | 
			
		|||
########################################################################
 | 
			
		||||
#
 | 
			
		||||
# variable tree test #001
 | 
			
		||||
# Propose of this test is whether ksh93 handles global variable trees
 | 
			
		||||
# Purpose of this test is whether ksh93 handles global variable trees
 | 
			
		||||
# and function-local variable trees the same way, including "nameref"
 | 
			
		||||
# and "unset" handling.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
function build_tree
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,23 +19,12 @@
 | 
			
		|||
########################################################################
 | 
			
		||||
#
 | 
			
		||||
# variable tree test #002
 | 
			
		||||
# Propose of this test is whether ksh93 handles global variable trees
 | 
			
		||||
# Purpose of this test is whether ksh93 handles global variable trees
 | 
			
		||||
# and function-local variable trees the same way, including "nameref"
 | 
			
		||||
# and "unset" handling.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
function err_exit
 | 
			
		||||
{
 | 
			
		||||
	print -u2 -n "\t"
 | 
			
		||||
	print -u2 -r ${Command}[$1]: "${@:2}"
 | 
			
		||||
	(( 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; }
 | 
			
		||||
. "${0%/*}/_common"
 | 
			
		||||
 | 
			
		||||
# "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