Virgin import of GNU Grep 2.3 [trimmed down].
This commit is contained in:
parent
349c680aa7
commit
e0e99c88a7
26
gnu/usr.bin/grep/tests/bre.awk
Normal file
26
gnu/usr.bin/grep/tests/bre.awk
Normal file
@ -0,0 +1,26 @@
|
||||
BEGIN {
|
||||
FS="@";
|
||||
n = 0;
|
||||
printf ("# Generated Spencer BRE Test\n");
|
||||
printf ("failures=0\n");
|
||||
}
|
||||
|
||||
$0 ~ /^#/ { next; }
|
||||
|
||||
NF == 3 {
|
||||
printf ("echo '%s' | ${GREP} -e '%s' > /dev/null 2>&1\n",$3, $2);
|
||||
printf ("if test $? -ne %s ; then\n", $1);
|
||||
printf ("\techo Spencer bre test \\#%d failed\n", ++n);
|
||||
printf ("\tfailures=1\n");
|
||||
printf ("fi\n");
|
||||
}
|
||||
|
||||
NF == 4 {
|
||||
#don't alarm users
|
||||
# printf ("echo '%s' | ${GREP} -e '%s' > /dev/null 2>&1\n",$3, $2);
|
||||
# printf ("if test $? -ne %s ; then\n", $1);
|
||||
# printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n);
|
||||
# printf ("fi\n");
|
||||
}
|
||||
|
||||
END { printf ("exit $failures\n"); }
|
13
gnu/usr.bin/grep/tests/bre.sh
Executable file
13
gnu/usr.bin/grep/tests/bre.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
# Regression test for GNU grep.
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
# . . . and the following by Henry Spencer.
|
||||
|
||||
${AWK-awk} -f $srcdir/bre.awk $srcdir/bre.tests > bre.script
|
||||
|
||||
sh bre.script && exit $failures
|
||||
exit 1
|
62
gnu/usr.bin/grep/tests/bre.tests
Normal file
62
gnu/usr.bin/grep/tests/bre.tests
Normal file
@ -0,0 +1,62 @@
|
||||
0@a\(b\)c@abc
|
||||
0@a(@a(
|
||||
2@a\(@EPAREN
|
||||
2@a\(b@EPAREN
|
||||
0@a(b@a(b
|
||||
0@a)@a)
|
||||
2@a\)@EPAREN
|
||||
2@\)@EPAREN
|
||||
0@a\(\)b@ab
|
||||
0@a^b@a^b@TO CORRECT
|
||||
0@a$b@a$b
|
||||
0@\($\)\(^\)@@
|
||||
0@a*\(^b$\)c*@b
|
||||
0@|@|
|
||||
0@*@*
|
||||
0@\(\)@abc
|
||||
2@\(\{1\}a\)@BADRPT@TO CORRECT
|
||||
0@^*@*
|
||||
2@^\{1\}@BADRPT@TO CORRECT
|
||||
2@\{@BADRPT
|
||||
1@a\(b*\)c\1d@abbcbd
|
||||
1@a\(b*\)c\1d@abbcbbbd
|
||||
1@^\(.\)\1@abc
|
||||
0@a\(\([bc]\)\2\)*d@abbccd
|
||||
1@a\(\([bc]\)\2\)*d@abbcbd
|
||||
0@a\(\(b\)*\2\)*d@abbbd
|
||||
0@\(a\)\1bcd@aabcd
|
||||
0@\(a\)\1bc*d@aabcd
|
||||
0@\(a\)\1bc*d@aabd
|
||||
0@\(a\)\1bc*d@aabcccd
|
||||
0@\(a\)\1bc*[ce]d@aabcccd@TO CORRECT
|
||||
0@^\(a\)\1b\(c\)*cd$@aabcccd
|
||||
0@a\(*\)b@a*b
|
||||
0@a\(**\)b@ab
|
||||
2@a\(***\)b@BADRPT@TO CORRECT
|
||||
0@*a@*a
|
||||
0@**a@a
|
||||
2@***a@BADRPT@TO CORRECT
|
||||
0@a\{1\}b@ab
|
||||
0@a\{1,\}b@ab
|
||||
0@a\{1,2\}b@aab
|
||||
2@a\{1@EBRACE
|
||||
2@a\{1a@EBRACE
|
||||
2@a\{1a\}@BADBR
|
||||
2@a\{,2\}@BADBR
|
||||
2@a\{,\}@BADBR
|
||||
2@a\{1,x\}@BADBR
|
||||
2@a\{1,x@EBRACE
|
||||
2@a\{300\}@BADBR@TO CORRECT
|
||||
2@a\{1,0\}@BADBR
|
||||
0@ab\{0,0\}c@abcac
|
||||
0@ab\{0,1\}c@abcac
|
||||
0@ab\{0,3\}c@abbcac
|
||||
0@ab\{1,1\}c@acabc
|
||||
0@ab\{1,3\}c@acabc
|
||||
0@ab\{2,2\}c@abcabbc
|
||||
0@ab\{2,4\}c@abcabbc
|
||||
2@a\{1\}\{1\}@BADRPT@TO CORRECT
|
||||
2@a*\{1\}@BADRPT@TO CORRECT
|
||||
2@a\{1\}*@BADRPT@TO CORRECT
|
||||
1@a\(b\)?c\1d@acd
|
||||
0@-\{0,1\}[0-9]*$@-5
|
30
gnu/usr.bin/grep/tests/empty.sh
Executable file
30
gnu/usr.bin/grep/tests/empty.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#! /bin/sh
|
||||
# test that the empty file means no pattern
|
||||
# and an empty pattern means match all.
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
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
|
||||
|
||||
# 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 "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
|
||||
|
||||
exit $failures
|
31
gnu/usr.bin/grep/tests/ere.awk
Normal file
31
gnu/usr.bin/grep/tests/ere.awk
Normal file
@ -0,0 +1,31 @@
|
||||
BEGIN {
|
||||
FS="@";
|
||||
n = 0;
|
||||
printf ("# Generated Spencer ERE Test\n");
|
||||
printf ("failures=0\n");
|
||||
}
|
||||
|
||||
$0 ~ /^#/ { next; }
|
||||
|
||||
NF == 3 {
|
||||
printf ("echo '%s' | ${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2);
|
||||
printf ("if test $? -ne %s ; then\n", $1);
|
||||
printf ("\techo Spencer ere test \\#%d failed\n", ++n);
|
||||
printf ("\tfailures=1\n");
|
||||
printf ("fi\n");
|
||||
}
|
||||
|
||||
NF == 4 {
|
||||
# don't alarm the user for now
|
||||
# printf ("echo '%s'|${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2);
|
||||
# printf ("if test $? -ne %s ; then\n", $1);
|
||||
# printf ("\techo Expected non conformance \\#%d ... continuing\n", ++n);
|
||||
# printf ("fi\n");
|
||||
}
|
||||
|
||||
NF == 5 {
|
||||
# don't alarm the user for now
|
||||
next;
|
||||
}
|
||||
|
||||
END { printf ("exit $failures\n"); }
|
13
gnu/usr.bin/grep/tests/ere.sh
Executable file
13
gnu/usr.bin/grep/tests/ere.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
# Regression test for GNU grep.
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
# . . . and the following by Henry Spencer.
|
||||
|
||||
${AWK-awk} -f $srcdir/ere.awk $srcdir/ere.tests > ere.script
|
||||
|
||||
sh ere.script && exit $failures
|
||||
exit 1
|
215
gnu/usr.bin/grep/tests/ere.tests
Normal file
215
gnu/usr.bin/grep/tests/ere.tests
Normal file
@ -0,0 +1,215 @@
|
||||
0@a@a
|
||||
0@abc@abc
|
||||
0@abc|de@abc
|
||||
0@a|b|c@abc
|
||||
0@a(b)c@abc
|
||||
2@a(@EPAREN
|
||||
0@a\(@a(
|
||||
2@a(b@EPAREN
|
||||
0@a)@a)@POSIX BOTCH
|
||||
0@)@)@POSIX BOTCH
|
||||
0@a()b@ab
|
||||
0@^abc$@abc
|
||||
1@a^b@a^b
|
||||
1@a$b@a$b
|
||||
0@^@abc
|
||||
0@$@abc
|
||||
0@^$@@
|
||||
0@$^@@
|
||||
0@^^@@
|
||||
0@$$@@
|
||||
0@a*(^b$)c*@b
|
||||
2@|@EMPTY@NO ALTERNATION
|
||||
2@*@BADRPT@TO CORRECT
|
||||
2@+@BADRPT@TO CORRECT
|
||||
2@?@BADRPT@TO CORRECT
|
||||
1@&C@PASS
|
||||
0@()@abc
|
||||
2@a||b@EMPTY@NO ALTERNATION
|
||||
2@|ab@EMPTY@NO ALTERNATION
|
||||
2@ab|@EMPTY@NO ALTERNATION
|
||||
2@(|a)b@EMPTY@NO ALTERNATION
|
||||
2@(a|)b@EMPTY@NO ALTERNATION
|
||||
2@(*a)@BADRPT@TO CORRECT
|
||||
2@(+a)@BADRPT@TO CORRECT
|
||||
2@(?a)@BADRPT@TO CORRECT
|
||||
2@({1}a)@BADRPT@TO CORRECT
|
||||
2@(a|*b)@BADRPT@NO ALTERNATION
|
||||
2@(a|+b)@BADRPT@NO ALTERNATION
|
||||
2@(a|?b)@BADRPT@NO ALTERNATION
|
||||
2@(a|{1}b)@BADRPT@NO ALTERNATION
|
||||
2@^*@BADRPT@TO CORRECT
|
||||
2@^+@BADRPT@TO CORRECT
|
||||
2@^?@BADRPT@TO CORRECT
|
||||
2@^{1}@BADRPT@TO CORRECT
|
||||
0@a.c@abc
|
||||
0@a[bc]d@abd
|
||||
0@a\*c@a*c
|
||||
0@a\\b@a\b@TO CORRECT
|
||||
0@a\\\*b@a\*b
|
||||
0@a\bc@abc@TO CORRECT
|
||||
2@a\@EESCAPE
|
||||
0@a\\bc@a\bc@TO CORRECT
|
||||
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$
|
||||
1@a\\$@a\$
|
||||
0@a\\$@a\
|
||||
0@ab*c@abc
|
||||
0@ab+c@abc
|
||||
0@ab?c@abc
|
||||
0@{@{@TO CORRECT
|
||||
0@{abc@{abc@TO CORRECT
|
||||
2@{1@BADRPT
|
||||
2@{1}@BADRPT@TO CORRECT
|
||||
0@a{b@a{b@TO CORRECT
|
||||
0@a{1}b@ab
|
||||
0@a{1,}b@ab
|
||||
0@a{1,2}b@aab
|
||||
2@a{1@EBRACE
|
||||
2@a{1a@EBRACE
|
||||
2@a{1a}@BADBR
|
||||
0@a{,2}@a{,2}
|
||||
0@a{,}@a{,}
|
||||
2@a{1,x}@BADBR
|
||||
2@a{1,x@EBRACE@TO CORRECT
|
||||
2@a{300}@BADBR@TO CORRECT
|
||||
2@a{1,0}@BADBR@TO CORRECT
|
||||
0@ab{0,0}c@abcac
|
||||
0@ab{0,1}c@abcac
|
||||
0@ab{0,3}c@abbcac
|
||||
0@ab{1,1}c@acabc
|
||||
0@ab{1,3}c@acabc
|
||||
0@ab{2,2}c@abcabbc
|
||||
0@ab{2,4}c@abcabbc
|
||||
2@a**@BADRPT@TO CORRECT
|
||||
2@a++@BADRPT@TO CORRECT
|
||||
2@a??@BADRPT@TO CORRECT
|
||||
2@a*+@BADRPT@TO CORRECT
|
||||
2@a*?@BADRPT@TO CORRECT
|
||||
2@a+*@BADRPT@TO CORRECT
|
||||
2@a+?@BADRPT@TO CORRECT
|
||||
2@a?*@BADRPT@TO CORRECT
|
||||
2@a?+@BADRPT@TO CORRECT
|
||||
2@a{1}{1}@BADRPT@TO CORRECT
|
||||
2@a*{1}@BADRPT@TO CORRECT
|
||||
2@a+{1}@BADRPT@TO CORRECT
|
||||
2@a?{1}@BADRPT@TO CORRECT
|
||||
2@a{1}*@BADRPT@TO CORRECT
|
||||
2@a{1}+@BADRPT@TO CORRECT
|
||||
2@a{1}?@BADRPT@TO CORRECT
|
||||
0@a*{b}@a{b}@TO CORRECT
|
||||
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
|
||||
2@a[3-1]c@ERANGE@TO CORRECT
|
||||
2@a[1-3-5]c@ERANGE@TO CORRECT
|
||||
0@a[[.-.]--]c@a-c@TO CORRECT
|
||||
2@a[1-@ERANGE
|
||||
2@a[[.@EBRACK
|
||||
2@a[[.x@EBRACK
|
||||
2@a[[.x.@EBRACK
|
||||
2@a[[.x.]@EBRACK@TO CORRECT
|
||||
0@a[[.x.]]@ax@TO CORRECT
|
||||
2@a[[.x,.]]@ECOLLATE@TO CORRECT
|
||||
0@a[[.one.]]b@a1b@TO CORRECT
|
||||
2@a[[.notdef.]]b@ECOLLATE@TO CORRECT
|
||||
0@a[[.].]]b@a]b@TO CORRECT
|
||||
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
|
||||
0@[[:digit:]]+@a019b
|
||||
0@[[:lower:]]+@AabC
|
||||
0@[[:upper:]]+@aBCd
|
||||
0@[[:xdigit:]]+@p0f3Cq
|
||||
0@a[[=b=]]c@abc@TO CORRECT
|
||||
2@a[[=@EBRACK
|
||||
2@a[[=b@EBRACK
|
||||
2@a[[=b=@EBRACK
|
||||
2@a[[=b=]@EBRACK@TO CORRECT
|
||||
2@a[[=b,=]]@ECOLLATE@TO CORRECT
|
||||
0@a[[=one=]]b@a1b@TO CORRECT
|
||||
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
|
||||
0@aBc@Abc@TO CORRECT
|
||||
0@a[Bc]*d@abBCcd@TO CORRECT
|
||||
0@0[[:upper:]]1@0a1@TO CORRECT
|
||||
0@0[[:lower:]]1@0A1@TO CORRECT
|
||||
1@a[^b]c@abc
|
||||
1@a[^b]c@aBc@TO CORRECT
|
||||
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@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@aZb@a@TO CORRECT
|
||||
0@[[:<:]]a@a@TO CORRECT
|
||||
1@[[:<:]]a@ba@TO CORRECT
|
||||
0@[[:<:]]a@-a@TO CORRECT
|
||||
0@a[[:>:]]@a@TO CORRECT
|
||||
1@a[[:>:]]@ab@TO CORRECT
|
||||
0@a[[:>:]]@a-@TO CORRECT
|
||||
0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc@TO CORRECT
|
||||
0@[[:<:]]a.c[[:>:]]@axcd-dayc-dazce-abc-q@TO CORRECT
|
||||
0@[[:<:]]a.c[[:>:]]@axc-dayc-dazce-abc@TO CORRECT
|
||||
0@[[:<:]]b.c[[:>:]]@a_bxc-byc_d-bzc-q@TO CORRECT
|
||||
0@[[:<:]].x..[[:>:]]@y_xa_-_xb_y-_xc_-axdc@TO CORRECT
|
||||
1@[[:<:]]a_b[[:>:]]@x_a_b@TO CORRECT
|
||||
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
|
20
gnu/usr.bin/grep/tests/khadafy.sh
Executable file
20
gnu/usr.bin/grep/tests/khadafy.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#! /bin/sh
|
||||
# Regression test for GNU grep.
|
||||
|
||||
: ${srcdir=.}
|
||||
: ${GREP=../src/grep}
|
||||
|
||||
failures=0
|
||||
|
||||
# The Khadafy test is brought to you by Scott Anderson . . .
|
||||
|
||||
${GREP} -E -f $srcdir/khadafy.regexp $srcdir/khadafy.lines > khadafy.out
|
||||
if cmp $srcdir/khadafy.lines khadafy.out
|
||||
then
|
||||
:
|
||||
else
|
||||
echo Khadafy test failed -- output left on khadafy.out
|
||||
failures=1
|
||||
fi
|
||||
|
||||
exit $failures
|
36
gnu/usr.bin/grep/tests/options.sh
Executable file
36
gnu/usr.bin/grep/tests/options.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#! /bin/sh
|
||||
# Test for POSIX.2 options for grep
|
||||
#
|
||||
# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list
|
||||
# [-f pattern_file] ... [file. ..]
|
||||
# grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list]
|
||||
# -f pattern_file ... [file ...]
|
||||
# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...]
|
||||
#
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
# checking for -E extended regex
|
||||
echo "abababccccccd" | ${GREP} -E -e 'c{3}' > /dev/null 2>&1
|
||||
if test $? -ne 0 ; then
|
||||
echo "Options: Wrong status code, test \#1 failed"
|
||||
failures=1
|
||||
fi
|
||||
|
||||
# checking for basic regex
|
||||
echo "abababccccccd" | ${GREP} -G -e 'c\{3\}' > /dev/null 2>&1
|
||||
if test $? -ne 0 ; then
|
||||
echo "Options: Wrong status code, test \#2 failed"
|
||||
failures=1
|
||||
fi
|
||||
|
||||
# checking for fixed string
|
||||
echo "abababccccccd" | ${GREP} -F -e 'c\{3\}' > /dev/null 2>&1
|
||||
if test $? -ne 1 ; then
|
||||
echo "Options: Wrong status code, test \#3 failed"
|
||||
failures=1
|
||||
fi
|
||||
|
||||
exit $failures
|
14
gnu/usr.bin/grep/tests/spencer1.awk
Normal file
14
gnu/usr.bin/grep/tests/spencer1.awk
Normal file
@ -0,0 +1,14 @@
|
||||
BEGIN {
|
||||
FS = "@";
|
||||
printf ("failures=0\n");
|
||||
}
|
||||
|
||||
$0 !~ /^#/ && NF = 3 {
|
||||
printf ("echo '%s'|${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2);
|
||||
printf ("if test $? -ne %s ; then\n", $1);
|
||||
printf ("\techo Spencer test \\#%d failed\n", ++n);
|
||||
printf ("\tfailures=1\n");
|
||||
printf ("fi\n");
|
||||
}
|
||||
|
||||
END { printf ("exit $failures\n"); }
|
13
gnu/usr.bin/grep/tests/spencer1.sh
Executable file
13
gnu/usr.bin/grep/tests/spencer1.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#! /bin/sh
|
||||
# Regression test for GNU grep.
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
# . . . and the following by Henry Spencer.
|
||||
|
||||
${AWK-awk} -f $srcdir/spencer1.awk $srcdir/spencer1.tests > spencer1.script
|
||||
|
||||
sh spencer1.script && exit $failures
|
||||
exit 1
|
122
gnu/usr.bin/grep/tests/spencer1.tests
Normal file
122
gnu/usr.bin/grep/tests/spencer1.tests
Normal file
@ -0,0 +1,122 @@
|
||||
0@abc@abc
|
||||
1@abc@xbc
|
||||
1@abc@axc
|
||||
1@abc@abx
|
||||
0@abc@xabcy
|
||||
0@abc@ababc
|
||||
0@ab*c@abc
|
||||
0@ab*bc@abc
|
||||
0@ab*bc@abbc
|
||||
0@ab*bc@abbbbc
|
||||
0@ab+bc@abbc
|
||||
1@ab+bc@abc
|
||||
1@ab+bc@abq
|
||||
0@ab+bc@abbbbc
|
||||
0@ab?bc@abbc
|
||||
0@ab?bc@abc
|
||||
1@ab?bc@abbbbc
|
||||
0@ab?c@abc
|
||||
0@^abc$@abc
|
||||
1@^abc$@abcc
|
||||
0@^abc@abcc
|
||||
1@^abc$@aabc
|
||||
0@abc$@aabc
|
||||
0@^@abc
|
||||
0@$@abc
|
||||
0@a.c@abc
|
||||
0@a.c@axc
|
||||
0@a.*c@axyzc
|
||||
1@a.*c@axyzd
|
||||
1@a[bc]d@abc
|
||||
0@a[bc]d@abd
|
||||
1@a[b-d]e@abd
|
||||
0@a[b-d]e@ace
|
||||
0@a[b-d]@aac
|
||||
0@a[-b]@a-
|
||||
0@a[b-]@a-
|
||||
1@a[b-a]@-
|
||||
2@a[]b@-
|
||||
2@a[@-
|
||||
0@a]@a]
|
||||
0@a[]]b@a]b
|
||||
0@a[^bc]d@aed
|
||||
1@a[^bc]d@abd
|
||||
0@a[^-b]c@adc
|
||||
1@a[^-b]c@a-c
|
||||
1@a[^]b]c@a]c
|
||||
0@a[^]b]c@adc
|
||||
0@ab|cd@abc
|
||||
0@ab|cd@abcd
|
||||
0@()ef@def
|
||||
0@()*@-
|
||||
1@*a@-
|
||||
0@^*@-
|
||||
0@$*@-
|
||||
1@(*)b@-
|
||||
1@$b@b
|
||||
2@a\@-
|
||||
0@a\(b@a(b
|
||||
0@a\(*b@ab
|
||||
0@a\(*b@a((b
|
||||
1@a\x@a\x
|
||||
2@abc)@-
|
||||
2@(abc@-
|
||||
0@((a))@abc
|
||||
0@(a)b(c)@abc
|
||||
0@a+b+c@aabbabc
|
||||
0@a**@-
|
||||
0@a*?@-
|
||||
0@(a*)*@-
|
||||
0@(a*)+@-
|
||||
0@(a|)*@-
|
||||
0@(a*|b)*@-
|
||||
0@(a+|b)*@ab
|
||||
0@(a+|b)+@ab
|
||||
0@(a+|b)?@ab
|
||||
0@[^ab]*@cde
|
||||
0@(^)*@-
|
||||
0@(ab|)*@-
|
||||
2@)(@-
|
||||
1@abc@
|
||||
1@abc@
|
||||
0@a*@
|
||||
0@([abc])*d@abbbcd
|
||||
0@([abc])*bcd@abcd
|
||||
0@a|b|c|d|e@e
|
||||
0@(a|b|c|d|e)f@ef
|
||||
0@((a*|b))*@-
|
||||
0@abcd*efg@abcdefg
|
||||
0@ab*@xabyabbbz
|
||||
0@ab*@xayabbbz
|
||||
0@(ab|cd)e@abcde
|
||||
0@[abhgefdc]ij@hij
|
||||
1@^(ab|cd)e@abcde
|
||||
0@(abc|)ef@abcdef
|
||||
0@(a|b)c*d@abcd
|
||||
0@(ab|ab*)bc@abc
|
||||
0@a([bc]*)c*@abc
|
||||
0@a([bc]*)(c*d)@abcd
|
||||
0@a([bc]+)(c*d)@abcd
|
||||
0@a([bc]*)(c+d)@abcd
|
||||
0@a[bcd]*dcdcde@adcdcde
|
||||
1@a[bcd]+dcdcde@adcdcde
|
||||
0@(ab|a)b*c@abc
|
||||
0@((a)(b)c)(d)@abcd
|
||||
0@[A-Za-z_][A-Za-z0-9_]*@alpha
|
||||
0@^a(bc+|b[eh])g|.h$@abh
|
||||
0@(bc+d$|ef*g.|h?i(j|k))@effgz
|
||||
0@(bc+d$|ef*g.|h?i(j|k))@ij
|
||||
1@(bc+d$|ef*g.|h?i(j|k))@effg
|
||||
1@(bc+d$|ef*g.|h?i(j|k))@bcdd
|
||||
0@(bc+d$|ef*g.|h?i(j|k))@reffgz
|
||||
1@((((((((((a))))))))))@-
|
||||
0@(((((((((a)))))))))@a
|
||||
1@multiple words of text@uh-uh
|
||||
0@multiple words@multiple words, yeah
|
||||
0@(.*)c(.*)@abcde
|
||||
1@\((.*),@(.*)\)
|
||||
1@[k]@ab
|
||||
0@abcd@abcd
|
||||
0@a(bc)d@abcd
|
||||
0@a[-]?c@ac
|
||||
0@(....).*\1@beriberi
|
38
gnu/usr.bin/grep/tests/status.sh
Executable file
38
gnu/usr.bin/grep/tests/status.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#! /bin/sh
|
||||
# Test for status code for GNU grep.
|
||||
# status code
|
||||
# 0 match found
|
||||
# 1 no match
|
||||
# 2 file not found
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
# should return 0 found a match
|
||||
echo "abcd" | ${GREP} -E -e 'abc' > /dev/null 2>&1
|
||||
if test $? -ne 0 ; then
|
||||
echo "Status: Wrong status code, test \#1 failed"
|
||||
failures=1
|
||||
fi
|
||||
|
||||
# should return 1 found no match
|
||||
echo "abcd" | ${GREP} -E -e 'zbc' > /dev/null 2>&1
|
||||
if test $? -ne 1 ; then
|
||||
echo "Status: Wrong status code, test \#2 failed"
|
||||
failures=1
|
||||
fi
|
||||
|
||||
# the filename MMMMMMMM.MMM should not exist hopefully
|
||||
# should return 2 file not found
|
||||
if test -b MMMMMMMM.MMM; then
|
||||
echo "Please remove MMMMMMMM.MMM to run check"
|
||||
else
|
||||
${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
|
||||
fi
|
||||
|
||||
exit $failures
|
19
gnu/usr.bin/grep/tests/warning.sh
Executable file
19
gnu/usr.bin/grep/tests/warning.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Tell them not to be alarmed.
|
||||
|
||||
: ${srcdir=.}
|
||||
|
||||
failures=0
|
||||
|
||||
#
|
||||
cat <<\EOF
|
||||
|
||||
Please, do not be alarmed if some of the tests failed.
|
||||
Report them to <bug-gnu-utils@gnu.org>,
|
||||
with the line number, the name of the file,
|
||||
and grep version number 'grep --version'.
|
||||
Make sure you have the word grep in the subject.
|
||||
Thank You.
|
||||
|
||||
EOF
|
Loading…
Reference in New Issue
Block a user