svn commit: r316536 - in head: contrib/netbsd-tests/usr.bin/grep usr.bin/grep/tests
Ed Maste
emaste at FreeBSD.org
Wed Apr 5 18:41:47 UTC 2017
Author: emaste
Date: Wed Apr 5 18:41:44 2017
New Revision: 316536
URL: https://svnweb.freebsd.org/changeset/base/316536
Log:
bsdgrep: create additional tests for coverage on recent fixes
Create additional tests to cover regressions that were discovered by
PRs linked to reviews D10098, D10102, and D10104.
It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base
system currently pass all of these tests, and gnugrep(1) not quite being
up to snuff was also noted in at least one of the PRs.
PR: 175314 202022 195763 180990 197555 197531 181263 209116
Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: cem, ngie, emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10112
Added:
head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out
head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out
head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out
head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in (contents, props changed)
head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out
Modified:
head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
head/usr.bin/grep/tests/Makefile
Added: head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_color_a.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+abcd*
Added: head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_color_a.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+abcd*
Added: head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_color_b.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,5 @@
+fojeiwuroiuwet
+ljfajsljkfabcdddjlfkajlkj
+abcaaa
+zzzabc
+
Added: head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_color_b.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,3 @@
+ljfajsljkfabcdddjlfkajlkj
+abcaaa
+zzzabc
Added: head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_color_c.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,3 @@
+ljfajsljkf[01;31m[Kabcddd[m[Kjlfkajlkj
+[01;31m[Kabc[m[Kaaa
+zzz[01;31m[Kabc[m[K
Added: head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_escmap.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+f.oo
Added: head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_f_file_empty.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,2 @@
+Fish zebra monkey suits
+
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+01:1:01
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_a.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,3 @@
+0
+:
+:0
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+1:1:01
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_b.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,2 @@
+:
+:0
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+bla bla
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_c.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,2 @@
+bla
+bla
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_d.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1,3 @@
+bla
+bla
+
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.in Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+abcdef
Added: head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/contrib/netbsd-tests/usr.bin/grep/d_oflag_zerolen_e.out Wed Apr 5 18:41:44 2017 (r316536)
@@ -0,0 +1 @@
+ab
Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==============================================================================
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Apr 5 18:31:26 2017 (r316535)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh Wed Apr 5 18:41:44 2017 (r316536)
@@ -226,10 +226,102 @@ context2_body()
atf_check -o file:"$(atf_get_srcdir)/d_context2_c.out" \
grep -z -C1 cod test1 test2
}
+# Begin FreeBSD
+atf_test_case oflag_zerolen
+oflag_zerolen_head()
+{
+ atf_set "descr" "Check behavior of zero-length matches with -o flag (PR 195763)"
+}
+oflag_zerolen_body()
+{
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_a.out" \
+ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_a.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_b.out" \
+ grep -Eo '(^|:)0*' "$(atf_get_srcdir)/d_oflag_zerolen_b.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_c.out" \
+ grep -Eo '[[:alnum:]]*' "$(atf_get_srcdir)/d_oflag_zerolen_c.in"
+
+ atf_check -o empty grep -Eo '' "$(atf_get_srcdir)/d_oflag_zerolen_d.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \
+ grep -o -e 'ab' -e 'bc' "$(atf_get_srcdir)/d_oflag_zerolen_e.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_oflag_zerolen_e.out" \
+ grep -o -e 'bc' -e 'ab' "$(atf_get_srcdir)/d_oflag_zerolen_e.in"
+}
+
+atf_test_case xflag
+xflag_head()
+{
+ atf_set "descr" "Check that we actually get a match with -x flag (PR 180990)"
+}
+xflag_body()
+{
+ echo 128 > match_file
+ seq 1 128 > pattern_file
+ grep -xf pattern_file match_file
+}
+
+atf_test_case color
+color_head()
+{
+ atf_set "descr" "Check --color support"
+}
+color_body()
+{
+ echo 'abcd*' > grepfile
+ echo 'abc$' >> grepfile
+ echo '^abc' >> grepfile
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_a.out" \
+ grep --color=auto -e '.*' -e 'a' "$(atf_get_srcdir)/d_color_a.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_b.out" \
+ grep --color=auto -f grepfile "$(atf_get_srcdir)/d_color_b.in"
+
+ atf_check -o file:"$(atf_get_srcdir)/d_color_c.out" \
+ grep --color=always -f grepfile "$(atf_get_srcdir)/d_color_b.in"
+}
+
+atf_test_case f_file_empty
+f_file_empty_head()
+{
+ atf_set "descr" "Check for handling of a null byte in empty file, specified by -f (PR 202022)"
+}
+f_file_empty_body()
+{
+ printf "\0\n" > nulpat
+
+ atf_check -s exit:1 grep -f nulpat "$(atf_get_srcdir)/d_f_file_empty.in"
+}
+
+atf_test_case escmap
+escmap_head()
+{
+ atf_set "descr" "Check proper handling of escaped vs. unescaped dot expressions (PR 175314)"
+}
+escmap_body()
+{
+ atf_check -s exit:1 grep -o 'f.o\.' "$(atf_get_srcdir)/d_escmap.in"
+ atf_check -o not-empty grep -o 'f.o.' "$(atf_get_srcdir)/d_escmap.in"
+}
+
+atf_test_case egrep_empty_invalid
+egrep_empty_invalid_head()
+{
+ atf_set "descr" "Check for handling of an invalid empty pattern (PR 194823)"
+}
+egrep_empty_invalid_body()
+{
+ atf_check -s exit:1 egrep '{' /dev/null
+}
+# End FreeBSD
atf_init_test_cases()
{
- atf_add_test_case basic
+ atf_add_test_case basic
atf_add_test_case binary
atf_add_test_case recurse
atf_add_test_case recurse_symlink
@@ -245,4 +337,12 @@ atf_init_test_cases()
atf_add_test_case zgrep
atf_add_test_case nonexistent
atf_add_test_case context2
+# Begin FreeBSD
+ atf_add_test_case oflag_zerolen
+ atf_add_test_case xflag
+ atf_add_test_case color
+ atf_add_test_case f_file_empty
+ atf_add_test_case escmap
+ atf_add_test_case egrep_empty_invalid
+# End FreeBSD
}
Modified: head/usr.bin/grep/tests/Makefile
==============================================================================
--- head/usr.bin/grep/tests/Makefile Wed Apr 5 18:31:26 2017 (r316535)
+++ head/usr.bin/grep/tests/Makefile Wed Apr 5 18:41:44 2017 (r316536)
@@ -8,6 +8,11 @@ ${PACKAGE}FILES+= d_basic.out
${PACKAGE}FILES+= d_begin_end_a.out
${PACKAGE}FILES+= d_begin_end_b.out
${PACKAGE}FILES+= d_binary.out
+${PACKAGE}FILES+= d_color_a.in
+${PACKAGE}FILES+= d_color_a.out
+${PACKAGE}FILES+= d_color_b.in
+${PACKAGE}FILES+= d_color_b.out
+${PACKAGE}FILES+= d_color_c.out
${PACKAGE}FILES+= d_context2_a.out
${PACKAGE}FILES+= d_context2_b.out
${PACKAGE}FILES+= d_context2_c.out
@@ -18,12 +23,23 @@ ${PACKAGE}FILES+= d_context_b.out
${PACKAGE}FILES+= d_context_c.out
${PACKAGE}FILES+= d_context_d.out
${PACKAGE}FILES+= d_egrep.out
+${PACKAGE}FILES+= d_escmap.in
+${PACKAGE}FILES+= d_f_file_empty.in
${PACKAGE}FILES+= d_file_exp.in
${PACKAGE}FILES+= d_file_exp.out
${PACKAGE}FILES+= d_ignore_case.out
${PACKAGE}FILES+= d_input
${PACKAGE}FILES+= d_invert.in
${PACKAGE}FILES+= d_invert.out
+${PACKAGE}FILES+= d_oflag_zerolen_a.in
+${PACKAGE}FILES+= d_oflag_zerolen_a.out
+${PACKAGE}FILES+= d_oflag_zerolen_b.in
+${PACKAGE}FILES+= d_oflag_zerolen_b.out
+${PACKAGE}FILES+= d_oflag_zerolen_c.in
+${PACKAGE}FILES+= d_oflag_zerolen_c.out
+${PACKAGE}FILES+= d_oflag_zerolen_d.in
+${PACKAGE}FILES+= d_oflag_zerolen_e.in
+${PACKAGE}FILES+= d_oflag_zerolen_e.out
${PACKAGE}FILES+= d_recurse.out
${PACKAGE}FILES+= d_recurse_symlink.err
${PACKAGE}FILES+= d_recurse_symlink.out
More information about the svn-src-head
mailing list