1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

more regression test updates (re: 7cdb01f6)

This commit is contained in:
Martijn Dekker 2021-12-16 11:45:53 +01:00
parent fad16a0c63
commit 3779d84220
2 changed files with 44 additions and 38 deletions

View file

@ -1100,14 +1100,16 @@ got=$($SHELL -c 't=good; t=bad command -@; print $t' 2>/dev/null)
# ======
# Regression test for https://github.com/att/ast/issues/949
foo_script='#!/bin/sh
exit 0'
echo "$foo_script" > "$tmp/foo1.sh"
echo "$foo_script" > "$tmp/foo2.sh"
builtin chmod
chmod +x "$tmp/foo1.sh" "$tmp/foo2.sh"
$SHELL "$tmp/foo1.sh" || err_exit "builtin 'chmod +x' doesn't work on first script"
$SHELL "$tmp/foo2.sh" || err_exit "builtin 'chmod +x' doesn't work on second script"
if (builtin chmod) 2>/dev/null
then foo_script='#!/bin/sh
exit 0'
echo "$foo_script" > "$tmp/foo1.sh"
echo "$foo_script" > "$tmp/foo2.sh"
builtin chmod
chmod +x "$tmp/foo1.sh" "$tmp/foo2.sh"
$SHELL "$tmp/foo1.sh" || err_exit "builtin 'chmod +x' doesn't work on first script"
$SHELL "$tmp/foo2.sh" || err_exit "builtin 'chmod +x' doesn't work on second script"
fi
# ======
# In ksh93v- 2013-10-10 alpha cd doesn't fail on directories without execute permission.
@ -1208,19 +1210,21 @@ got=$(
# ======
# Test for bugs related to 'uname -d'
# https://github.com/att/ast/pull/1187
builtin uname
exp=$(uname -o)
if (builtin uname) 2>/dev/null
then builtin uname
exp=$(uname -o)
# Test for a possible crash (to avoid crashing the script, fork the subshell)
(
ulimit -t unlimited 2> /dev/null
uname -d > /dev/null
) || err_exit "'uname -d' crashes"
# Test for a possible crash (to avoid crashing the script, fork the subshell)
(
ulimit -t unlimited 2> /dev/null
uname -d > /dev/null
) || err_exit "'uname -d' crashes"
# 'uname -d' shouldn't change the output of 'uname -o'
got=$(ulimit -t unlimited 2> /dev/null; uname -d > /dev/null; uname -o)
[[ $exp == $got ]] || err_exit "'uname -d' changes the output of 'uname -o'" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
# 'uname -d' shouldn't change the output of 'uname -o'
got=$(ulimit -t unlimited 2> /dev/null; uname -d > /dev/null; uname -o)
[[ $exp == $got ]] || err_exit "'uname -d' changes the output of 'uname -o'" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))"
fi
# ======
# https://github.com/ksh93/ksh/issues/138

View file

@ -157,25 +157,27 @@ fi
#$SHELL -c 'export LANG='$locale'; printf "\u[20ac]\u[20ac]" > $tmp/two_euro_chars.txt'
printf $'\342\202\254\342\202\254' > $tmp/two_euro_chars.txt
if((SHOPT_MULTIBYTE)); then
exp="6 2 6"
else
exp="6 6 6"
fi # SHOPT_MULTIBYTE
set -- $($SHELL -c "
if builtin wc 2>/dev/null || builtin -f cmd wc 2>/dev/null
then unset LC_CTYPE
export LANG=$locale
export LC_ALL=C
wc -C < $tmp/two_euro_chars.txt
unset LC_ALL
wc -C < $tmp/two_euro_chars.txt
export LC_ALL=C
wc -C < $tmp/two_euro_chars.txt
fi
")
got=$*
[[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'"
if (builtin wc) 2>/dev/null
then if((SHOPT_MULTIBYTE)); then
exp="6 2 6"
else
exp="6 6 6"
fi # SHOPT_MULTIBYTE
set -- $($SHELL -c "
if builtin wc 2>/dev/null || builtin -f cmd wc 2>/dev/null
then unset LC_CTYPE
export LANG=$locale
export LC_ALL=C
wc -C < $tmp/two_euro_chars.txt
unset LC_ALL
wc -C < $tmp/two_euro_chars.txt
export LC_ALL=C
wc -C < $tmp/two_euro_chars.txt
fi
")
got=$*
[[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'"
fi
# multibyte char straddling buffer boundary