Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Apr 2011 22:10:44 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220902 - in stable/8/tools/regression/bin/sh: builtins execution expansion parser
Message-ID:  <201104202210.p3KMAihG068474@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Wed Apr 20 22:10:44 2011
New Revision: 220902
URL: http://svn.freebsd.org/changeset/base/220902

Log:
  MFC r218205,r218821,r218891,r219390,r219611,r220654,r220655,r220656: sh:
  New testcases that already work in stable/8.

Added:
  stable/8/tools/regression/bin/sh/builtins/case4.0
     - copied unchanged from r220654, head/tools/regression/bin/sh/builtins/case4.0
  stable/8/tools/regression/bin/sh/builtins/dot3.0
     - copied unchanged from r219390, head/tools/regression/bin/sh/builtins/dot3.0
  stable/8/tools/regression/bin/sh/builtins/read5.0
     - copied unchanged from r218821, head/tools/regression/bin/sh/builtins/read5.0
  stable/8/tools/regression/bin/sh/execution/shellproc1.0
     - copied unchanged from r218205, head/tools/regression/bin/sh/execution/shellproc1.0
  stable/8/tools/regression/bin/sh/expansion/length1.0
     - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length1.0
  stable/8/tools/regression/bin/sh/expansion/length2.0
     - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length2.0
  stable/8/tools/regression/bin/sh/expansion/length3.0
     - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length3.0
  stable/8/tools/regression/bin/sh/expansion/length4.0
     - copied unchanged from r220655, head/tools/regression/bin/sh/expansion/length4.0
  stable/8/tools/regression/bin/sh/expansion/length5.0
     - copied unchanged from r220656, head/tools/regression/bin/sh/expansion/length5.0
  stable/8/tools/regression/bin/sh/parser/no-space1.0
     - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space1.0
  stable/8/tools/regression/bin/sh/parser/no-space2.0
     - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space2.0
Modified:
Directory Properties:
  stable/8/tools/regression/bin/sh/   (props changed)

Copied: stable/8/tools/regression/bin/sh/builtins/case4.0 (from r220654, head/tools/regression/bin/sh/builtins/case4.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/builtins/case4.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r220654, head/tools/regression/bin/sh/builtins/case4.0)
@@ -0,0 +1,6 @@
+# $FreeBSD$
+
+set -- "*"
+case x in
+"$1") echo failed ;;
+esac

Copied: stable/8/tools/regression/bin/sh/builtins/dot3.0 (from r219390, head/tools/regression/bin/sh/builtins/dot3.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/builtins/dot3.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r219390, head/tools/regression/bin/sh/builtins/dot3.0)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+# . should return 0 if no command was executed.
+
+if false; then
+	exit 3
+else
+	. /dev/null
+	exit $?
+fi

Copied: stable/8/tools/regression/bin/sh/builtins/read5.0 (from r218821, head/tools/regression/bin/sh/builtins/read5.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/builtins/read5.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r218821, head/tools/regression/bin/sh/builtins/read5.0)
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+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"

Copied: stable/8/tools/regression/bin/sh/execution/shellproc1.0 (from r218205, head/tools/regression/bin/sh/execution/shellproc1.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/execution/shellproc1.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r218205, head/tools/regression/bin/sh/execution/shellproc1.0)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+cat <<EOF >"$T/testshellproc"
+printf 'this '
+echo is a test
+EOF
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+[ "`testshellproc`" = "this is a test" ]

Copied: stable/8/tools/regression/bin/sh/expansion/length1.0 (from r219611, head/tools/regression/bin/sh/expansion/length1.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/expansion/length1.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length1.0)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+v=abcd
+[ "${#v}" = 4 ] || echo '${#v} wrong'
+v=$$
+[ "${#$}" = "${#v}" ] || echo '${#$} wrong'
+[ "${#!}" = 0 ] || echo '${#!} wrong'
+set -- 01 2 3 4 5 6 7 8 9 10 11 12 0013
+[ "${#1}" = 2 ] || echo '${#1} wrong'
+[ "${#13}" = 4 ] || echo '${#13} wrong'
+v=$0
+[ "${#0}" = "${#v}" ] || echo '${#0} wrong'

Copied: stable/8/tools/regression/bin/sh/expansion/length2.0 (from r219611, head/tools/regression/bin/sh/expansion/length2.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/expansion/length2.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length2.0)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+v=$-
+[ "${#-}" = "${#v}" ] || echo '${#-} wrong'

Copied: stable/8/tools/regression/bin/sh/expansion/length3.0 (from r219611, head/tools/regression/bin/sh/expansion/length3.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/expansion/length3.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length3.0)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+set -- 1 2 3 4 5 6 7 8 9 10 11 12 13
+[ "$#" = 13 ] || echo '$# wrong'
+[ "${#}" = 13 ] || echo '${#} wrong'
+[ "${##}" = 2 ] || echo '${##} wrong'
+set --
+[ "$#" = 0 ] || echo '$# wrong'
+[ "${#}" = 0 ] || echo '${#} wrong'
+[ "${##}" = 1 ] || echo '${##} wrong'

Copied: stable/8/tools/regression/bin/sh/expansion/length4.0 (from r220655, head/tools/regression/bin/sh/expansion/length4.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/expansion/length4.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r220655, head/tools/regression/bin/sh/expansion/length4.0)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+# The construct ${#?} is ambiguous in POSIX.1-2008: it could be the length
+# of $? or it could be $# giving an error in the (impossible) case that it
+# is not set.
+# We use the former interpretation; it seems more useful.
+
+:
+[ "${#?}" = 1 ] || echo '${#?} wrong'
+(exit 42)
+[ "${#?}" = 2 ] || echo '${#?} wrong'

Copied: stable/8/tools/regression/bin/sh/expansion/length5.0 (from r220656, head/tools/regression/bin/sh/expansion/length5.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/expansion/length5.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r220656, head/tools/regression/bin/sh/expansion/length5.0)
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+unset LC_ALL
+LC_CTYPE=en_US.ISO8859-1
+export LC_CTYPE
+
+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) continue ;;
+			esac
+			e="$e\\$i$j$k"
+		done
+	done
+done
+ee=`printf "$e"`
+[ ${#ee} = 255 ] || echo bad 1
+[ "${#ee}" = 255 ] || echo bad 2
+[ $((${#ee})) = 255 ] || echo bad 3
+[ "$((${#ee}))" = 255 ] || echo bad 4
+set -- "$ee"
+[ ${#1} = 255 ] || echo bad 5
+[ "${#1}" = 255 ] || echo bad 6
+[ $((${#1})) = 255 ] || echo bad 7
+[ "$((${#1}))" = 255 ] || echo bad 8

Copied: stable/8/tools/regression/bin/sh/parser/no-space1.0 (from r218891, head/tools/regression/bin/sh/parser/no-space1.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/parser/no-space1.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space1.0)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+# These are ugly but are required to work.
+
+set -e
+
+while(false)do(:)done
+if(false)then(:)fi
+if(false)then(:)else(:)fi
+(:&&:)||:
+until(:)do(:)done
+case x in(x);;*)exit 1;(:)esac
+case x in(x);;*)exit 1;;esac
+for i do(:)done
+{(:)}
+f(){(:)}
+:|:
+(:)|(:)

Copied: stable/8/tools/regression/bin/sh/parser/no-space2.0 (from r218891, head/tools/regression/bin/sh/parser/no-space2.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/8/tools/regression/bin/sh/parser/no-space2.0	Wed Apr 20 22:10:44 2011	(r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space2.0)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+# This conflicts with ksh extended patterns but occurs in the wild.
+
+set -e
+
+!(false)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104202210.p3KMAihG068474>