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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue