-Add some tests for omitting whitespace.
-Split off some special behaviour into separate tests.
-Do not use "local" in the test runner.
-Make execution/fork1.0 work even if the basename of ${SH} is not "sh".
-Test that the read builtin passes through all byte values except NUL,
newline and backslash.
-Unset some locale vars in two tests that may cause them to break.
Obtained-from: FreeBSD
-# $FreeBSD: src/tools/regression/bin/sh/builtins/locale1.0,v 1.1 2010/05/05 21:48:40 jilles Exp $
+# $FreeBSD: src/tools/regression/bin/sh/builtins/locale1.0,v 1.2 2011/02/18 20:37:09 jilles Exp $
# Note: this test depends on strerror() using locale.
failures=0
}
unset LANG LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME LC_MESSAGES
+unset LANGUAGE
msgeng="No such file or directory"
msgdut="Bestand of map niet gevonden"
--- /dev/null
+# $FreeBSD: src/tools/regression/bin/sh/builtins/read5.0,v 1.1 2011/02/18 20:51:13 jilles Exp $
+
+unset LC_ALL
+LC_CTYPE=en_US.ISO8859-1
+export LC_CTYPE
+
+# Note: the first and last characters are not whitespace.
+# Exclude backslash and newline.
+bad1=`printf %03o \'\\\\`
+bad2=`printf %03o \''
+'`
+e=
+for i in 0 1 2 3; do
+ for j in 0 1 2 3 4 5 6 7; do
+ for k in 0 1 2 3 4 5 6 7; do
+ case $i$j$k in
+ 000|$bad1|$bad2) continue ;;
+ esac
+ e="$e\\$i$j$k"
+ done
+ done
+done
+e=`printf "$e"`
+[ "${#e}" = 253 ] || echo length bad
+
+r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }`
+[ "$r1" = "$e" ] || echo "read with -r bad"
+r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
+[ "$r2" = "$e" ] || echo "read without -r bad 1"
+IFS=
+r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }`
+[ "$r3" = "$e" ] || echo "read without -r bad 2"
-# $FreeBSD: src/tools/regression/bin/sh/execution/fork1.0,v 1.2 2010/10/12 18:20:38 obrien Exp $
+# $FreeBSD: src/tools/regression/bin/sh/execution/fork1.0,v 1.3 2011/02/19 13:22:18 jilles Exp $
+
+shname=${SH%% *}
+shname=${shname##*/}
result=$(${SH} -c 'ps -p $$ -o comm=')
test "$result" = "ps" || exit 1
result=$(${SH} -c 'ps -p $$ -o comm=; :')
-test "$result" = "sh" || exit 1
+test "$result" = "$shname" || exit 1
-# $FreeBSD: src/tools/regression/bin/sh/expansion/cmdsubst3.0,v 1.1 2010/12/16 23:28:20 jilles Exp $
+# $FreeBSD: src/tools/regression/bin/sh/expansion/cmdsubst3.0,v 1.2 2011/02/18 20:37:09 jilles Exp $
+
+unset LC_ALL
+export LC_CTYPE=en_US.ISO8859-1
e=
for i in 0 1 2 3; do
-# $FreeBSD: src/tools/regression/bin/sh/regress.sh,v 1.4 2010/10/12 18:20:38 obrien Exp $
+# $FreeBSD: src/tools/regression/bin/sh/regress.sh,v 1.5 2011/02/19 13:23:13 jilles Exp $
if [ -z "${SH}" ]; then
echo '${SH} is not set, please correct and re-run.'
COUNTER=1
do_test() {
- local c
c=${COUNTER}
COUNTER=$((COUNTER+1))
${SH} $1 > tmp.stdout 2> tmp.stderr