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 # Regression test for https://github.com/att/ast/issues/949
foo_script='#!/bin/sh if (builtin chmod) 2>/dev/null
exit 0' then foo_script='#!/bin/sh
echo "$foo_script" > "$tmp/foo1.sh" exit 0'
echo "$foo_script" > "$tmp/foo2.sh" echo "$foo_script" > "$tmp/foo1.sh"
builtin chmod echo "$foo_script" > "$tmp/foo2.sh"
chmod +x "$tmp/foo1.sh" "$tmp/foo2.sh" builtin chmod
$SHELL "$tmp/foo1.sh" || err_exit "builtin 'chmod +x' doesn't work on first script" chmod +x "$tmp/foo1.sh" "$tmp/foo2.sh"
$SHELL "$tmp/foo2.sh" || err_exit "builtin 'chmod +x' doesn't work on second script" $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. # 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' # Test for bugs related to 'uname -d'
# https://github.com/att/ast/pull/1187 # https://github.com/att/ast/pull/1187
builtin uname if (builtin uname) 2>/dev/null
exp=$(uname -o) then builtin uname
exp=$(uname -o)
# Test for a possible crash (to avoid crashing the script, fork the subshell) # Test for a possible crash (to avoid crashing the script, fork the subshell)
( (
ulimit -t unlimited 2> /dev/null ulimit -t unlimited 2> /dev/null
uname -d > /dev/null uname -d > /dev/null
) || err_exit "'uname -d' crashes" ) || err_exit "'uname -d' crashes"
# 'uname -d' shouldn't change the output of 'uname -o' # 'uname -d' shouldn't change the output of 'uname -o'
got=$(ulimit -t unlimited 2> /dev/null; uname -d > /dev/null; 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'" \ [[ $exp == $got ]] || err_exit "'uname -d' changes the output of 'uname -o'" \
"(expected $(printf %q "$exp"), got $(printf %q "$got"))" "(expected $(printf %q "$exp"), got $(printf %q "$got"))"
fi
# ====== # ======
# https://github.com/ksh93/ksh/issues/138 # 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' #$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 printf $'\342\202\254\342\202\254' > $tmp/two_euro_chars.txt
if((SHOPT_MULTIBYTE)); then if (builtin wc) 2>/dev/null
exp="6 2 6" then if((SHOPT_MULTIBYTE)); then
else exp="6 2 6"
exp="6 6 6" else
fi # SHOPT_MULTIBYTE exp="6 6 6"
set -- $($SHELL -c " fi # SHOPT_MULTIBYTE
if builtin wc 2>/dev/null || builtin -f cmd wc 2>/dev/null set -- $($SHELL -c "
then unset LC_CTYPE if builtin wc 2>/dev/null || builtin -f cmd wc 2>/dev/null
export LANG=$locale then unset LC_CTYPE
export LC_ALL=C export LANG=$locale
wc -C < $tmp/two_euro_chars.txt export LC_ALL=C
unset LC_ALL wc -C < $tmp/two_euro_chars.txt
wc -C < $tmp/two_euro_chars.txt unset LC_ALL
export LC_ALL=C wc -C < $tmp/two_euro_chars.txt
wc -C < $tmp/two_euro_chars.txt export LC_ALL=C
fi wc -C < $tmp/two_euro_chars.txt
") fi
got=$* ")
[[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'" got=$*
[[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'"
fi
# multibyte char straddling buffer boundary # multibyte char straddling buffer boundary