summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/grep/tests
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-07-04 09:52:08 +0000
committertjr <tjr@FreeBSD.org>2004-07-04 09:52:08 +0000
commitd4c611919468bb0fb6a564c4b8cada55792c3fc4 (patch)
treef2214fa6f131710d43ac95358818886df20d47df /gnu/usr.bin/grep/tests
parenta28ccb3d69be53479d581654919168403fb79f65 (diff)
downloadFreeBSD-src-d4c611919468bb0fb6a564c4b8cada55792c3fc4.zip
FreeBSD-src-d4c611919468bb0fb6a564c4b8cada55792c3fc4.tar.gz
Import GNU grep 2.5.1 (trimmed)
Diffstat (limited to 'gnu/usr.bin/grep/tests')
-rwxr-xr-xgnu/usr.bin/grep/tests/backref.sh38
-rw-r--r--gnu/usr.bin/grep/tests/bre.awk3
-rwxr-xr-xgnu/usr.bin/grep/tests/bre.sh2
-rw-r--r--gnu/usr.bin/grep/tests/bre.tests2
-rwxr-xr-xgnu/usr.bin/grep/tests/empty.sh41
-rw-r--r--gnu/usr.bin/grep/tests/ere.awk3
-rwxr-xr-xgnu/usr.bin/grep/tests/ere.sh2
-rwxr-xr-xgnu/usr.bin/grep/tests/file.sh59
-rw-r--r--gnu/usr.bin/grep/tests/formatbre.awk55
-rw-r--r--gnu/usr.bin/grep/tests/formatere.awk60
-rwxr-xr-xgnu/usr.bin/grep/tests/khadafy.sh2
-rwxr-xr-xgnu/usr.bin/grep/tests/options.sh2
-rw-r--r--gnu/usr.bin/grep/tests/spencer1.awk3
-rwxr-xr-xgnu/usr.bin/grep/tests/spencer1.sh2
-rwxr-xr-xgnu/usr.bin/grep/tests/spencer2.sh13
-rw-r--r--gnu/usr.bin/grep/tests/spencer2.tests317
-rwxr-xr-xgnu/usr.bin/grep/tests/status.sh22
-rw-r--r--gnu/usr.bin/grep/tests/tests475
-rwxr-xr-xgnu/usr.bin/grep/tests/warning.sh2
19 files changed, 1070 insertions, 33 deletions
diff --git a/gnu/usr.bin/grep/tests/backref.sh b/gnu/usr.bin/grep/tests/backref.sh
new file mode 100755
index 0000000..83f6dcc
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/backref.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Test that backrefs are local to regex.
+#
+#
+
+: ${srcdir=.}
+
+failures=0
+
+# checking for a palindrome
+echo "radar" | ${GREP} -e '\(.\)\(.\).\2\1' > /dev/null 2>&1
+if test $? -ne 0 ; then
+ echo "backref: palindrome, test \#1 failed"
+ failures=1
+fi
+
+# hit hard with the `Bond' tests
+echo "civic" | ${GREP} -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' > /dev/null 2>&1
+if test $? -ne 0 ; then
+ echo "Options: Bond, test \#2 failed"
+ failures=1
+fi
+
+# backref are local should be error
+echo "123" | ${GREP} -e 'a\(.\)' -e 'b\1' > /dev/null 2>&1
+if test $? -ne 2 ; then
+ echo "Options: Backref not local, test \#3 failed"
+ failures=1
+fi
+
+# Pattern should faile
+echo "123" | ${GREP} -e '[' -e ']' > /dev/null 2>&1
+if test $? -ne 2 ; then
+ echo "Options: Compiled not local, test \#3 failed"
+ failures=1
+fi
+
+exit $failures
diff --git a/gnu/usr.bin/grep/tests/bre.awk b/gnu/usr.bin/grep/tests/bre.awk
index 9c9fef8..16a5814 100644
--- a/gnu/usr.bin/grep/tests/bre.awk
+++ b/gnu/usr.bin/grep/tests/bre.awk
@@ -8,7 +8,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
- printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+# printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+ printf ("status=`echo '%s' | { ${GREP} -e '%s' > /dev/null 2>&1; echo $? ; }`\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer bre test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/gnu/usr.bin/grep/tests/bre.sh b/gnu/usr.bin/grep/tests/bre.sh
index eecdd3e..e7ccf0a 100755
--- a/gnu/usr.bin/grep/tests/bre.sh
+++ b/gnu/usr.bin/grep/tests/bre.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Regression test for GNU grep.
: ${srcdir=.}
diff --git a/gnu/usr.bin/grep/tests/bre.tests b/gnu/usr.bin/grep/tests/bre.tests
index 1ed159d..33d1689 100644
--- a/gnu/usr.bin/grep/tests/bre.tests
+++ b/gnu/usr.bin/grep/tests/bre.tests
@@ -17,7 +17,7 @@
2@\(\{1\}a\)@BADRPT@TO CORRECT
0@^*@*
2@^\{1\}@BADRPT@TO CORRECT
-0@\{@{
+0@{@{
1@a\(b*\)c\1d@abbcbd
1@a\(b*\)c\1d@abbcbbbd
1@^\(.\)\1@abc
diff --git a/gnu/usr.bin/grep/tests/empty.sh b/gnu/usr.bin/grep/tests/empty.sh
index 8c75196..d4225fe 100755
--- a/gnu/usr.bin/grep/tests/empty.sh
+++ b/gnu/usr.bin/grep/tests/empty.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# test that the empty file means no pattern
# and an empty pattern means match all.
@@ -6,25 +6,28 @@
failures=0
-# should return 0 found a match
-echo "abcd" | ${GREP} -E -e '' > /dev/null 2>&1
-if test $? -ne 0 ; then
- echo "Status: Wrong status code, test \#1 failed"
- failures=1
-fi
+for options in '-E' '-E -w' '-F -x' '-G -w -x'; do
-# should return 1 found no match
-echo "abcd" | ${GREP} -E -f /dev/null > /dev/null 2>&1
-if test $? -ne 1 ; then
- echo "Status: Wrong status code, test \#2 failed"
- failures=1
-fi
+ # should return 0 found a match
+ echo "" | ${GREP} $options -e '' > /dev/null 2>&1
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#1 failed ($options)"
+ failures=1
+ fi
-# should return 0 found a match
-echo "abcd" | ${GREP} -E -f /dev/null -e "abc" > /dev/null 2>&1
-if test $? -ne 0 ; then
- echo "Status: Wrong status code, test \#3 failed"
- failures=1
-fi
+ # should return 1 found no match
+ echo "abcd" | ${GREP} $options -f /dev/null > /dev/null 2>&1
+ if test $? -ne 1 ; then
+ echo "Status: Wrong status code, test \#2 failed ($options)"
+ failures=1
+ fi
+
+ # should return 0 found a match
+ echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#3 failed ($options)"
+ failures=1
+ fi
+done
exit $failures
diff --git a/gnu/usr.bin/grep/tests/ere.awk b/gnu/usr.bin/grep/tests/ere.awk
index 8f6a5b5..234d219 100644
--- a/gnu/usr.bin/grep/tests/ere.awk
+++ b/gnu/usr.bin/grep/tests/ere.awk
@@ -8,7 +8,8 @@ BEGIN {
$0 ~ /^#/ { next; }
NF == 3 {
- printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+# printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+ printf ("status=`echo '%s' | { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; }`\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer ere test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/gnu/usr.bin/grep/tests/ere.sh b/gnu/usr.bin/grep/tests/ere.sh
index 5bf1695..d57e2fa 100755
--- a/gnu/usr.bin/grep/tests/ere.sh
+++ b/gnu/usr.bin/grep/tests/ere.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Regression test for GNU grep.
: ${srcdir=.}
diff --git a/gnu/usr.bin/grep/tests/file.sh b/gnu/usr.bin/grep/tests/file.sh
new file mode 100755
index 0000000..3db95be
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/file.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+# Test for POSIX.2 options for grep
+#
+# grep -E -f pattern_file file
+# grep -F -f pattern_file file
+# grep -G -f pattern_file file
+#
+
+: ${srcdir=.}
+
+failures=0
+
+cat <<EOF >patfile
+radar
+MILES
+GNU
+EOF
+
+# match
+echo "miles" | ${GREP} -i -E -f patfile > /dev/null 2>&1
+if test $? -ne 0 ; then
+ echo "File_pattern: Wrong status code, test \#1 failed"
+ failures=1
+fi
+
+# match
+echo "GNU" | ${GREP} -G -f patfile > /dev/null 2>&1
+if test $? -ne 0 ; then
+ echo "File_pattern: Wrong status code, test \#2 failed"
+ failures=1
+fi
+
+# checking for no match
+echo "ridar" | ${GREP} -F -f patfile > /dev/null 2>&1
+if test $? -ne 1 ; then
+ echo "File_pattern: Wrong status code, test \#3 failed"
+ failures=1
+fi
+
+cat <<EOF >patfile
+
+EOF
+# empty pattern : every match
+echo "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1
+if test $? -ne 0 ; then
+ echo "File_pattern: Wrong status code, test \#4 failed"
+ failures=1
+fi
+
+cp /dev/null patfile
+
+# null pattern : no match
+echo "abbcd" | ${GREP} -F -f patfile > /dev/null 2>&1
+if test $? -ne 1 ; then
+ echo "File_pattern: Wrong status code, test \#5 failed"
+ failures=1
+fi
+
+exit $failures
diff --git a/gnu/usr.bin/grep/tests/formatbre.awk b/gnu/usr.bin/grep/tests/formatbre.awk
new file mode 100644
index 0000000..68a9c62
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/formatbre.awk
@@ -0,0 +1,55 @@
+#
+# Basic Regular Expression
+
+# kip comments
+$0 ~ /^#/ { next; }
+
+# skip those option specific to regexec/regcomp
+$2 ~ /[msnr$#p^]/ { next; }
+
+# skip empty lines
+$0 ~ /^$/ { next; }
+
+# debug
+#{ printf ("<%s> <%s> <%s> <%s>\n", $1, $2, $3, $4); }
+
+# subreg expresion
+NF >= 5 { next; }
+
+# errors
+NF == 3 {
+# gsub (/@/, ",");
+# it means empty lines
+ gsub (/\"\"/, "");
+# escapes
+ gsub (/\\\'/, "\\\'\'");
+# error in regex
+ if (index ($2, "C") != 0)
+ {
+ if (index ($2, "b") != 0)
+ printf ("2@%s@%s\n", $1, $3);
+ }
+# erro no match
+ else
+ {
+ if (index ($2, "b") != 0)
+ printf ("1@%s@%s\n", $1, $3);
+ }
+ next;
+}
+
+# ok
+NF == 4 {
+# skip those magic cookies can't rely on echo to gnerate them
+ if (match($3, /[NSTZ]/))
+ next;
+
+# gsub (/@/, ",");
+# it means empty lines
+ gsub (/\"\"/, "");
+# escape escapes
+ gsub (/\\\'/, "\\\'\'");
+
+ if (index ($2, "b") != 0)
+ printf ("0@%s@%s\n", $1, $3);
+}
diff --git a/gnu/usr.bin/grep/tests/formatere.awk b/gnu/usr.bin/grep/tests/formatere.awk
new file mode 100644
index 0000000..ba60439
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/formatere.awk
@@ -0,0 +1,60 @@
+#
+# Extended Regular Expression
+
+# skip comments
+$0 ~ /^#/ { next; }
+
+# skip specifics to regcomp/regexec
+$2 ~ /[msnr$#p^]/ { next; }
+
+# jump empty lines
+$0 ~ /^$/ { next; }
+
+# subreg skip
+NF >= 5 { next; }
+
+# debug
+#{ printf ("<%s> <%s> <%s> <%s>\n", $1, $2, $3, $4); }
+
+# errors
+NF == 3 {
+# nuke any remaining '@'
+# gsub (/@/, ",");
+# it means empty lines
+ gsub (/\"\"/, "");
+# escapes
+ gsub (/\\\'/, "\\\'\'");
+# error in regex
+ if (index ($2, "C") != 0)
+ {
+ if (index ($2, "b") == 0)
+ printf ("2@%s@%s\n", $1, $3);
+ }
+# error not matching
+ else
+ {
+ if (index ($2, "b") == 0)
+ printf ("1@%s@%s\n", $1, $3);
+ }
+ next;
+}
+
+# ok
+NF == 4 {
+# skip those magic cookies can't rely on echo to gnerate them
+ if (match($3, /[NSTZ]/))
+ next;
+
+# nuke any remaining '@'
+# gsub (/@/, ",");
+# it means empty lines
+ gsub (/\"\"/, "");
+# escape escapes
+ gsub (/\\\'/, "\\\'\'");
+
+ if (index ($2, "b") == 0)
+ {
+ printf ("0@%s@%s\n", $1, $3);
+ }
+ next;
+}
diff --git a/gnu/usr.bin/grep/tests/khadafy.sh b/gnu/usr.bin/grep/tests/khadafy.sh
index 141b3d8..e3d2cde 100755
--- a/gnu/usr.bin/grep/tests/khadafy.sh
+++ b/gnu/usr.bin/grep/tests/khadafy.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Regression test for GNU grep.
: ${srcdir=.}
diff --git a/gnu/usr.bin/grep/tests/options.sh b/gnu/usr.bin/grep/tests/options.sh
index 3415018..0f18529 100755
--- a/gnu/usr.bin/grep/tests/options.sh
+++ b/gnu/usr.bin/grep/tests/options.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Test for POSIX.2 options for grep
#
# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list
diff --git a/gnu/usr.bin/grep/tests/spencer1.awk b/gnu/usr.bin/grep/tests/spencer1.awk
index 70c6118..ba7aeb6 100644
--- a/gnu/usr.bin/grep/tests/spencer1.awk
+++ b/gnu/usr.bin/grep/tests/spencer1.awk
@@ -4,7 +4,8 @@ BEGIN {
}
$0 !~ /^#/ && NF = 3 {
- printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+# printf ("status=`echo '%s'| { ${GREP} -E -e '%s' > /dev/null 2>&1; echo $?; cat >/dev/null; }`\n",$3, $2);
+ printf ("status=`echo '%s'| { ${GREP} -E -e '%s' >/dev/null 2>&1 ; echo $?; }`\n",$3, $2);
printf ("if test $status -ne %s ; then\n", $1);
printf ("\techo Spencer test \\#%d failed\n", ++n);
printf ("\tfailures=1\n");
diff --git a/gnu/usr.bin/grep/tests/spencer1.sh b/gnu/usr.bin/grep/tests/spencer1.sh
index f09b3fa..2391761a 100755
--- a/gnu/usr.bin/grep/tests/spencer1.sh
+++ b/gnu/usr.bin/grep/tests/spencer1.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Regression test for GNU grep.
: ${srcdir=.}
diff --git a/gnu/usr.bin/grep/tests/spencer2.sh b/gnu/usr.bin/grep/tests/spencer2.sh
new file mode 100755
index 0000000..a26869c
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/spencer2.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# Regression test for GNU grep.
+
+: ${srcdir=.}
+
+failures=0
+
+# . . . and the following by Henry Spencer.
+
+${AWK-awk} -f $srcdir/scriptgen.awk $srcdir/spencer2.tests > tmp2.script
+
+sh tmp2.script && exit $failures
+exit 1
diff --git a/gnu/usr.bin/grep/tests/spencer2.tests b/gnu/usr.bin/grep/tests/spencer2.tests
new file mode 100644
index 0000000..47b6191
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/spencer2.tests
@@ -0,0 +1,317 @@
+0@a@a
+0@abc@abc
+0@abc|de@abc
+0@a|b|c@abc
+0@a(b)c@abc
+1@a\(b\)c@abc
+2@a(@EPAREN
+2@a(@a(
+0@a\(@a(
+1@a\(@EPAREN
+1@a\(b@EPAREN
+2@a(b@EPAREN
+2@a(b@a(b
+2@a)@a)
+2@)@)
+2@a)@a)
+1@a\)@EPAREN
+1@\)@EPAREN
+0@a()b@ab
+1@a\(\)b@ab
+0@^abc$@abc
+1@a^b@a^b
+1@a^b@a^b
+1@a$b@a$b
+1@a$b@a$b
+0@^@abc
+0@$@abc
+1@^$@""
+1@$^@""
+1@\($\)\(^\)@""
+0@^^@""
+0@$$@""
+1@b$@abNc
+1@b$@abNc
+1@^b$@aNbNc
+1@^b$@aNbNc
+1@^$@aNNb
+1@^$@abc
+1@^$@abcN
+1@$^@aNNb
+1@\($\)\(^\)@aNNb
+0@^^@aNNb
+0@$$@aNNb
+0@^a@a
+0@a$@a
+0@^a@aNb
+1@^b@aNb
+0@a$@bNa
+1@b$@bNa
+0@a*(^b$)c*@b
+1@a*\(^b$\)c*@b
+0@|@EMPTY
+0@|@|
+0@*@BADRPT
+0@*@*
+0@+@BADRPT
+0@?@BADRPT
+1@""@EMPTY
+0@()@abc
+1@\(\)@abc
+0@a||b@EMPTY
+0@|ab@EMPTY
+0@ab|@EMPTY
+1@(|a)b@EMPTY
+1@(a|)b@EMPTY
+1@(*a)@BADRPT
+1@(+a)@BADRPT
+1@(?a)@BADRPT
+1@({1}a)@BADRPT
+1@\(\{1\}a\)@BADRPT
+1@(a|*b)@BADRPT
+1@(a|+b)@BADRPT
+1@(a|?b)@BADRPT
+1@(a|{1}b)@BADRPT
+0@^*@BADRPT
+0@^*@*
+0@^+@BADRPT
+0@^?@BADRPT
+0@^{1}@BADRPT
+1@^\{1\}@BADRPT
+0@a.c@abc
+0@a[bc]d@abd
+0@a\*c@a*c
+1@ac@abc
+1@a\bc@ac
+1@\{@BADRPT
+0@a\[b@a[b
+2@a[b@EBRACK
+0@a$@a
+1@a$@a$
+1@a\$@a
+0@a\$@a$
+1@a\$@a
+1@a\$@a\$
+2@a\(b\)\2c@ESUBREG
+2@a\(b\1\)c@ESUBREG
+2@a\(b*\)c\1d@abbcbd
+2@a\(b*\)c\1d@abbcbbbd
+2@^\(.\)\1@abc
+2@a\(\([bc]\)\2\)*d@abbccd
+2@a\(\([bc]\)\2\)*d@abbcbd
+2@a\(\(b\)*\2\)*d@abbbd
+2@\(a\)\1bcd@aabcd
+2@\(a\)\1bc*d@aabcd
+2@\(a\)\1bc*d@aabd
+2@\(a\)\1bc*d@aabcccd
+2@\(a\)\1bc*[ce]d@aabcccd
+2@^\(a\)\1b\(c\)*cd$@aabcccd
+0@ab*c@abc
+0@ab+c@abc
+0@ab?c@abc
+1@a\(*\)b@a*b
+1@a\(**\)b@ab
+1@a\(***\)b@BADRPT
+0@*a@*a
+0@**a@a
+1@***a@BADRPT
+2@{@{
+2@{abc@{abc
+2@{1@BADRPT
+0@{1}@BADRPT
+2@a{b@a{b
+0@a{1}b@ab
+1@a\{1\}b@ab
+0@a{1,}b@ab
+1@a\{1,\}b@ab
+0@a{1,2}b@aab
+1@a\{1,2\}b@aab
+2@a{1@EBRACE
+1@a\{1@EBRACE
+2@a{1a@EBRACE
+1@a\{1a@EBRACE
+2@a{1a}@BADBR
+1@a\{1a\}@BADBR
+0@a{,2}@a{,2}
+1@a\{,2\}@BADBR
+0@a{,}@a{,}
+1@a\{,\}@BADBR
+2@a{1,x}@BADBR
+1@a\{1,x\}@BADBR
+2@a{1,x@EBRACE
+1@a\{1,x@EBRACE
+1@a{300}@BADBR
+1@a\{300\}@BADBR
+1@a{1,0}@BADBR
+1@a\{1,0\}@BADBR
+0@ab{0,0}c@abcac
+1@ab\{0,0\}c@abcac
+0@ab{0,1}c@abcac
+1@ab\{0,1\}c@abcac
+0@ab{0,3}c@abbcac
+1@ab\{0,3\}c@abbcac
+0@ab{1,1}c@acabc
+1@ab\{1,1\}c@acabc
+0@ab{1,3}c@acabc
+1@ab\{1,3\}c@acabc
+0@ab{2,2}c@abcabbc
+1@ab\{2,2\}c@abcabbc
+0@ab{2,4}c@abcabbc
+1@ab\{2,4\}c@abcabbc
+0@a**@BADRPT
+1@a++@BADRPT
+0@a??@BADRPT
+0@a*+@BADRPT
+0@a*?@BADRPT
+0@a+*@BADRPT
+0@a+?@BADRPT
+0@a?*@BADRPT
+0@a?+@BADRPT
+1@a{1}{1}@BADRPT
+0@a*{1}@BADRPT
+1@a+{1}@BADRPT
+0@a?{1}@BADRPT
+0@a{1}*@BADRPT
+1@a{1}+@BADRPT
+0@a{1}?@BADRPT
+2@a*{b}@a{b}
+1@a\{1\}\{1\}@BADRPT
+1@a*\{1\}@BADRPT
+1@a\{1\}*@BADRPT
+0@a[b]c@abc
+0@a[ab]c@abc
+0@a[^ab]c@adc
+0@a[]b]c@a]c
+0@a[[b]c@a[c
+0@a[-b]c@a-c
+0@a[^]b]c@adc
+0@a[^-b]c@adc
+0@a[b-]c@a-c
+2@a[b@EBRACK
+2@a[]@EBRACK
+0@a[1-3]c@a2c
+1@a[3-1]c@ERANGE
+1@a[1-3-5]c@ERANGE
+1@a[[.-.]--]c@a-c
+2@a[1-@ERANGE
+2@a[[.@EBRACK
+2@a[[.x@EBRACK
+2@a[[.x.@EBRACK
+1@a[[.x.]@EBRACK
+1@a[[.x.]]@ax
+1@a[[.x,.]]@ECOLLATE
+1@a[[.one.]]b@a1b
+1@a[[.notdef.]]b@ECOLLATE
+1@a[[.].]]b@a]b
+0@a[[:alpha:]]c@abc
+2@a[[:notdef:]]c@ECTYPE
+2@a[[:@EBRACK
+2@a[[:alpha@EBRACK
+2@a[[:alpha:]@EBRACK
+2@a[[:alpha,:]@ECTYPE
+2@a[[:]:]]b@ECTYPE
+2@a[[:-:]]b@ECTYPE
+2@a[[:alph:]]@ECTYPE
+2@a[[:alphabet:]]@ECTYPE
+1@[[:blank:]]+@aSSTb
+1@[[:cntrl:]]+@aNTb
+0@[[:digit:]]+@a019b
+0@[[:graph:]]+@Sa%bS
+0@[[:lower:]]+@AabC
+0@[[:print:]]+@NaSbN
+0@[[:punct:]]+@S%-&T
+1@[[:space:]]+@aSNTb
+0@[[:upper:]]+@aBCd
+0@[[:xdigit:]]+@p0f3Cq
+1@a[[=b=]]c@abc
+2@a[[=@EBRACK
+2@a[[=b@EBRACK
+2@a[[=b=@EBRACK
+1@a[[=b=]@EBRACK
+1@a[[=b,=]]@ECOLLATE
+1@a[[=one=]]b@a1b
+0@a(((b)))c@abc
+0@a(b|(c))d@abd
+0@a(b*|c)d@abbd
+0@a[ab]{20}@aaaaabaaaabaaaabaaaab
+0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]@aaaaabaaaabaaaabaaaab
+0@a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)@aaaaabaaaabaaaabaaaabweeknights
+0@12345678901234567890123456789@a12345678901234567890123456789b
+0@123456789012345678901234567890@a123456789012345678901234567890b
+0@1234567890123456789012345678901@a1234567890123456789012345678901b
+0@12345678901234567890123456789012@a12345678901234567890123456789012b
+0@123456789012345678901234567890123@a123456789012345678901234567890123b
+0@1234567890123456789012345678901234567890123456789012345678901234567890@a1234567890123456789012345678901234567890123456789012345678901234567890b
+0@[ab][cd][ef][gh][ij][kl][mn]@xacegikmoq
+0@[ab][cd][ef][gh][ij][kl][mn][op]@xacegikmoq
+0@[ab][cd][ef][gh][ij][kl][mn][op][qr]@xacegikmoqy
+0@[ab][cd][ef][gh][ij][kl][mn][op][q]@xacegikmoqy
+0@abc@xabcy
+2@a\(b\)?c\1d@acd
+1@aBc@Abc
+1@a[Bc]*d@abBCcd
+1@0[[:upper:]]1@0a1
+1@0[[:lower:]]1@0A1
+1@a[^b]c@abc
+0@a[^b]c@aBc
+0@a[^b]c@adc
+0@[a]b[c]@abc
+0@[a]b[a]@aba
+0@[abc]b[abc]@abc
+0@[abc]b[abd]@abd
+0@a(b?c)+d@accd
+0@(wee|week)(knights|night)@weeknights
+0@(we|wee|week|frob)(knights|night|day)@weeknights
+0@a[bc]d@xyzaaabcaababdacd
+0@a[ab]c@aaabc
+0@abc@abc
+0@a*@b
+0@/\*.*\*/@/*x*/
+0@/\*.*\*/@/*x*/y/*z*/
+0@/\*([^*]|\*[^/])*\*/@/*x*/
+0@/\*([^*]|\*[^/])*\*/@/*x*/y/*z*/
+0@/\*([^*]|\*[^/])*\*/@/*x**/y/*z*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x*/y/*z*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x**/y/*z*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x****/y/*z*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x**x*/y/*z*/
+0@/\*([^*]|\*+[^*/])*\*+/@/*x***x/y/*z*/
+0@[abc]@a(b)c
+0@[abc]@a(d)c
+0@[abc]@a(bc)d
+0@[abc]@a(dc)d
+0@.@a()c
+0@b.*c@b(bc)c
+0@b.*@b(bc)c
+0@.*c@b(bc)c
+0@abc@abc
+0@abc@xabcy
+1@abc@xyz
+0@a*b@aba*b
+0@a*b@ab
+1@""@EMPTY
+1@aZb@a
+1@aZb@a
+0@aZb@(aZb)
+0@aZ*b@(ab)
+0@a.b@(aZb)
+0@a.*@(aZb)c
+2@[[:<:]]a@a
+2@[[:<:]]a@ba
+2@[[:<:]]a@-a
+2@a[[:>:]]@a
+2@a[[:>:]]@ab
+2@a[[:>:]]@a-
+2@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc
+2@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc-q
+2@[[:<:]]a.c[[:>:]]@axc-dayc-dazce-abc
+2@[[:<:]]b.c[[:>:]]@a_bxc-byc_d-bzc-q
+2@[[:<:]].x..[[:>:]]@y_xa_-_xb_y-_xc_-axdc
+2@[[:<:]]a_b[[:>:]]@x_a_b
+0@(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])@A1
+0@abcdefghijklmnop@abcdefghijklmnop
+0@abcdefghijklmnopqrstuv@abcdefghijklmnopqrstuv
+0@CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a@CC11
+0@a?b@ab
+1@-\{0,1\}[0-9]*$@-5
diff --git a/gnu/usr.bin/grep/tests/status.sh b/gnu/usr.bin/grep/tests/status.sh
index 50fc912..94f5929 100755
--- a/gnu/usr.bin/grep/tests/status.sh
+++ b/gnu/usr.bin/grep/tests/status.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
# Test for status code for GNU grep.
# status code
# 0 match found
@@ -24,15 +24,29 @@ if test $? -ne 1 ; then
fi
# the filename MMMMMMMM.MMM should not exist hopefully
-# should return 2 file not found
-if test -b MMMMMMMM.MMM; then
+if test -r MMMMMMMM.MMM; then
echo "Please remove MMMMMMMM.MMM to run check"
else
- ${GREP} -E -e 'abc' MMMMMMMM.MMM> /dev/null 2>&1
+ # should return 2 file not found
+ ${GREP} -E -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1
if test $? -ne 2 ; then
echo "Status: Wrong status code, test \#3 failed"
failures=1
fi
+
+ # should return 2 file not found
+ ${GREP} -E -s -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1
+ if test $? -ne 2 ; then
+ echo "Status: Wrong status code, test \#4 failed"
+ failures=1
+ fi
+
+ # should return 0 found a match
+ echo "abcd" | ${GREP} -E -q -s 'abc' MMMMMMMM.MMM - > /dev/null 2>&1
+ if test $? -ne 0 ; then
+ echo "Status: Wrong status code, test \#5 failed"
+ failures=1
+ fi
fi
exit $failures
diff --git a/gnu/usr.bin/grep/tests/tests b/gnu/usr.bin/grep/tests/tests
new file mode 100644
index 0000000..8ed938d
--- /dev/null
+++ b/gnu/usr.bin/grep/tests/tests
@@ -0,0 +1,475 @@
+# regular expression test set
+# Lines are at least three fields, separated by one or more tabs. "" stands
+# for an empty field. First field is an RE. Second field is flags. If
+# C flag given, regcomp() is expected to fail, and the third field is the
+# error name (minus the leading REG_).
+#
+# Otherwise it is expected to succeed, and the third field is the string to
+# try matching it against. If there is no fourth field, the match is
+# expected to fail. If there is a fourth field, it is the substring that
+# the RE is expected to match. If there is a fifth field, it is a comma-
+# separated list of what the subexpressions should match, with - indicating
+# no match for that one. In both the fourth and fifth fields, a (sub)field
+# starting with @ indicates that the (sub)expression is expected to match
+# a null string followed by the stuff after the @; this provides a way to
+# test where null strings match. The character `N' in REs and strings
+# is newline, `S' is space, `T' is tab, `Z' is NUL.
+#
+# The full list of flags:
+# - placeholder, does nothing
+# b RE is a BRE, not an ERE
+# & try it as both an ERE and a BRE
+# C regcomp() error expected, third field is error name
+# i REG_ICASE
+# m ("mundane") REG_NOSPEC
+# s REG_NOSUB (not really testable)
+# n REG_NEWLINE
+# ^ REG_NOTBOL
+# $ REG_NOTEOL
+# # REG_STARTEND (see below)
+# p REG_PEND
+#
+# For REG_STARTEND, the start/end offsets are those of the substring
+# enclosed in ().
+
+# basics
+a & a a
+abc & abc abc
+abc|de - abc abc
+a|b|c - abc a
+
+# parentheses and perversions thereof
+a(b)c - abc abc
+a\(b\)c b abc abc
+a( C EPAREN
+a( b a( a(
+a\( - a( a(
+a\( bC EPAREN
+a\(b bC EPAREN
+a(b C EPAREN
+a(b b a(b a(b
+# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
+a) - a) a)
+) - ) )
+# end gagging (in a just world, those *should* give EPAREN)
+a) b a) a)
+a\) bC EPAREN
+\) bC EPAREN
+a()b - ab ab
+a\(\)b b ab ab
+
+# anchoring and REG_NEWLINE
+^abc$ & abc abc
+a^b - a^b
+a^b b a^b a^b
+a$b - a$b
+a$b b a$b a$b
+^ & abc @abc
+$ & abc @
+^$ & "" @
+$^ - "" @
+\($\)\(^\) b "" @
+# stop retching, those are legitimate (although disgusting)
+^^ - "" @
+$$ - "" @
+##b$ & abNc
+##b$ &n abNc b
+##^b$ & aNbNc
+##^b$ &n aNbNc b
+##^$ &n aNNb @Nb
+^$ n abc
+##^$ n abcN @
+##$^ n aNNb @Nb
+##\($\)\(^\) bn aNNb @Nb
+##^^ n^ aNNb @Nb
+##$$ n aNNb @NN
+^a ^ a
+a$ $ a
+##^a ^n aNb
+##^b ^n aNb b
+##a$ $n bNa
+##b$ $n bNa b
+a*(^b$)c* - b b
+a*\(^b$\)c* b b b
+
+# certain syntax errors and non-errors
+| C EMPTY
+| b | |
+* C BADRPT
+* b * *
++ C BADRPT
+? C BADRPT
+"" &C EMPTY
+() - abc @abc
+\(\) b abc @abc
+a||b C EMPTY
+|ab C EMPTY
+ab| C EMPTY
+(|a)b C EMPTY
+(a|)b C EMPTY
+(*a) C BADRPT
+(+a) C BADRPT
+(?a) C BADRPT
+({1}a) C BADRPT
+\(\{1\}a\) bC BADRPT
+(a|*b) C BADRPT
+(a|+b) C BADRPT
+(a|?b) C BADRPT
+(a|{1}b) C BADRPT
+^* C BADRPT
+^* b * *
+^+ C BADRPT
+^? C BADRPT
+^{1} C BADRPT
+^\{1\} bC BADRPT
+
+# metacharacters, backslashes
+a.c & abc abc
+a[bc]d & abd abd
+a\*c & a*c a*c
+a\\b & a\b a\b
+a\\\*b & a\*b a\*b
+a\bc & abc abc
+a\ &C EESCAPE
+a\\bc & a\bc a\bc
+\{ bC BADRPT
+a\[b & a[b a[b
+a[b &C EBRACK
+# trailing $ is a peculiar special case for the BRE code
+a$ & a a
+a$ & a$
+a\$ & a
+a\$ & a$ a$
+a\\$ & a
+a\\$ & a$
+a\\$ & a\$
+a\\$ & a\ a\
+
+# back references, ugh
+##a\(b\)\2c bC ESUBREG
+##a\(b\1\)c bC ESUBREG
+a\(b*\)c\1d b abbcbbd abbcbbd bb
+a\(b*\)c\1d b abbcbd
+a\(b*\)c\1d b abbcbbbd
+^\(.\)\1 b abc
+a\([bc]\)\1d b abcdabbd abbd b
+a\(\([bc]\)\2\)*d b abbccd abbccd
+a\(\([bc]\)\2\)*d b abbcbd
+# actually, this next one probably ought to fail, but the spec is unclear
+a\(\(b\)*\2\)*d b abbbd abbbd
+# here is a case that no NFA implementation does right
+\(ab*\)[ab]*\1 b ababaaa ababaaa a
+# check out normal matching in the presence of back refs
+\(a\)\1bcd b aabcd aabcd
+\(a\)\1bc*d b aabcd aabcd
+\(a\)\1bc*d b aabd aabd
+\(a\)\1bc*d b aabcccd aabcccd
+\(a\)\1bc*[ce]d b aabcccd aabcccd
+^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
+
+# ordinary repetitions
+ab*c & abc abc
+ab+c - abc abc
+ab?c - abc abc
+a\(*\)b b a*b a*b
+a\(**\)b b ab ab
+a\(***\)b bC BADRPT
+*a b *a *a
+**a b a a
+***a bC BADRPT
+
+# the dreaded bounded repetitions
+{ & { {
+{abc & {abc {abc
+{1 C BADRPT
+{1} C BADRPT
+a{b & a{b a{b
+a{1}b - ab ab
+a\{1\}b b ab ab
+a{1,}b - ab ab
+a\{1,\}b b ab ab
+a{1,2}b - aab aab
+a\{1,2\}b b aab aab
+a{1 C EBRACE
+a\{1 bC EBRACE
+a{1a C EBRACE
+a\{1a bC EBRACE
+a{1a} C BADBR
+a\{1a\} bC BADBR
+a{,2} - a{,2} a{,2}
+a\{,2\} bC BADBR
+a{,} - a{,} a{,}
+a\{,\} bC BADBR
+a{1,x} C BADBR
+a\{1,x\} bC BADBR
+a{1,x C EBRACE
+a\{1,x bC EBRACE
+a{300} C BADBR
+a\{300\} bC BADBR
+a{1,0} C BADBR
+a\{1,0\} bC BADBR
+ab{0,0}c - abcac ac
+ab\{0,0\}c b abcac ac
+ab{0,1}c - abcac abc
+ab\{0,1\}c b abcac abc
+ab{0,3}c - abbcac abbc
+ab\{0,3\}c b abbcac abbc
+ab{1,1}c - acabc abc
+ab\{1,1\}c b acabc abc
+ab{1,3}c - acabc abc
+ab\{1,3\}c b acabc abc
+ab{2,2}c - abcabbc abbc
+ab\{2,2\}c b abcabbc abbc
+ab{2,4}c - abcabbc abbc
+ab\{2,4\}c b abcabbc abbc
+((a{1,10}){1,10}){1,10} - a a a,a
+
+# multiple repetitions
+a** &C BADRPT
+a++ C BADRPT
+a?? C BADRPT
+a*+ C BADRPT
+a*? C BADRPT
+a+* C BADRPT
+a+? C BADRPT
+a?* C BADRPT
+a?+ C BADRPT
+a{1}{1} C BADRPT
+a*{1} C BADRPT
+a+{1} C BADRPT
+a?{1} C BADRPT
+a{1}* C BADRPT
+a{1}+ C BADRPT
+a{1}? C BADRPT
+a*{b} - a{b} a{b}
+a\{1\}\{1\} bC BADRPT
+a*\{1\} bC BADRPT
+a\{1\}* bC BADRPT
+
+# brackets, and numerous perversions thereof
+a[b]c & abc abc
+a[ab]c & abc abc
+a[^ab]c & adc adc
+a[]b]c & a]c a]c
+a[[b]c & a[c a[c
+a[-b]c & a-c a-c
+a[^]b]c & adc adc
+a[^-b]c & adc adc
+a[b-]c & a-c a-c
+a[b &C EBRACK
+a[] &C EBRACK
+a[1-3]c & a2c a2c
+a[3-1]c &C ERANGE
+a[1-3-5]c &C ERANGE
+a[[.-.]--]c & a-c a-c
+a[1- &C ERANGE
+a[[. &C EBRACK
+a[[.x &C EBRACK
+a[[.x. &C EBRACK
+a[[.x.] &C EBRACK
+a[[.x.]] & ax ax
+a[[.x,.]] &C ECOLLATE
+a[[.one.]]b & a1b a1b
+a[[.notdef.]]b &C ECOLLATE
+a[[.].]]b & a]b a]b
+a[[:alpha:]]c & abc abc
+a[[:notdef:]]c &C ECTYPE
+a[[: &C EBRACK
+a[[:alpha &C EBRACK
+a[[:alpha:] &C EBRACK
+a[[:alpha,:] &C ECTYPE
+a[[:]:]]b &C ECTYPE
+a[[:-:]]b &C ECTYPE
+a[[:alph:]] &C ECTYPE
+a[[:alphabet:]] &C ECTYPE
+##[[:alnum:]]+ - -%@a0X- a0X
+##[[:alpha:]]+ - -%@aX0- aX
+[[:blank:]]+ - aSSTb SST
+##[[:cntrl:]]+ - aNTb NT
+[[:digit:]]+ - a019b 019
+##[[:graph:]]+ - Sa%bS a%b
+[[:lower:]]+ - AabC ab
+##[[:print:]]+ - NaSbN aSb
+##[[:punct:]]+ - S%-&T %-&
+[[:space:]]+ - aSNTb SNT
+[[:upper:]]+ - aBCd BC
+[[:xdigit:]]+ - p0f3Cq 0f3C
+a[[=b=]]c & abc abc
+a[[= &C EBRACK
+a[[=b &C EBRACK
+a[[=b= &C EBRACK
+a[[=b=] &C EBRACK
+a[[=b,=]] &C ECOLLATE
+a[[=one=]]b & a1b a1b
+
+# complexities
+a(((b)))c - abc abc
+a(b|(c))d - abd abd
+a(b*|c)d - abbd abbd
+# just gotta have one DFA-buster, of course
+a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
+# and an inline expansion in case somebody gets tricky
+a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
+# and in case somebody just slips in an NFA...
+a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
+# fish for anomalies as the number of states passes 32
+12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
+123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
+1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
+12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
+123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
+# and one really big one, beyond any plausible word width
+1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
+# fish for problems as brackets go past 8
+[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
+[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
+[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
+[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
+
+# subtleties of matching
+abc & xabcy abc
+a\(b\)?c\1d b acd
+aBc i Abc Abc
+a[Bc]*d i abBCcd abBCcd
+0[[:upper:]]1 &i 0a1 0a1
+0[[:lower:]]1 &i 0A1 0A1
+a[^b]c &i abc
+a[^b]c &i aBc
+a[^b]c &i adc adc
+[a]b[c] - abc abc
+[a]b[a] - aba aba
+[abc]b[abc] - abc abc
+[abc]b[abd] - abd abd
+a(b?c)+d - accd accd
+(wee|week)(knights|night) - weeknights weeknights
+(we|wee|week|frob)(knights|night|day) - weeknights weeknights
+a[bc]d - xyzaaabcaababdacd abd
+a[ab]c - aaabc abc
+abc s abc abc
+a* & b @b
+
+# Let's have some fun -- try to match a C comment.
+# first the obvious, which looks okay at first glance...
+/\*.*\*/ - /*x*/ /*x*/
+# but...
+/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
+# okay, we must not match */ inside; try to do that...
+/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
+/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
+# but...
+/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
+# and a still fancier version, which does it right (I think)...
+/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
+/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
+/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
+/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
+/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
+/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
+
+# subexpressions
+a(b)(c)d - abcd abcd b,c
+a(((b)))c - abc abc b,b,b
+a(b|(c))d - abd abd b,-
+a(b*|c|e)d - abbd abbd bb
+a(b*|c|e)d - acd acd c
+a(b*|c|e)d - ad ad @d
+a(b?)c - abc abc b
+a(b?)c - ac ac @c
+a(b+)c - abc abc b
+a(b+)c - abbbc abbbc bbb
+a(b*)c - ac ac @c
+(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
+# the regression tester only asks for 9 subexpressions
+a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
+a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
+a([bc]?)c - abc abc b
+a([bc]?)c - ac ac @c
+a([bc]+)c - abc abc b
+a([bc]+)c - abcc abcc bc
+a([bc]+)bc - abcbc abcbc bc
+a(bb+|b)b - abb abb b
+a(bbb+|bb+|b)b - abb abb b
+a(bbb+|bb+|b)b - abbb abbb bb
+a(bbb+|bb+|b)bb - abbb abbb b
+(.*).* - abcdef abcdef abcdef
+##(a*)* - bc @b @b
+
+# do we get the right subexpression when it is used more than once?
+a(b|c)*d - ad ad -
+a(b|c)*d - abcd abcd c
+a(b|c)+d - abd abd b
+a(b|c)+d - abcd abcd c
+a(b|c?)+d - ad ad @d
+a(b|c?)+d - abcd abcd @d
+a(b|c){0,0}d - ad ad -
+a(b|c){0,1}d - ad ad -
+a(b|c){0,1}d - abd abd b
+a(b|c){0,2}d - ad ad -
+a(b|c){0,2}d - abcd abcd c
+a(b|c){0,}d - ad ad -
+a(b|c){0,}d - abcd abcd c
+a(b|c){1,1}d - abd abd b
+a(b|c){1,1}d - acd acd c
+a(b|c){1,2}d - abd abd b
+a(b|c){1,2}d - abcd abcd c
+a(b|c){1,}d - abd abd b
+a(b|c){1,}d - abcd abcd c
+a(b|c){2,2}d - acbd acbd b
+a(b|c){2,2}d - abcd abcd c
+a(b|c){2,4}d - abcd abcd c
+a(b|c){2,4}d - abcbd abcbd b
+a(b|c){2,4}d - abcbcd abcbcd c
+a(b|c){2,}d - abcd abcd c
+a(b|c){2,}d - abcbd abcbd b
+##a(b+|((c)*))+d - abd abd @d,@d,-
+##a(b+|((c)*))+d - abcd abcd @d,@d,-
+
+# check out the STARTEND option
+[abc] &# a(b)c b
+[abc] &# a(d)c
+[abc] &# a(bc)d b
+[abc] &# a(dc)d c
+. &# a()c
+b.*c &# b(bc)c bc
+b.* &# b(bc)c bc
+.*c &# b(bc)c bc
+
+# plain strings, with the NOSPEC flag
+abc m abc abc
+abc m xabcy abc
+abc m xyz
+a*b m aba*b a*b
+a*b m ab
+"" mC EMPTY
+
+# cases involving NULs
+aZb & a a
+aZb &p a
+#aZb &p# (aZb) aZb
+aZ*b &p# (ab) ab
+#a.b &# (aZb) aZb
+#a.* &# (aZb)c aZb
+
+# word boundaries (ick)
+[[:<:]]a & a a
+[[:<:]]a & ba
+[[:<:]]a & -a a
+a[[:>:]] & a a
+a[[:>:]] & ab
+a[[:>:]] & a- a
+[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
+[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
+[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
+[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
+[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
+[[:<:]]a_b[[:>:]] & x_a_b
+
+# past problems, and suspected problems
+(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
+abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
+abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
+(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
+CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
+Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
+a?b - ab ab
+-\{0,1\}[0-9]*$ b -5 -5
diff --git a/gnu/usr.bin/grep/tests/warning.sh b/gnu/usr.bin/grep/tests/warning.sh
index d2dc6d5..bfca533 100755
--- a/gnu/usr.bin/grep/tests/warning.sh
+++ b/gnu/usr.bin/grep/tests/warning.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
#
# Tell them not to be alarmed.
OpenPOWER on IntegriCloud