mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Various cleanups, mostly in regression tests
src/cmd/ksh93/data/variables.sh: shtab_variables[]: - Remove unused "CSWIDTH" entry. All use of it (including the matching CSWIDTHNOD macro) was removed in version 2003-04-22. src/cmd/ksh93/tests/variables.sh: - For the tests on the shtab_variables[] variables, read the variable names straight from variables.c instead of synching the list in the test script, which would surely be forgotten. src/cmd/ksh93/tests/*.sh: - Fix a number of mistaken tries to count errors from a subshell. - Fix miscellaneous minor breakage and typos.
This commit is contained in:
parent
8afc4756e8
commit
cda661d34c
6 changed files with 50 additions and 87 deletions
|
|
@ -619,8 +619,10 @@ chmod +x $tmp/script
|
|||
[[ $(fun .sh.subshell) == 2 ]] || err_exit ".sh.subshell not working for functions in subshells"
|
||||
(( .sh.subshell == 1 )) || err_exit ".sh.subshell not working in a subshell"
|
||||
)
|
||||
TIMEFORMAT='this is a test'
|
||||
[[ $(set +x; { { time :;} 2>&1;}) == "$TIMEFORMAT" ]] || err_exit 'TIMEFORMAT not working'
|
||||
(
|
||||
TIMEFORMAT='this is a test'
|
||||
[[ $(set +x; { { time :;} 2>&1;}) == "$TIMEFORMAT" ]]
|
||||
) || err_exit 'TIMEFORMAT not working'
|
||||
alias _test_alias=true
|
||||
: ${.sh.version}
|
||||
[[ $(alias _test_alias) == *.sh.* ]] && err_exit '.sh. prefixed to alias name'
|
||||
|
|
@ -965,75 +967,25 @@ actual=$(env SHLVL="2#11+x[\$(env echo Exploited vuln CVE-2019-14868 >&2)0]" "$S
|
|||
# ======
|
||||
# Check unset, attribute and cleanup/restore behavior of special variables.
|
||||
|
||||
# Keep the list in sync (minus ".sh") with shtab_variables[] in src/cmd/ksh93/data/variables.c
|
||||
set -- \
|
||||
"PATH" \
|
||||
"PS1" \
|
||||
"PS2" \
|
||||
"IFS" \
|
||||
"PWD" \
|
||||
"HOME" \
|
||||
"MAIL" \
|
||||
"REPLY" \
|
||||
"SHELL" \
|
||||
"EDITOR" \
|
||||
"MAILCHECK" \
|
||||
"RANDOM" \
|
||||
"ENV" \
|
||||
"HISTFILE" \
|
||||
"HISTSIZE" \
|
||||
"HISTEDIT" \
|
||||
"HISTCMD" \
|
||||
"FCEDIT" \
|
||||
"CDPATH" \
|
||||
"MAILPATH" \
|
||||
"PS3" \
|
||||
"OLDPWD" \
|
||||
"VISUAL" \
|
||||
"COLUMNS" \
|
||||
"LINES" \
|
||||
"PPID" \
|
||||
"_" \
|
||||
"TMOUT" \
|
||||
"SECONDS" \
|
||||
"LINENO" \
|
||||
"OPTARG" \
|
||||
"OPTIND" \
|
||||
"PS4" \
|
||||
"FPATH" \
|
||||
"LANG" \
|
||||
"LC_ALL" \
|
||||
"LC_COLLATE" \
|
||||
"LC_CTYPE" \
|
||||
"LC_MESSAGES" \
|
||||
"LC_NUMERIC" \
|
||||
"LC_TIME" \
|
||||
"FIGNORE" \
|
||||
"KSH_VERSION" \
|
||||
"JOBMAX" \
|
||||
".sh.edchar" \
|
||||
".sh.edcol" \
|
||||
".sh.edtext" \
|
||||
".sh.edmode" \
|
||||
".sh.name" \
|
||||
".sh.subscript" \
|
||||
".sh.value" \
|
||||
".sh.version" \
|
||||
".sh.dollar" \
|
||||
".sh.match" \
|
||||
".sh.command" \
|
||||
".sh.file" \
|
||||
".sh.fun" \
|
||||
".sh.lineno" \
|
||||
".sh.subshell" \
|
||||
".sh.level" \
|
||||
".sh.stats" \
|
||||
".sh.math" \
|
||||
".sh.pool" \
|
||||
".sh.pid" \
|
||||
".sh.tilde" \
|
||||
"SHLVL" \
|
||||
"CSWIDTH"
|
||||
# ... to avoid forgetting to keep this script synched with shtab_variables[], read from the source
|
||||
set -- $(
|
||||
srcdir=${SHTESTS_COMMON%/tests/*}
|
||||
redirect < $srcdir/data/variables.c || exit
|
||||
# skip lines until finding shtab_variables struct
|
||||
while read -r line || exit
|
||||
do [[ $line == *" shtab_variables[] =" ]] && break
|
||||
done
|
||||
read -r line
|
||||
[[ $line == '{' ]] || exit
|
||||
# read variable names until '};'
|
||||
IFS=\"
|
||||
while read -r first varname junk
|
||||
do [[ $first == '};' ]] && exit
|
||||
[[ -z $junk ]] && continue
|
||||
[[ -n $varname && $varname != '.sh' ]] && print -r -- "$varname"
|
||||
done
|
||||
)
|
||||
(($# >= 66)) || err_exit "could not read shtab_variables[]; adjust test script ($# items read)"
|
||||
|
||||
# ... unset
|
||||
$SHELL -c '
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue